forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
491 stars 78 forks source link

Required --manifest Parameter with the metadata dir tag #2909

Closed DilipJainFL closed 2 months ago

DilipJainFL commented 3 months ago

Note Currently I am using the Latest SF CLI V2 - @salesforce/cli/2.42.6 wsl-x64 node-v20.14.0 , and facing one issue with the deployment when utilizing the --metdata dir tag to deploy a single package (Zip) file.
** I have use case to use the metadata dir only with the project* Also I am using the purge on delete tag to delete data from Recycle bin as well.** But when I am passing the parameters and tags using the below command sf project deploy start -o username --metadata-dir ${buildZip} -g -w 1665 --single-package --post-destructive-changes build/destructiveChangesPost.xml --verbose --purge-on-delete image

* Now When adding the --manifiest to handle the above error receving one more error that can not use the manifest with --metadata dir sf project deploy start -o ${env.bamboo_sf_username} --metadata-dir ${buildZip} -g -w ${env.bamboo_sf_maxWaitMillis} --single-package --manifest package.xml --post-destructive-changes build/destructiveChangesPost.xml --verbose --purge-on-delete

image

Summary

In summarizaed words would like to deploy a zip with purge on delete using the SF CLI with metdata dir tag. leveraging the first command added above.

github-actions[bot] commented 3 months ago

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

github-actions[bot] commented 3 months ago

Hello @DilipJainFL :wave: It looks like you didn't include the full Salesforce CLI version information in your issue. Please provide the output of version --verbose --json for the CLI you're using (sf or sfdx).

A few more things to check:

Thank you!

DilipJainFL commented 3 months ago

Updated the description -
here is the version - @salesforce/cli/2.42.6 wsl-x64 node-v20.14.0

cristiand391 commented 3 months ago

--purge-on-delete requires --manifest.

You can pass a manifest or a zip file, but not both.

DilipJainFL commented 3 months ago

If you check the first message I have tried to use the only with zip but then it was asking for the --purge-on-delete requires manifest file. image

cristiand391 commented 3 months ago

If you check the first message I have tried to use the only with zip but then it was asking for the --purge-on-delete requires manifest file.

that's what I mentioned above, you can pass a manifest or a zip file but not both.

--purge-on-delete only works when deploying with--manifest.

DilipJainFL commented 3 months ago

Thanks for the Reply.
But When I am trying with the similar SFDX command It is working fine -
sfdx force:mdapi:deploy -u username -f ${buildZip} -g -w 1665 -s -l NoTestRun --purgeondelete --verbose

git2gus[bot] commented 3 months ago

This issue has been linked to a new work item: W-16010166

shetzel commented 3 months ago

Looks like a bug. We'll change the command so that --purge-on-delete does not require --manifest.

chulai commented 3 months ago

@shetzel, I agree this seems to be a bug. My thoughts:

--purgeondelete works with METADATA API FORMAT using sfdx force:mdapi:deploy. --purge-on-delete does not work with METADATA API FORMAT using sf project deploy start. --metadata-dir flag is used with sf-style command to deploy with METADATA API FORMAT. --purge-on-delete flag should not require --manifest. This is a SOURCE FORMAT FLAGS that doesn't apply to METADATA API FORMAT deployments. --purge-on-delete flag should not require --pre-destructive-changes or --post-destructive-changes either if --metadata-dir includes a zip file of metadata formatted files to deploy. This zip file should include a package.xml file, and any destructiveChangesPre.xml or destructiveChangesPost.xml files.

DilipJainFL commented 2 months ago

@mshanemc Could you please share details about the completions for this ticket and what is solution to resolve the issue. I'm able to use the below command sf project deploy start -o username --metadata-dir build_1.zip -g -w 35791 --single-package --purge-on-delete --verbose but It's not throwing any error but It's not deleting the components from the org.

Please share the details about this. Thanks!

mshanemc commented 2 months ago

Does your zip file include at least one destructiveChangesPre|Post file? Want to provide a sample project that replicates your issue?

docs now say

Deploy all metadata formatted files in the "MDAPI" directory; items listed in the MDAPI/destructiveChangesPre.xml and MDAPI/destructiveChangesPost.xml manifests are immediately eligible for deletion rather than stored in the Recycle Bin:

DilipJainFL commented 2 months ago

Yes It have the post file. image

DilipJainFL commented 2 months ago

@mshanemc Could you please share any general example that worked for you in the dev environment.