scolladon / sfdx-git-delta

Generate the sfdx content in source format from two git commits
Other
402 stars 110 forks source link

Permission set difference generated with incorrect 'force-app' text #876

Closed tamastom closed 4 weeks ago

tamastom commented 1 month ago

Issue verification check:

What is the problem?


While generating difference for permission set (and other metadata types) for the permission set only, it generates an incorrect force-app text in the name:

 <types>
        <members>force-app</members>
        <name>PermissionSet</name>
  </types>

It is a similar issue to this one but with permission set this time: https://github.com/scolladon/sfdx-git-delta/issues/834

Tried the last two different versions and two different operation systems (Macos locally, ubuntu-latest on the pipeline) as well.

What is the parameter and the value you used with it? (tried with both)

sf sgd:source:delta --from 'dev' --to 'feature/Tamas-Test' --output '.' sfdx sgd source delta --from 'dev' --to 'feature/Tamas-Test' --output '.'

What is the expected result?

 <types>
        <members>StoreBuyer</members>
        <name>PermissionSet</name>
</types>

What is the actual result?

force-app PermissionSet

Steps to reproduce


Execution context


Operating System: … Macos locally and ubuntu within Azure Devops pipeline agent produce the same error

yarn version:

node version:

git version:

sfdx version: … @salesforce/cli/2.42.6 darwin-arm64 node-v20.12.2

sgd plugin version: … the last two versions I tried:5.39.1 and latest

More information (optional)


(node:20357) Warning: Deprecated config name: apiVersion. Please use org-api-version instead. (Use node --trace-warnings ... to show where the warning was created) { "error": null, "output": ".", "success": true, "warnings": [] }

scolladon commented 1 month ago

Hi @tamastom !

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

I just need to add a permission set under the force-app/**/permissionsets/ directory and I'll be able to experience the issue right ?

firatesmer commented 1 month ago

Hi @tamastom !

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

I just need to add a permission set under the force-app/**/permissionsets/ directory and I'll be able to experience the issue right ?

Hİ @scolladon,

That's correct.

scolladon commented 1 month ago

Hi @firatesmer !

Thanks for contributing here !

I tried to reproduce and so I created the branch issue/876 in our reproduction playground. I execute the following commands with sfdx-git-delta@latest (v5.40.0) :

$ git clone git@github.com:scolladon/sfdx-git-delta-reproduction-playground.git
$ git checkout issue/876
$ sfdx sgd:source:delta -f HEAD~1 -d

Unfortunately it seems to work fine on my local as it produce this result:

<!-- output/package/package.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Marketing</members>
        <name>PermissionSet</name>
    </types>
    <version>59.0</version>
</Package>
$ tree output/sgd
output/sgd
└── reproduction
    └── playground
        └── permissionsets
            └── Marketing.permissionset-meta.xml

Could you check on your end that you can reproduce the issue with the reproduction playground please ?

scolladon commented 1 month ago

Any help on how to reproduce the issue here please @tamastom @firatesmer ?

tamastom commented 1 month ago

@scolladon Getting there:

image

This is now happened on the playground - looks like it is a relative path issue. I was on this path (root of the repo) when I used your exact same command: Documents/projects/permissionset/sfdx-git-delta-reproduction-playground sfdx-git-delta-reproduction-playground % sfdx sgd:source:delta -f HEAD~1 -d

scolladon commented 1 month ago

Thanks for that @tamastom it definitely helps.

Could you give me more context please by providing the result of this command please:

$ uname -v ; yarn -v ; node -v ; git --version ; sfdx --version ; sfdx plugins

It seems you are not on the branch issue/876 but rather on master. You should not have the apex class listed and the api version should be 59 Could you checkout the branch on the reproduction playground and test again please (git checkout issue/876) ?

tamastom commented 1 month ago

Results: Uname: Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 Node: v20.12.2 Git: git version 2.39.3 (Apple Git-146) SFDX: @salesforce/cli/2.42.6 darwin-arm64 node-v20.12.2 SFDX Plugins: sfdx-git-delta 5.39.1 (5.39.1) Uninstalled JIT Plugins: community 3.2.10 custom-metadata 3.3.7 dev 2.3.1 devops-center 1.2.10 env 3.0.30 functions 1.23.0 signups 2.3.1 @salesforce/sfdx-plugin-lwc-test 1.2.0 @salesforce/sfdx-scanner 3.24.0

scolladon commented 1 month ago

Hi @tamastom !

That is very weird... Could you try with the latest version of the plugin (v5.40.0) and let us know please (sfdx plugins:install sfdx-git-delta@latest) ?

mehdicherf commented 1 month ago

@scolladon FYI I've tried to replicate the issue with v5.40.0, but couldn't' (it was working fine on my end).

Config:

Darwin Kernel Version 23.5.0: Wed May 1 20:09:52 PDT 2024; root:xnu-10063.121.3~5/RELEASE_X86_64 1.22.17 v20.14.0 git version 2.43.0 @salesforce/cli/2.42.6 darwin-x64 node-v20.14.0 sfdx-git-delta 5.40.0

Uninstalled JIT Plugins: community 3.2.10 custom-metadata 3.3.7 dev 2.3.1 devops-center 1.2.10 env 3.0.30 functions 1.23.0 signups 2.3.1 @salesforce/sfdx-plugin-lwc-test 1.2.0 @salesforce/sfdx-scanner 3.24.0

tamastom commented 1 month ago

@scolladon No joy:

image
scolladon commented 1 month ago

That is very weird @tamastom ...

The only difference I see is the git version. Could you try with something else than the mac version ? You can install git with brew: brew install git Could you try with that as well please ?

nazim-aliyev commented 4 weeks ago

@tamastom just had same issue and after some debugging I've spotted that our file was located in force-app/**/permissionSets/, making folder name all lowercase -> force-app/**/permissionsets/ fixed the issue.

Hope this helps.

tamastom commented 4 weeks ago

@nazim-aliyev Excellent, indeed it was the issue on our side as well!

scolladon commented 4 weeks ago

Thank you @nazim-aliyev ! I reopen this issue because I still thinks we could improve here as the permission sets are not required to be located in their folder and can be identified by their file extension. The plugin needs to be able to get the name of the metadata right in those cases.

github-actions[bot] commented 4 weeks ago

Shipped in release v5.40.2. You can install the new version using the version number or the latest-rc channel

$ sfdx plugins:install sfdx-git-delta@latest-rc
$ sfdx plugins:install sfdx-git-delta@v5.40.2

Happy incremental deployment!