bitbucketdigital-oceanbitbucket-pipelinesdroplet

bitbucket ssh login fail on digitalOcean droplet


I am making ci/cd with bitbucket and droplet ubuntu.

this is my bitbucket-pipeline.yml:

image: atlassian/default-image:3

pipelines:
  default:
    - parallel:
      - step:
          name: 'Build and Test'
          script:
            - echo "Your build and test goes here..."
      - step:
          name: deploy
          deployment: test
          script:
            - echo "Deploying master to live"
            - pipe: atlassian/ssh-run:0.1.4
              variables:
                SSH_USER: 'root'
                SERVER: '259.MY DROPLET PUBLIC IP.198'
                PASSWORD: '4adsfdsh'
                COMMAND: 'ci-scripts/pull-deploy-master.sh'
                MODE: 'script'

I tried to login to my server and this command on the server: ci-scripts/pull-deploy-master.sh but it's ssh login fail with password

and I am getting this error: āœ– No default SSH key configured in Pipelines.

Can anyone please tell me how to fix this?


Solution

  • I don't see that PASSWORD variable being acknowledged anywhere in the atlassian/ssh-run pipe documentation.

    I think it is being ignored and the pipe is trying to fallback to your repository default ssh key, which you didn't set up.

    Even if the PASSWORD could be passed as a variable, and set up as a secret variable, which I fear you neither did, I would strongly encourage to use ssh-key authentication and NOT password authentication.

    Please follow this guideline https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/#Steps-to-use-SSH-keys-in-Pipelines . This mainly involves:

    1. creating a key pair from your repository settings
    2. whitelisting your remote server fingerprint from your repository settings
    3. authorizing the public key in your remote server