I am having difficulty trying to configure my pipeline with bitbucket repo using SSH. As per the documentation (https://confluence.atlassian.com/bitbucket/use-ssh-keys-in-bitbucket-pipelines-847452940.html), I've generated a SSH key pair for the bitbucket repository in question.
The basic workflow via the yml is as follows:
- clone the bitbucket repo (this seems to happen by default in the "Build Setup" step and works fine)
- fetch and checkout master (this fails at the git fetch command with "permission denied (publickey)" message
- get config changes from salesforce org (this part works fine in isolation)
- commit changes to master branch (haven't been able to get here yet...)
Sample yml here:
pipelines:
default:
- step:
script:
# commit message
- commitmsg="Latest PROD changes committed to master branch"
# Set up repo and checkout master
- git remote set-url origin git@bitbucket.org:$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG.git
- git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
- git fetch
- git checkout master
#- echo "getting latest changes from PROD..."
- ant -buildfile build/build.xml getCode -Dsf.username=$SF_USERNAME -Dsf.password=$SF_PASSWORD -Dsf.serverurl=$SF_SERVERURL -Dbamboo.build.dir=$BUILD_DIR
# Commit any changes to master
- git add src/*
- git config user.name "$GIT_USERNAME"
- git config user.email "$GIT_EMAIL"
- if [[ -n $(git status -s) ]] ; then filelist=`git status -s` ; git commit -a -m "$commitmsg" -m "$filelist" ; git push origin master:master ; else echo "No changes detected"; fi
My confusion comes with how to use the above-generated SSH key pair with this configuration - this method seems to be quite new and the documentation is lacking (I'm finding a lot of dead confluence links.....).
There is a previous answered post that covers manually creating the SSH key pairs and using environment variables here - (https://community.atlassian.com/t5/Bitbucket-questions/How-do-I-set-up-ssh-public-key-authentication-so-that-I-can-use/qaq-p/171671) but is this still relevant now that the SSH keys are generated through the pipelines UI?
Any help here would be greatly appreciated!