I'm trying to setup CICD pipeline to validate code changes before deployment to next environment.
My pipeline is triggered when PR is created,
here is a part of pipeline that i need to fix. In particular, this line doen't work as expected:
- sf sgd:source:delta -f HEAD^ --output . -i .gitignore
It works fine, if in PullRequest there is one commit, and it identifies only the last commit changes.
However, it should identify the whole diff between source and target branch.
This worked on Azure pipeline and here in bitbucket it's not.
I tried different ways, and I'm stuck
pull-requests:
'**':
- step:
name: Install Salesforce CLI (new) and sfdx-scanner plugin. Decrypt server key and auth to org
deployment: nirvana
script:
- echo "Running Validation to Nirvana"
#Install SF CLI and Scanner
- npm install --global @salesforce/cli
# - sf plugins install @salesforce/sfdx-scanner
- echo "show username" $USERNAME
#Decrypt server key
- openssl enc -nosalt -aes-256-cbc -d -in assets/server.key.enc -out assets/server.key -base64 -K $DECRYPTION_KEY -iv $DECRYPTION_IV
# Auth to Nirvana
- sf org login jwt --username $USERNAME --jwt-key-file assets/server.key --client-id $CONSUMER_KEY --instance-url $INSTANCE_URL
#Installing sfdx-git-delta plugin
- echo 'y' | sf plugins:install sfdx-git-delta
# Checking for delta changes
- sf sgd:source:delta -f HEAD^ --output . -i .gitignore
#Showing the generated delta of package.xml
- cat package/package.xml
#Showing the destructiveChanges.xml
- cat destructiveChanges/destructiveChanges.xml
#Running validation on source code
- sf project deploy start --ignore-warnings --manifest package/package.xml --dry-run --test-level RunLocalTests --target-org $USERNAME --post-destructive-changes destructiveChanges/destructiveChanges.xml --wait 40