-
Bug
-
Resolution: Fixed
-
Medium
I am building a CI solution for Salesforce code. In Salesforce, there are no atomic deploys, so you must manually delete files that have been renamed or removed. Yea.
My solution to this was to track the commit the pipeline runs on so that I can generate a list of all deleted files from the previous pipeline run with git diff <previous sha>..<current sha>.
The problem is that even with clone: depth: full enabled in the pipeline.yml, git throws an error because the previous commit doesn't seem to exist. I verified this is an issue by recreating the pipeline in a Docker container. When I use my normally cloned repo on my local machine, the git diff command works fine. When I clone the repo the way the pipeline does via git clone --branch="staging" <url>, then the command fails and returns a fatal: bad object <sha> error.
My pipeline:
image: node:latest clone: depth: full definitions: caches: sfdx: ~/.sfdx sfdx-libs: ~/.local/share/sfdx yarn: ~/.yarn pipelines: branches: staging: - step: caches: - node - sfdx - sfdx-libs script: - git show $BITBUCKET_COMMIT - echo $BITBUCKET_COMMIT > ~/.sfdx/current-build - tasks/build $BITBUCKET_BRANCH - tasks/deploy $BITBUCKET_BRANCH - echo $BITBUCKET_COMMIT > ~/.sfdx/previous-build
Not a problem, glad you've managed to get it working! Feel free to reach out if you have any other questions.