scolladon / sfdx-git-delta

Generate the sfdx content in source format from two git commits
Other
441 stars 115 forks source link

destructiveChanges does not work as expected #914

Closed yaniv3109 closed 1 month ago

yaniv3109 commented 1 month ago

What is the problem?


Hi, I deleted a field but unfortunately it is not found in the file nor was it really deleted at the end of the deployment.

What is the parameter and the value you used with it?

  1. sfdx sgd:source:delta --to --from --output . --json
  2. sf project deploy start --manifest "package/package.xml" --pre-destructive-changes "destructiveChanges/destructiveChanges.xml"

What is the expected result?

Deleting the field

What is the actual result?

The deployment was successful but nothing happened

Steps to reproduce

Deleting a field and running the command

Execution context


Operating System:

yarn version:

node version:

git version:

sfdx version:

sgd plugin version:

More information (optional)


scolladon commented 1 month ago

Hi @yaniv3109 !

Thanks for raising this issue and thanks for contributing in making this project better!

I need your help to reproduce the issue 👍

What is the content of the package.xml ?

What is the output of this command : git diff --name-status --no-renames <from> <to> ?

What is the content of the .gitignore file ?

Are you using a .forceignore file ? What is its content ?

yaniv3109 commented 1 month ago

Hi Sebastien, How are you? Good to hear from you!

The package file is empty and unfortunately also the destructiveChanges file. This is a new field that I created just for the test, its file is not mentioned in forceignore.

Can we have a meeting and I will show you how I built it? Thank you very much!! Yaniv

This is the content of the gitignore file:

This file is used for Git repositories to specify intentionally untracked

files that Git should ignore.

If you are not using git, you can delete this file. For more information

see: https://git-scm.com/docs/gitignore

For useful gitignore templates see: https://github.com/github/gitignore

Salesforce cache

.sf/ .sfdx/ .localdevserver/

.vscode/

LWC VSCode autocomplete

**/lwc/jsconfig.json

LWC Jest coverage reports

coverage/

SOQL Query Results

**/scripts/soql/query-results

Logs

logs .log npm-debug.log yarn-debug.log yarn-error.log

Dependency directories

node_modules/

Eslint cache

.eslintcache

Windows system files

Thumbs.db ehthumbs.db [Dd]esktop.ini $RECYCLE.BIN/

‫בתאריך יום ה׳, 12 בספט׳ 2024 ב-12:30 מאת ‪Sebastien‬‏ <‪ @.***‬‏>:‬

Hi @yaniv3109 https://github.com/yaniv3109 !

Thanks for raising this issue and thanks for contributing in making this project better!

I need your help to reproduce the issue 👍

What is the content of the package.xml ?

What is the output of this command : git diff --name-status --no-renames

? What is the content of the .gitignore file ? Are you using a .forceignore file ? What is its content ? — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you were mentioned.Message ID: ***@***.***>
scolladon commented 1 month ago

Thanks for those information, I'm good thank for asking ! And you ?

I will not be available to meet until tomorrow, maybe we can make progress async until we are blocked :)

Could you give me the answer to this question please ?

What is the output of this command : git diff --name-status --no-renames <from> <to> ?

yaniv3109 commented 1 month ago

I'm fine, thanks! It is difficult to run the command because it is written while the pipeline is running. Anyway, I got an error trying to run it: unknown revision or path not in the working tree.

‫בתאריך יום ה׳, 12 בספט׳ 2024 ב-13:41 מאת ‪Sebastien‬‏ <‪ @.***‬‏>:‬

Thanks for those information, I'm good thank for asking ! And you ?

I will not be available to meet until tomorrow, maybe we can make progress async until we are blocked :)

Could you give me the answer to this question please ?

What is the output of this command : git diff --name-status --no-renames ?

— Reply to this email directly, view it on GitHub https://github.com/scolladon/sfdx-git-delta/issues/914#issuecomment-2345912733, or unsubscribe https://github.com/notifications/unsubscribe-auth/BB2WMRLYWRE3LBNRUULWE5TZWFVVBAVCNFSM6AAAAABOCOPTEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBVHEYTENZTGM . You are receiving this because you were mentioned.Message ID: @.***>

scolladon commented 1 month ago

weird...

what is the value of <from> and <to> parameters ?

yaniv3109 commented 1 month ago

I tried to run it in my local machine. the same result: [image: image.png]

‫בתאריך יום ה׳, 12 בספט׳ 2024 ב-14:31 מאת ‪Sebastien‬‏ <‪ @.***‬‏>:‬

weird...

what is the value of and parameters ?

— Reply to this email directly, view it on GitHub https://github.com/scolladon/sfdx-git-delta/issues/914#issuecomment-2346040130, or unsubscribe https://github.com/notifications/unsubscribe-auth/BB2WMRMJ7QMORUJYPWHUN6DZWF3RTAVCNFSM6AAAAABOCOPTEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBWGA2DAMJTGA . You are receiving this because you were mentioned.Message ID: @.***>

scolladon commented 1 month ago

I cannot see the image.

Could you create a branch on the reproduction playground so I can reproduce the issue on my laptop please ?

yaniv3109 commented 1 month ago

I'm sorry but this is a government organization. I don't think it's possible. Anyway, here is the text of the image: PS P:\CrmLoan> git diff --name-status 'Qa' 'QaDelta' fatal: ambiguous argument 'Qa': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git [...] -- [...]'

‫בתאריך יום ה׳, 12 בספט׳ 2024 ב-16:13 מאת ‪Sebastien‬‏ <‪ @.***‬‏>:‬

I cannot see the image.

Could you create a branch on the reproduction playground https://github.com/scolladon/sfdx-git-delta-reproduction-playground so I can reproduce the issue on my laptop please ?

— Reply to this email directly, view it on GitHub https://github.com/scolladon/sfdx-git-delta/issues/914#issuecomment-2346251629, or unsubscribe https://github.com/notifications/unsubscribe-auth/BB2WMRIQJNYH6KODUPAC7IDZWGHRLAVCNFSM6AAAAABOCOPTEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBWGI2TCNRSHE . You are receiving this because you were mentioned.Message ID: @.***>

scolladon commented 1 month ago

Maybe the Qa branch is not created locally and just available remotely.

You have 2 ways to fix this :

yaniv3109 commented 1 month ago

Good morning! You were right: PS P:\CrmLoan> git diff --name-status 'origin/Qa' 'origin/QaDelta' D force-app/main/default/objects/LON_Budgetc/fields/TestTestc.field-meta.xml M force-app/main/default/translations/iw.translation-meta.xml

testtest is the field I created and then deleted

If you have time I'm quite available today... on Fridays we don't work Thanks Yaniv

‫בתאריך יום ה׳, 12 בספט׳ 2024 ב-16:42 מאת ‪Sebastien‬‏ <‪ @.***‬‏>:‬

Maybe the Qa branch is not created locally and just available remotely.

You have 2 ways to fix this :

  • either checkout both Qa and QaDelta branch
  • either prefix them with the remote. per exemple if your remote is named origin : git diff --name-status 'origin/Qa' 'origin/QaDelta'

— Reply to this email directly, view it on GitHub https://github.com/scolladon/sfdx-git-delta/issues/914#issuecomment-2346323779, or unsubscribe https://github.com/notifications/unsubscribe-auth/BB2WMRJBTYQVH5ZXXXKDUDDZWGK3LAVCNFSM6AAAAABOCOPTEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBWGMZDGNZXHE . You are receiving this because you were mentioned.Message ID: @.***>

scolladon commented 1 month ago

Hi @yaniv3109

Thats a good news !

Could you try that please ? :

sgd:source:delta --to "origin/QaDelta" --from "origin/Qa" --output . --json
yaniv3109 commented 1 month ago

Sorry for the delay It turns out that the software was deleted locally for me somehow and the organization's policy prevents me from reinstalling it. I hope that they will help me first and I can send you the answer Thank you very much and have a nice weekend! Yaniv

‫בתאריך יום ו׳, 13 בספט׳ 2024 ב-10:39 מאת ‪Sebastien‬‏ <‪ @.***‬‏>:‬

Hi @yaniv3109 https://github.com/yaniv3109

Thats a good news !

Could you try that please ? :

sgd:source:delta --to "origin/QaDelta" --from "origin/Qa" --output . --json

— Reply to this email directly, view it on GitHub https://github.com/scolladon/sfdx-git-delta/issues/914#issuecomment-2348249689, or unsubscribe https://github.com/notifications/unsubscribe-auth/BB2WMROQJUIREHZIYUCFT5DZWKJEHAVCNFSM6AAAAABOCOPTEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBYGI2DSNRYHE . You are receiving this because you were mentioned.Message ID: @.***>

yaniv3109 commented 1 month ago

I get the following error even though the software is installed.. (local)

sgd:source:delta --to "origin/QaDelta" --from "origin/Qa" --output . --json sgd:source:delta : The term 'sgd:source:delta' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

‫בתאריך יום ו׳, 13 בספט׳ 2024 ב-12:27 מאת ‪Yaniv Naor‬‏ <‪ @.***‬‏>:‬

Sorry for the delay It turns out that the software was deleted locally for me somehow and the organization's policy prevents me from reinstalling it. I hope that they will help me first and I can send you the answer Thank you very much and have a nice weekend! Yaniv

‫בתאריך יום ו׳, 13 בספט׳ 2024 ב-10:39 מאת ‪Sebastien‬‏ <‪ @.***‬‏>:‬

Hi @yaniv3109 https://github.com/yaniv3109

Thats a good news !

Could you try that please ? :

sgd:source:delta --to "origin/QaDelta" --from "origin/Qa" --output . --json

— Reply to this email directly, view it on GitHub https://github.com/scolladon/sfdx-git-delta/issues/914#issuecomment-2348249689, or unsubscribe https://github.com/notifications/unsubscribe-auth/BB2WMROQJUIREHZIYUCFT5DZWKJEHAVCNFSM6AAAAABOCOPTEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBYGI2DSNRYHE . You are receiving this because you were mentioned.Message ID: @.***>

yaniv3109 commented 1 month ago

I got it! You changed the commands according to the new commands... Unfortunately, the output really comes out empty: { "status": 0, "result": { "error": null, "output": ".", "success": true, "warnings": [] } } Thanks for your patience! Yaniv

‫בתאריך יום א׳, 15 בספט׳ 2024 ב-11:27 מאת ‪Yaniv Naor‬‏ <‪ @.***‬‏>:‬

I get the following error even though the software is installed.. (local)

sgd:source:delta --to "origin/QaDelta" --from "origin/Qa" --output . --json sgd:source:delta : The term 'sgd:source:delta' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

  • sgd:source:delta --to "origin/QaDelta" --from "origin/Qa" --output . ...
  • 
    + CategoryInfo          : ObjectNotFound: (sgd:source:delta:String)
    [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

‫בתאריך יום ו׳, 13 בספט׳ 2024 ב-12:27 מאת ‪Yaniv Naor‬‏ <‪ @.***‬‏>:‬

Sorry for the delay It turns out that the software was deleted locally for me somehow and the organization's policy prevents me from reinstalling it. I hope that they will help me first and I can send you the answer Thank you very much and have a nice weekend! Yaniv

‫בתאריך יום ו׳, 13 בספט׳ 2024 ב-10:39 מאת ‪Sebastien‬‏ <‪ @.***‬‏>:‬

Hi @yaniv3109 https://github.com/yaniv3109

Thats a good news !

Could you try that please ? :

sgd:source:delta --to "origin/QaDelta" --from "origin/Qa" --output . --json

— Reply to this email directly, view it on GitHub https://github.com/scolladon/sfdx-git-delta/issues/914#issuecomment-2348249689, or unsubscribe https://github.com/notifications/unsubscribe-auth/BB2WMROQJUIREHZIYUCFT5DZWKJEHAVCNFSM6AAAAABOCOPTEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBYGI2DSNRYHE . You are receiving this because you were mentioned.Message ID: @.***>

scolladon commented 1 month ago

That's a typo from my end in the previous message. It misses the sfdx command

You should use this command :

$ sfdx sgd:source:delta --to "origin/QaDelta" --from "origin/Qa" --output . --json

What do you mean by the output is still empty ? The destructiveChanges.xml is not populated ? If yes, could you help me reproduce in the reproduction playground please ?

patrykacc commented 1 month ago

What I have discovered on my end, using the plugin for generating the DC package works in IMO enpredictable way, my example: I used the following parameters: --from origin/develop --to origin/feature-xyz and plugin was generating n unexpected output when my local branches were outdated. After I did git pull on both, feature and develop branch, and the re-run command with exact same parameters, then output was generated as expected. Please have a look at the issue, as certainly something is happenening, as I need to point my devs to update branch with latest develop, on each opened PR, even though always we reference remote repo (origin), otherwise validations are failing with false negative error, not related to changes in PR, which brings a lot of confusion. Let me know if I can provide any more details to support resolution.

yaniv3109 commented 1 month ago

Hi, Sorry for the delay. I solved the problem. Since it is a comparison between 2 branches, I had to create another branch to compare to validate. My other branch was not updated so this happened. Thanks so much for trying to help!!

scolladon commented 1 month ago

What I have discovered on my end, using the plugin for generating the DC package works in IMO enpredictable way, my example: I used the following parameters: --from origin/develop --to origin/feature-xyz and plugin was generating n unexpected output when my local branches were outdated. After I did git pull on both, feature and develop branch, and the re-run command with exact same parameters, then output was generated as expected. Please have a look at the issue, as certainly something is happenening, as I need to point my devs to update branch with latest develop, on each opened PR, even though always we reference remote repo (origin), otherwise validations are failing with false negative error, not related to changes in PR, which brings a lot of confusion. Let me know if I can provide any more details to support resolution.

When you reference remote repo, git does not go to the repo and fetch the latest content for you. It just takes what is already locally here. If you do not want to create local branch and use the remote branch name, and still want the result to be the same as the one done in the remote repository, you still have to do a git fetch before executing the plugin locally, to make sure the local pointers are up to date