Skip to content

Instantly share code, notes, and snippets.

@SurDevOps
Forked from msrivastav13/generatepkgXML.sh
Created November 27, 2020 03:10
Show Gist options
  • Save SurDevOps/7c8f4efe617c9e6302c6e880dbbd3a0a to your computer and use it in GitHub Desktop.
Save SurDevOps/7c8f4efe617c9e6302c6e880dbbd3a0a to your computer and use it in GitHub Desktop.
Generates package.xml from the Unmanaged container/Managed Package or Changesets
#!/bin/bash
if [ $# -lt 1 ]
then
echo Usage: generatepkgXML.sh orgalias packageName
exit
fi
## Retrieve the PackageXML from Unmanaged Container
sfdx force:mdapi:retrieve -s -r ./mdapipkg -u $1 -p "$2" # Retrieve Metadata API Source from Package Name
unzip -o -qq ./mdapipkg/unpackaged.zip -d ./mdapipkg # Unzip the file
rm -rf ./manifest/ # If manifest directory exists delete it
mkdir ./manifest/ # Create a New Manifest Directory
cp -a ./mdapipkg/package.xml ./manifest/ # Copy package.XML to manifest directory
rm -rf ./mdapipkg # Delete the mdapipkg source
@SurDevOps
Copy link
Author

https://gist.github.com/msrivastav13/881dd229d75780283675b40c36d5e85c

chmod +x ./scripts/generatepkgXML.sh
./scripts/generatepkgXML.sh devOrg "SampleApp"

sfdx force:source:retrieve -x ./manifest/package.xml -u devOrg

sfdx force:config:set defaultusername=devOrg

./scripts/deploypkg.sh devOrg2

Use the sfdx plugins:install:mo-dx-plugin.

And then download the Vscode extension plugin named "DX code companion". This has command to download CCDX: Retrieve source from package

Q)Really It was a nice video shared by you on SFDX with non scratch org. Appreciate you on sharing knowledge.

We are planning to implement the CICD for SFDC sales application, currently we team using changesets to deploy in different orgs like (Dev, SIT, UAT, PROD) manually. Here Dev Org is used by the Dev team, and the CICD tool is GITLAB.
Here I have question:
I am actually a DevOps person not background on Salesforce,
can we implement CICD without scratch org for deploying packages into different orgs ?
No Static code analysis and no automation testing available in current application.
Since application is dependent on manual testing at each level, after package metadata, should we commit metadata package back to Git repo into different directory for deploying to higher environments ?

A)"Yes you can do CI/CD without scratch orgs.
You will have to commit the metadata to the repo."
Q)
Regarding, the profiles and permission sets automated deployment into sandboxes and PROD through CICD.
While using scratch org model development, I could see that it is creating entire package of force-app directory, if entire force-app directory is deployed into any sandbox which would take more time to do the deployment right. Instead of that what would be easy approach to do deployment while using scratch orgs and
How are maintaining the code in Git repo like Feature branch(what it contains - Only feature changes or entire source code)
After creating a scratch org (empty) while pushing code the scratch org ( it's throwing many errors and we have more than 15000+ components certainly which are taking more time and failing to push). Need suggestion on move forward further at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment