-1

I have encountered a problem while attempting to deploy my code to a Droplet server (running Ubuntu) using BitBucket Pipeline.

I have set the necessary environment variables (SSH_PRIVATE_KEY, SSH_USER, SSH_HOST) and added the public key of the SSH_PRIVATE_KEY to the ~/.ssh/authorized_keys file on the server. When I manually deploy from the server, there are no issues with cloning or pulling. However, during the automatic CI deployment stage, I am encountering the error shown in the attached image.

enter image description here

This is my .yml configuration.

enter image description here

Thanks for helps in advance.

ray
  • 11,310
  • 7
  • 18
  • 42
  • Please paste your bitbucket-pipelines.yml as a code block, NOT as a screenshot image of your code. Also, please expand the failed script instruction to show the error message and, again, paste it as text and not as a screenshot image. – N1ngu Feb 09 '23 at 11:02

1 Answers1

0

To refer to the values of the variables in defined in the configuration, you script should use $VARIABLE_NAME, not VARIABLE_NAME as that is literally that string.

- pipe: atlassian/ssh-run:latest
  variables:
    SSH_KEY: $SSH_KEY
    SSH_USER: $SSH_USER
    SERVER: $SSH_HOST
    COMMAND: "/app/deploy_dev01.sh"

Also, note some pitfalls exists when using an explicit $SSH_KEY, it is generally easier and safer to use the default key provided by Bitbucket, see Load key "/root/.ssh/pipelines_id": invalid format

N1ngu
  • 2,862
  • 17
  • 35