-1

Wtth help of below article i've setup SSH keys for bitbucket so i can use it in pipelines https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/

When tested on terminal window by entering following command it works fine:

$ ssh -T git@bitbucket.org 

enter image description here

but when i run my pipelines it fails enter image description here

Added public key under my bitbucket profile enter image description here My Pipeline:

    image:
  name: abhisheksaxena7/salesforcedockerimg
pipelines:
  branches:
    feature/**:
      - step:
          script:
            - ant -buildfile build/build.xml deployEmptyCheckOnly -Dsfdc.username=$SFDC_USERNAME -Dsfdc.password=$SFDC_PASS$SFDC_TOKEN -Dsfdc.serverurl=https://$SFDC_SERVERURL
    # master:
    #   - step:
    #       script:
    #         - ant -buildfile build/build.xml deployCode -Dsfdc.username=$SFDC_USERNAME -Dsfdc.password=$SFDC_PASS$SFDC_TOKEN -Dsfdc.serverurl=https://$SFDC_SERVERURL
    Admin-Changes:
      - step:
          script:
            - echo my_known_hosts
            # Set up SSH key; follow instructions at https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Bitbucket+Pipelines
            - (mkdir -p ~/.ssh ; cat my_known_hosts >> ~/.ssh/known_hosts; umask  077 ; echo $SSH_KEY | base64 --decode -i > ~/.ssh/id_rsa)

            # Read update_to_trigger_pipelines.txt into commitmsg variable
            - commitmsg="$(<update_to_trigger_pipelines.txt)"

            # Set up repo and checkout master
            - echo git@bitbucket.org:$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG.git
            - 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

            # Get metadata from server
            - ant -buildfile build/build.xml getCode -Dsfdc.username=$SFDC_USERNAME -Dsfdc.password=$SFDC_PASS$SFDC_TOKEN -Dsfdc.serverurl=https://$SFDC_SERVERURL

            # Commit any changes to master
            - git add force-app/main/default/*
            - 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
Ramesh
  • 127
  • 4
  • 13

1 Answers1

-1

I was adding my local server ssh key to my profile instead repository SSH KEY, so i had to get repository pipelines SSH Keys and add it to my profile.

enter image description here

Ramesh
  • 127
  • 4
  • 13