scolladon / sfdx-git-delta

Generate the sfdx content in source format from two git commits
Other
405 stars 111 forks source link

specificTestClasses is added incorrectly to EmailServicesFunction #830

Closed bhushanpuri1991 closed 3 months ago

bhushanpuri1991 commented 3 months ago

Issue verification check:

What is the problem?

When running sfdx sgd:source:delta --to HEAD --from HEAD^ --output . --ignore .gitignore, the output package.xml includes specificTestClasses as member of EmailServicesFunction.

<types>
        <members>specificTestClasses</members>
        <name>EmailServicesFunction</name>
</types>

This happens with 5.35.0 & latest-rc but NOT with 5.30.0

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

sfdx sgd:source:delta --to HEAD --from HEAD^ --output . --ignore .gitignore

What is the expected result?

As there was no change on EmailServicesFunction, the following should have not appeared:

<types>
        <members>specificTestClasses</members>
        <name>EmailServicesFunction</name>
</types>

What is the actual result?

<types>
        <members>specificTestClasses</members>
        <name>EmailServicesFunction</name>
</types>

Steps to reproduce

  1. Include an Apex Class in commit
  2. Run sfdx plugins:install "sfdx-git-delta"
  3. Run sfdx sgd:source:delta --to HEAD --from HEAD^ --output . --ignore .gitignore
  4. Incorrect package.xml is generated
  5. Run sfdx plugins:install "sfdx-git-delta@5.30.0"
  6. Run sfdx sgd:source:delta --to HEAD --from HEAD^ --output . --ignore .gitignore
  7. Correct package.xml is generated

Execution context

Operating System: … Linux (build)

yarn version: … 1.22.22

node version: … 20.12.1

git version: … 2.43.2

sfdx version: … sfdx-cli@7.209.6

sgd plugin version: … Multiple (refer details above)

More information (optional)

scolladon commented 3 months ago

Hi @bhushanpuri1991 !

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

Could you provide the output of this commande please ?

$ git diff --name-status --no-renames HEAD^ HEAD

I suspect a file named specificTestClasses .xml to be changed in HEAD. If it is the case I can think of 2 solutions (there could be more) :

Enszula commented 3 months ago

Hi @scolladon, @bhushanpuri1991

Same for me in project. Was working fine on friday 11 Apr

issue: unexpected EmailServicesFunction:abc-123-package added/generated in manifest file: actual:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="[http://soap.sforce.com/2006/04/metadata">](http://soap.sforce.com/2006/04/metadata%22%3E)
    <types>
        <members>abc-123-package</members>
        <name>EmailServicesFunction</name>
    </types>
    <types>
        <members>AssetStatus</members>
        <name>StandardValueSet</name>
    </types>
    <version>58.0</version>
</Package>

expected:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="[http://soap.sforce.com/2006/04/metadata">](http://soap.sforce.com/2006/04/metadata%22%3E)
    <types>
        <members>AssetStatus</members>
        <name>StandardValueSet</name>
    </types>
    <version>58.0</version>
</Package>

Not sure exactly what wrong. But newest delta was picking file outside force-app/ ex i wrote script to create manifest file for each pull request based on feature branch name ex. for feature branch: feature/abc-123 pipeline will create: ./manifest/abc-123-package.xml (thanks to @scolladon delta)

Temporary Resolution: Downgraded from: v5.38.2 to(last successfulyl working for me): sf plugins:install sfdx-git-delta@v5.34.0 to resolve issue in pipeline.

Thanks

scolladon commented 3 months ago

Yes @Enszula, you're right, everything was working fine past friday.

I moved the latest channel to the same version as the latest-rc this morning because the latest-rc was live without major issue for a long enough time.

The issue you have is the result of a feature introduced in v5.35.0. This is mainly because the EmailServicesFunction metadata type have the xml suffix (it's a bit odd IMHO)...

I'll ship a fix tomorrow to only detect this type using the folder and not the file type as the suffix is not specific enough. In the meantime you can have the old behavior for metadata type resolution using the v5.34.0 (or the stable channel).

Stay tuned.

TonyWhiteSMS commented 3 months ago

Yep spotted this crop up over the last few days ourselves. Look forward to seeing a fix tomorrow.

Sero030 commented 3 months ago

Faced the same issue, the files from Manifest folder are getting included in the package.xml as EmailServicesFunction. Added the --source ./force-app parameter to the command, it fixed the above issue, but for me it's still including the force-app folder as Experience Bundle now

image

Edit - Downgrading the version worked for me.

scolladon commented 3 months ago

Hi @Sero030, the issue with the force-app folder requires a different fix than for EmailServicesFunction. I need more information, especially a way to reproduce so I can investigate further. You could even create another issue to treat this

Could you provide the result of this command please :

$ git diff --name-status --no-renames <from> <to>

I suspect there are files in the force-app folder that are not metadata (like eslint files per example) but are interpreted like so.

Sero030 commented 3 months ago

Hi @Sero030, the issue with the force-app folder requires a different fix than for EmailServicesFunction. I need more information, especially a way to reproduce so I can investigate further. You could even create another issue to treat this

Could you provide the result of this command please :

$ git diff --name-status --no-renames <from> <to>

I suspect there are files in the force-app folder that are not metadata (like eslint files per example) but are interpreted like so.

Ran the above command, Can't list all the files, but these are the additional files other than required metadata files I can see -

M   .gitignore
A   .sf/config.json
A   commit-id.txt
M   destructive/destructiveChanges.xml
M   destructive/package.xml
M   manifest/package1_staticresources.xml
M   manifest/package2_independentcomponents.xml
M   manifest/package3_source.xml
M   sfdx-project.json
M   versionValue.txt 

But all these files I have checked in the branch are out of force-app folder. Also the pipeline was working without any issues till last Thursday. When I used the same commit as last successful deployment today, it fails with this issue.

scolladon commented 3 months ago

Thanks @Sero030, I explained why you have this issue since monday in this post.

Could you give me access to the repository and give me instructions to reproduce please ? I need to have a setup to reproduce the issue and debug. You can use my email on my github public profile if you need to share information.

github-actions[bot] commented 3 months ago

Shipped in release v5.38.3. 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.38.3

Happy incremental deployment!

bhushanpuri1991 commented 3 months ago

@scolladon, sadly, a similar issue happens with Readme.md and Custom Metadata. See the package.xml below:

<types>
        <members>README</members>
        <name>CustomMetadata</name>
</types>
scolladon commented 3 months ago

Thanks for logging it @bhushanpuri1991 I'll ship a fix soon. Stay tuned

bhushanpuri1991 commented 3 months ago

@scolladon, Many thanks. On a different note, I am planning to replace sfdx with sf. How shall the source-delta command look like?

scolladon commented 3 months ago

I hope you'll find all the information you need here @bhushanpuri1991 :)

github-actions[bot] commented 3 months ago

Shipped in release v5.39.1. 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.39.1

Happy incremental deployment!