Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A forceignored file is still copied into output directory #176

Closed
alexmodis opened this issue Aug 2, 2021 · 12 comments · Fixed by #178 or #179
Closed

A forceignored file is still copied into output directory #176

alexmodis opened this issue Aug 2, 2021 · 12 comments · Fixed by #178 or #179
Assignees
Labels
bug Something isn't working

Comments

@alexmodis
Copy link

alexmodis commented Aug 2, 2021

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

@alexmodis alexmodis added the bug Something isn't working label Aug 2, 2021
@scolladon
Copy link
Owner

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 ?

@alexmodis
Copy link
Author

alexmodis commented Aug 3, 2021

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

@scolladon scolladon reopened this Aug 3, 2021
@scolladon
Copy link
Owner

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 ?

@alexmodis
Copy link
Author

alexmodis commented Aug 4, 2021

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.

@scolladon
Copy link
Owner

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)

@alexmodis
Copy link
Author

alexmodis commented Aug 4, 2021

@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

@alexmodis
Copy link
Author

alexmodis commented Aug 4, 2021

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

@scolladon
Copy link
Owner

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

@alexmodis
Copy link
Author

alexmodis commented Aug 4, 2021

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

@scolladon
Copy link
Owner

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

@mehdisfdc
Copy link
Collaborator

My useless contribution to this thread: 😉

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

@scolladon
Copy link
Owner

@alexmodis new release 4.8.1 available !

We fixed the fix 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants