I'm looking for guidance regarding a method to check the package/package.xml before deploying.
My sgd command is as follows:
sh """
$NODE_BIN_PATH/sfdx sgd:source:delta \
--to $CURRENT_COMMIT \
--from $PREVIOUS_COMMIT \
--output .
--ignore .forceignore
"""
My force:source:deploy command is as follows:
stage('Deploy to Salesforce org') {
steps {
container('node') {
script {
sh '''
$NODE_BIN_PATH/sfdx force:source:deploy \
--targetusername $SF_USERNAME \
-x package/package.xml
'''
}
}
}
We have some valid scenarios wherein our jenkins pipeline is triggered, but there are no files in the package/package.xml that was generated from the sgd:source:delta command.
Is there a recommended way to check if the output file from sgd:source:delta (package/package.xml) for any files BEFORE deployment? Jenkins file is in Groovy, with the script commands in Bash.
I'd implement this logic into a separate stage that checks if package/package.xml is empty, if it is empty, do not proceed to deployment. If it is not empty, proceed to the deployment stage.