Sfdx-git-delta: A forceignored file is still copied into output directory

Created on 2 Aug 2021  路  12Comments  路  Source: scolladon/sfdx-git-delta

Put a ts file in forceignore.
See that SGD works fine

Expected result :
File is not copied into ouput dir (--generate-delta / -d)

Current Result:
File is copied into ouput dir and deployments is failing with below error.

{
  "status": 1,
  "name": "UnexpectedFileFound",
  "message": "Unexpected file found in package directory: /agent/_work/1/s/force-app/wow/wmf_order/lwc/woo_freeOrderAgoraForm.d.ts",
  "exitCode": 1,
  "commandName": "SourceDeployCommand",
  "stack": "UnexpectedFileFound: Unexpected file found in package directory: /agent/_work/1/s/force-app/wow/wmf_order/lwc/woo_freeOrderAgoraForm.d.ts\n    at Workspace.isValidSourcePath (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/source/workspace.js:167:35)\n    at SourcePathStatusManager.getNewPathInfos (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/source/sourcePathStatusManager.js:447:28)\n    at async /agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/source/sourcePathStatusManager.js:451:60\n    at async Promise.all (index 4)\n    at async SourcePathStatusManager.getNewPathInfos (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/source/sourcePathStatusManager.js:452:31)\n    at async /agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/source/sourcePathStatusManager.js:451:60\n    at async Promise.all (index 4)\n    at async SourcePathStatusManager.getNewPathInfos (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/source/sourcePathStatusManager.js:452:31)\n    at async /agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/source/sourcePathStatusManager.js:451:60\n    at async Promise.all (index 5)\n    at async SourcePathStatusManager.getNewPathInfos (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/source/sourcePathStatusManager.js:452:31)\n    at async SourcePathStatusManager.processChangedDirectory (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/source/sourcePathStatusManager.js:433:31)\n    at async SourcePathStatusManager.getSourcePathInfos (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/source/sourcePathStatusManager.js:241:43)\n    at async SourceWorkspaceAdapter.getAggregateSourceElements (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/source/sourceWorkspaceAdapter.js:156:32)\n    at async Object.exports.getSourceElementsFromSourcePath (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/source/sourceUtil.js:175:42)\n    at async SourceDeployApi.doDeploy (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/source/sourceDeployApi.js:58:43)\nOuter stack:\n    at Function.wrap (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/@salesforce/core/lib/sfdxError.js:171:27)\n    at SourceDeployCommand.catch (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/ToolbeltCommand.js:253:46)\n    at async SourceDeployCommand._run (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:85:13)\n    at async Config.runCommand (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/@oclif/config/lib/config.js:173:24)\n    at async SfdxMain.run (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/@oclif/command/lib/main.js:27:9)\n    at async SfdxMain._run (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/node_modules/@oclif/command/lib/command.js:43:20)\n    at async Object.run (/agent/_work/_tool/node/16.6.0/x64/lib/node_modules/sfdx-cli/dist/cli.js:162:47)",
  "warnings": []
}'

.forceignore content :

woo_freeOrderAgoraForm.d.ts
force-app/wow/wmf_order/lwc/woo_freeOrderAgoraForm.d.ts

SGD command:
sfdx sgd:source:delta -d -t HEAD -f 2021_GR05.0 -r /agent/_work/1/salesforce_repo -i /agent/_work/1/salesforce_repo/.forceignore -o output

Operating system:
Linux Ubuntu 20.04
sfdx-git-delta 4.7.2
sfdx-cli/7.110.0 linux-x64 node-v16.6.0

bug

Most helpful comment

My useless contribution to this thread: 馃槈

image
(source: https://xkcd.com/1739/)

All 12 comments

Hi @alexmodis !

Thanks for raising this issue and thanks for your help making this pluging better (t'es un habitu茅 maintenant 馃槈)

I do not reproduce it successfully on my laptop yet (it works well, the file is ignored).
The main difference I can see in term of execution context is the node version.
I'm using v14.16.0.

Could you create a reproduction context in a branch issue/176 in the reproduction playground (by forking it) please ?

Haha :D oui ^^ Merci 脿 toi surtout :D

Command used localy in the repro playground:
sfdx sgd:source:delta -d -t HEAD -f HEAD^1 -r . -i .forceignore -o output

https://github.com/alexmodis/sfdx-git-delta-reproduction-playground/tree/issue/176

On my windows mingw bash:
sfdx-cli/7.63.0 win32-x64 node-v14.15.0

Thanks @alexmodis !

I can reproduce locally. I'll be able to investigate.
My first lead is that this file name (without .d.ts) has the same name as a LWC.

Also, I have a warning when launching the command :

{
  "error": null,
  "output": "output",
  "success": true,
  "warnings": [
    "force-app/wow/wmf_order/objects/WOO_WMF_Order_Line_Item__c/WOO_WMF_Order_Line_Item__c.object-meta.xml: Source and destination must not be the same.",
    "force-app/wow/wmf_order/objects/WOO_WMF_Orders__c/WOO_WMF_Orders__c.object-meta.xml: Source and destination must not be the same."
  ]
}

Do you have the same warning ?
Is it normal/expected based on the content of the repo ? Or should I also investigate on that too ?

Yes I have the same warnings. I never investigate them as everything is working fine like that ^^ and I don't really understand the warning message.

Those warnings seems to be related to this issue

A PR is on his way to fix the weird copy behaviour.

Stay tuned for the next release (probably today)

@scolladon new sfdx error now :p

+ '{
  "status": 1,
  "name": "Missing Metadata File",
  "message": "Expected metadata file with '\''-meta.xml'\'' extension at path: /agent/_work/1/s/force-app/main/default/staticresources/Core_Assets.resource-meta.xml",
  "exitCode": 1,
  "commandName": "SourceDeployCommand",
  "stack": "Missing Metadata File: Expected metadata file with '\''-meta.xml'\'' extension at path: /agent/_work/1/s/force-app/main/default/staticresources/Core_Assets.resource-meta.xml\n    at AggregateSourceElement.composeMetadata (/agent/_work/_tool/node/16.6.1/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/source/aggregateSourceElement.js:449:29)\n    at AggregateSourceElement.getMetadataPathTranslation (/agent/_work/_tool/node/16.6.1/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/source/aggregateSourceElement.js:427:78)\n    at AggregateSourceElement.getFilePathTranslations (/agent/_work/_tool/node/16.6.1/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/source/aggregateSourceElement.js:407:56)\nOuter stack:\n    at Function.wrap (/agent/_work/_tool/node/16.6.1/x64/lib/node_modules/sfdx-cli/node_modules/@salesforce/core/lib/sfdxError.js:171:27)\n    at SourceDeployCommand.catch (/agent/_work/_tool/node/16.6.1/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/ToolbeltCommand.js:253:46)\n    at async SourceDeployCommand._run (/agent/_work/_tool/node/16.6.1/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:85:13)\n    at async Config.runCommand (/agent/_work/_tool/node/16.6.1/x64/lib/node_modules/sfdx-cli/node_modules/@oclif/config/lib/config.js:173:24)\n    at async SfdxMain.run (/agent/_work/_tool/node/16.6.1/x64/lib/node_modules/sfdx-cli/node_modules/@oclif/command/lib/main.js:27:9)\n    at async SfdxMain._run (/agent/_work/_tool/node/16.6.1/x64/lib/node_modules/sfdx-cli/node_modules/@oclif/command/lib/command.js:43:20)\n    at async Object.run (/agent/_work/_tool/node/16.6.1/x64/lib/node_modules/sfdx-cli/dist/cli.js:162:47)",
  "warnings": []

gonna check on other PullRequest if I'm getting the same

@scolladon error just above is appearing now on 4.8.0 on pullRequest that was OK with sgd 4.7.2

@alexmodis do you have details on how to reproduce the issue ? Have isolated the use case ?

I put it in repro playground but not able to reproduce. I guess that only one of the file changed (in my repo), the static resource one but not the meta linked to it.
Does SGD add the meta file even if it does not change ?

EDIT : I'm now able to reproduce here : issue/176-static-res-error
by only putting a diff on static res but not on the meta file.
sfdx sgd:source:delta -d -t HEAD -f HEAD^1 -r . -i .forceignore -o output

Obeserved:
output dir contains the static res but not the meta file

Expected:
static res & its meta file are presents even if there is no diff in meta file linked

Thanks, I reproduce it locally.
It is a side effect of the fix for the previous bug.
I'll fix it soon

My useless contribution to this thread: 馃槈

image
(source: https://xkcd.com/1739/)

@alexmodis new release 4.8.1 available !

We fixed the fix 馃槈

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DougMidgley picture DougMidgley  路  7Comments

arafesthain picture arafesthain  路  7Comments

RichardBeadle picture RichardBeadle  路  6Comments

sheldonleelazarus picture sheldonleelazarus  路  4Comments

alexmodis picture alexmodis  路  8Comments