scolladon / sfdx-git-delta

Generate the sfdx content in source format from two git commits
Other
444 stars 114 forks source link

Comparing branches not generating package.xml #97

Closed g1b3r closed 3 years ago

g1b3r commented 3 years ago

Hi

On git i have 2 branches develop and master. When i comparing this branches

sfdx sgd:source:delta --to develop --from master --output . or sfdx sgd:source:delta --to master --from develop --output .

package.xml is empty

2021-02-04T05:32:20.2760251Z --- package.xml generated with added and modified metadata --- 2021-02-04T05:32:20.2771449Z <?xml version="1.0" encoding="UTF-8"?> 2021-02-04T05:32:20.2772362Z 2021-02-04T05:32:20.2773243Z 50.0 2021-02-04T05:32:20.2778039Z 2021-02-04T05:32:20.2778917Z ---- Deploying added and modified metadata ----

Here is git diff command :

diff --git a/.forceignore b/.forceignore index e43b90c..a4d576c 100644 --- a/.forceignore +++ b/.forceignore @@ -10,5 +10,5 @@ package.xml

LWC Jest

/tests/ -listView-meta.xml +#listView-meta.xml

diff --git a/force-app/main/default/classes/CaseHandler.cls b/force-app/main/default/classes/CaseHandler.cls deleted file mode 100644 index a88ebe9..0000000 --- a/force-app/main/default/classes/CaseHandler.cls +++ /dev/null @@ -1,5 +0,0 @@ -public with sharing class CaseHandler {

scolladon commented 3 years ago

Hi @g1b3r !

Thanks for this issue. I think we will need to discuss a little bit so we can discover the root cause of this issue.

Can you tell us those informations : Operating System:Yarn version:Node version:sgd version:git version: … You can get those with the following command in unix system : $ uname -v ; yarn -v ; node -v ; sgd --version ; git --version

Could you also display the result of this command : git diff develop master --names-status

Thanks in advance

g1b3r commented 3 years ago

Hi @scolladon

OS - ubuntu-20.04 Yarn - 1.22.5 Node - v14.15.4 sdg - latest one (installing every time on start script when i run on ubuntu i got sgd: command not found) git version 2.30.0

git diff develop master --name-status D force-app/main/default/classes/CaseHandler.cls D force-app/main/default/classes/CaseHandler.cls-meta.xml D force-app/main/default/lwc/oppQuickLinks/oppQuickLinks.html D force-app/main/default/lwc/oppQuickLinks/oppQuickLinks.js D force-app/main/default/lwc/oppQuickLinks/oppQuickLinks.js-meta.xml D force-app/main/default/triggers/CaseTrigger.trigger D force-app/main/default/triggers/CaseTrigger.trigger-meta.xml

Thank you

scolladon commented 3 years ago

When running the command (-f master -t develop), what is the content of the destructiveChanges.xml file generated ?

g1b3r commented 3 years ago

--- package.xml generated with added and modified metadata --- <?xml version="1.0" encoding="UTF-8"?>

50.0

---- Deploying added and modified metadata ---- === Deployed Source No results found --- destructiveChanges.xml generated with deleted metadata --- <?xml version="1.0" encoding="UTF-8"?>

50.0

--- Deleting removed metadata ---

scolladon commented 3 years ago

@g1b3r I need a little bit more explanation to understand.

As I can see the diff command display only deletion information, that's probably the reason why there is no content in the package.xml. The plugin is going to store those information in the destructiveChanges.xml.

Does the content of the destructiveChanges.xml reflect the output from the git diff ?

g1b3r commented 3 years ago

@scolladon

No , destructive is empty

In my last comment there is a empty destructive.xml and empty package.xml (github formated my comment)

This is a only example

I tried to add something to repo to generate a different compare but in multiple cases which i try, there is a always empty package.xml and destructive changes

BR

scolladon commented 3 years ago

@g1b3r can you provide reproduction step with a temporary repository so I can try by myself please ?

scolladon commented 3 years ago

Hi @g1b3r !

I really want to help ! My guess is that maybe this issue occurs in a CI context, where it maybe don't have full git clone depth. This could lead to this error during the git diff done by the plugin.

Nevertheless, I have created a repository here to be able to troubleshoot and reproduce this kind of situation. Please create a branch issue/97 with the content of the repository which allow you to reproduce the issue and share that with us.

We will try to reproduce in the same environment as you do (Ubuntu 20.04)

Thanks in advance

g1b3r commented 3 years ago

HI @scolladon

Big sorry for delay but i was unavailable for one month :(

I will let you know about progress

Sorry again

g1b3r commented 3 years ago

Hi i tried to reproduce that issue but still i got empty package.xml :(

scolladon commented 3 years ago

@g1b3r please create a branch issue/97 in this repository and put the state to reproduce the issue and share that with us.

g1b3r commented 3 years ago

@scolladon Im unable todo that remote: Permission to scolladon/sfdx-git-delta-reproduction-playground.git denied to g1b3r.

scolladon commented 3 years ago

Try in your own fork please

g1b3r commented 3 years ago

I tried run CI but now on every run i got

TypeError: Class constructor SfdxCommand cannot be invoked without 'new' /home/vsts/work/_temp/8f6184a3-a857-4460-b744-89eda433b63a.sh: line 14: //sfdx: No such file or directory

scolladon commented 3 years ago

Hi @g1b3r,

There is an issue with the version v4.3.0. A fix has been shipped (v4.3.1), could you retry using this one ?

g1b3r commented 3 years ago

HI @scolladon

I tried new version but still i got empty package.xml

I will send PR from my fork shortly

BR

scolladon commented 3 years ago

Thanks for having created the branch. I have been able to look at it.

Sorry, I do not reproduce the issue with the reproduction branch

When I execute the command I have the package.xml filled properly :

$ git fetch origin pull/2/head:issue/97
$ git checkout issue/97
$ mkdir output
$ sfdx sgd:source:delta -f "HEAD~1" -d
$ cat mac-output/package/package.xml
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>AccountTrigger</members>
        <name>ApexTrigger</name>
    </types>
    <version>50.0</version>
</Package>

Maybe we should schedule a screen sharing session to better understand what is the root cause of the issue. If you are available for that I will create a discord link

g1b3r commented 3 years ago

Yes but you run compare of last 2 revisions not branches

Try to compare master and issue/97 branch

BR

scolladon commented 3 years ago

Same result for me

When I execute the command I have the package.xml filled properly :

$ git fetch origin pull/2/head:issue/97
$ git checkout issue/97
$ mkdir output
$ sfdx sgd:source:delta -f "master" -t "issue/97" -d
$ cat mac-output/package/package.xml
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>AccountTrigger</members>
        <name>ApexTrigger</name>
    </types>
    <version>50.0</version>
</Package>
g1b3r commented 3 years ago

if i run in CI contex no package generated

Here is log

2021-04-07T08:40:11.1423958Z warning sfdx-git-delta > @salesforce/core > jsforce > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 2021-04-07T08:40:11.1425584Z warning sfdx-git-delta > @salesforce/core > jsforce > request > har-validator@5.1.5: this library is no longer supported 2021-04-07T08:40:12.4324930Z Successfully authorized ceran.lukasz@outlook.com with org ID 00D09000003R6e4EAC 2021-04-07T08:40:13.9112678Z { 2021-04-07T08:40:13.9123593Z "error": null, 2021-04-07T08:40:13.9137875Z "output": "./output", 2021-04-07T08:40:13.9138963Z "success": true, 2021-04-07T08:40:13.9139331Z "warnings": [] 2021-04-07T08:40:13.9139646Z } 2021-04-07T08:40:14.0062157Z ---Current Folder--- 2021-04-07T08:40:14.0209911Z README.md 2021-04-07T08:40:14.0210902Z config 2021-04-07T08:40:14.0211225Z devops 2021-04-07T08:40:14.0216103Z force-app 2021-04-07T08:40:14.0216478Z manifest 2021-04-07T08:40:14.0217079Z output 2021-04-07T08:40:14.0217335Z package.json 2021-04-07T08:40:14.0217841Z scripts 2021-04-07T08:40:14.0218098Z server.csr 2021-04-07T08:40:14.0218570Z server.key 2021-04-07T08:40:14.0218832Z server.pass.key 2021-04-07T08:40:14.0219307Z sfdx-bitbucket-org 2021-04-07T08:40:14.0219771Z sfdx-project.json 2021-04-07T08:40:14.0220218Z ---Current Folder--- 2021-04-07T08:40:14.0271349Z destructiveChanges 2021-04-07T08:40:14.0272164Z package 2021-04-07T08:40:14.0277546Z ---Current Folder--- 2021-04-07T08:40:14.0288586Z package.xml 2021-04-07T08:40:14.0294443Z ---End of Listing--- 2021-04-07T08:40:14.0304189Z <?xml version="1.0" encoding="UTF-8"?> 2021-04-07T08:40:14.0305172Z 2021-04-07T08:40:14.0305897Z 50.0 2021-04-07T08:40:14.0311099Z 2021-04-07T08:40:14.0312254Z ---- Deploying added and modified metadata ---- 2021-04-07T08:40:18.7312258Z === Deployed Source 2021-04-07T08:40:18.7319301Z No results found 2021-04-07T08:40:18.7827860Z --- destructiveChanges.xml generated with deleted metadata --- 2021-04-07T08:40:18.7842240Z cat: destructiveChanges/destructiveChanges.xml: No such file or directory 2021-04-07T08:40:18.7889402Z 2021-04-07T08:40:18.7890704Z --- Deleting removed metadata --- 2021-04-07T08:40:18.8004757Z ##[section]Finishing: Bash Script

scolladon commented 3 years ago

I think we should review that CI to understand what is happening here

scolladon commented 3 years ago

@g1b3r any update about this issue ? Do you manage to make it works ? Workaround ? Do you still want us to review it ?

g1b3r commented 3 years ago

Hello

I tried but still it give me error. Maybe we can schedule screen share session to explain how my CI is configured Im free almost every time this week

BR

Pozdrawiam Łukasz Ceran


Od: Sebastien @.> Wysłane: Wednesday, April 28, 2021 10:20:20 AM Do: scolladon/sfdx-git-delta @.> DW: g1b3r @.>; Mention @.> Temat: Re: [scolladon/sfdx-git-delta] Comparing branches not generating package.xml (#97)

@g1b3rhttps://github.com/g1b3r any update about this issue ? Do you manage to make it works ? Workaround ? Do you still want us to review it ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/scolladon/sfdx-git-delta/issues/97#issuecomment-828254201, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AELCZC2MLJBJXT4YER3UXDDTK7AMJANCNFSM4XCFT37A.

scolladon commented 3 years ago

Ok then, contact me on gitter please

g1b3r commented 3 years ago

Hi

Solved with you help. Issue was on my side i azure devops pipelines :)

this to commands added to bash script solved issue git checkout develop git checkout master

Thank you very much :)

Its great tool !!!!!

SathishJumbo commented 2 years ago

Hi, Could you post your Azure DevOps pipeline script here pls?. I too face a similar issue. It will help me to sort it out.