scolladon / sfdx-git-delta

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

Custom Fields not recognized in latest version #869

Closed JulienDryepondt closed 4 months ago

JulienDryepondt commented 4 months ago

What is the problem?

While doing mkdir output && sfdx sgd:source:delta -d -t HEAD -f $LAST_DEPLOYED_COMMIT -i .forceignore -o output my custom fields aren't inside the package.xml or in the force-app/main/default

What is the expected result?

Fields should be included inside the force-app folder.

Steps to reproduce

Download latest plugin (tested with 5.39 and 5.40) with echo y | sfdx plugins:install -f sfdx-git-delta and launch command using SHA1 including fields sfdx sgd:source:delta -d -t HEAD -f $LAST_DEPLOYED_COMMIT -i .forceignore -o output

More information (optional)

I found a workaround, i changed the version installed of the plugins. echo y | sfdx plugins:install -f sfdx-git-delta@5.3.0 And then i found my field TEST__c.field-meta.xml inside the force-app folder.

scolladon commented 4 months ago

Hi @JulienDryepondt !

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

I just had a look to our E2E test and there does not seems to be a regression there

Could you help us reproduce the issue by providing the steps to reproduce it please ? What commit I should create locally to have the issue and what command should I execute ?

JulienDryepondt commented 4 months ago

It's a gitlab runner doing the commands I put in CICD variable the current SHA1 HEAD in the variable named LAST_DEPLOYED_COMMIT from the branch where you want to test I add a text TEST__c field inside Accound object. I commited it and pushed it.

The runner does `- echo y | sfdx plugins:install -f sfdx-git-delta

I entered in the case where the Delta is empty so it doesn't find anything.

By changing the pluging version and not taking the lastest, i don't enter in my custom error message. I hoped this is the reason. But it might be a combination of different versions of tools since you don't have the issue.

scolladon commented 4 months ago

I see.

Could you show us the result of this command please:

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

And if you could replicate the issue inside a fork of our reproduction playground and give me access to your fork it would be greatly helpful !

JulienDryepondt commented 4 months ago

Here's my script logs on latest version :

$ git diff --name-status --no-renames $LAST_DEPLOYED_COMMIT HEAD
M   .gitlab-ci.yml
D   .husky/pre-commit
A   force-app/main/default/objects/Account/fields/TEST_JDR2__c.field-metal.xml
A   package-lock.json
A   pipeline/deploy.sh

And lower with the command sfdx sgd:source:delta -d -t HEAD -f $LAST_DEPLOYED_COMMIT -i .forceignore -o output

$ mkdir output && sfdx sgd:source:delta -d -t HEAD -f $LAST_DEPLOYED_COMMIT -i .forceignore -o output
(node:665445) 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": "output",
  "success": true,
  "warnings": []
}
$ ls output/force-app/main/default
ls: cannot access 'output/force-app/main/default': No such file or directory

I'll try to reproduce on a fork tommorow

scolladon commented 4 months ago

Thanks for that already, could you show the content of the forceignore file before doing the reproduction setup in the fork please ?

JulienDryepondt commented 4 months ago

forceignore is the standard one at the creation of an sfdx project

# List files or directories below to ignore them when running force:source:push, force:source:pull, and force:source:status
# More information: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm
#

package.xml

# LWC configuration files
**/jsconfig.json
**/.eslintrc.json

# LWC Jest
**/__tests__/**
scolladon commented 4 months ago

Hi @JulienDryepondt I think the issue is from the name of the file: force-app/main/default/objects/Account/fields/TEST_JDR2__c.field-metal.xml => it has an "l" at the of meta (metal.xml). It should be ...-meta.xml IMO

Could you try renaming the file force-app/main/default/objects/Account/fields/TEST_JDR2__c.field-meta.xml please ?

JulienDryepondt commented 4 months ago

Hello, sorry for the delay.

You pointed my error, thanks. It's working as expected now