0

I used the sfdx force:mdapi:retrieve --retrievetargetdir force-app -k manifest/package.xml command to pull down the source metadata from a production org. The retrieval process successfully ran and the zipfile was stored in the project force-app directory called unpackaged.zip.

I now want to use the mdapi:deploy option and deploy the metadata to a completely different production org. Do I need to rerun authorize org and connect to the different production org that I'm targeting? How do I make sure that I've correctly authorized and pointed to the production target org? Also, I only want to run a check first so I can just add the --checkonly parameter? Do I need to extract the metadata in the unpackaged.zip file into the force-app/main/default/ directory? Or, can I just point to the unpackaged.zip file to run the deploy?

I haven't gone thru this process using the sfdx commands and am unsure of the exact steps I need to take. All I'm trying to do at the moment is just run a check and verify if the deployment will be successful or get a list of errors.

1 Answer 1

0

Do I need to rerun authorize org and connect to the different production org that I'm targeting?

Unless you're other org is already authorized, then yes, you need to do so.

How do I make sure that I've correctly authorized and pointed to the production target org?

sfdx force:org:list

Will show you the currently connected orgs. If set to default, it will have (U) next to it. If not, you can set the default with:

sfdx force:config:set defaultusername=name-or-alias

Or you can deploy with the -u option.

Also, I only want to run a check first so I can just add the --checkonly parameter?

Yes, you can do that. Once the check passes, you can then use Quick Deploy if you want to avoid having to run tests again (if applicable).

Do I need to extract the metadata in the unpackaged.zip file into the force-app/main/default/ directory? Or, can I just point to the unpackaged.zip file to run the deploy?

Both options are supported. Use whichever you prefer. -d points to a directory in MDAPI format, -f refers to a ZIP file. You may also need -s either way, if the package is a "single package" format (e.g. it has package.xml in the root folder, rather than multiple folders with individual package.xml files).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.