Hi
We are trying to run a self-runner for Bitbucket for development and some testing. But I have a problem with SSH key.
What did I do:
- SSH key created in pipelines > ssh-keys
- new SSH key added to server (added to ~/.ssh/authorized_keys) through SSH KEY Management - key exists in file
- A new runner added to pipelines > runners
- bitbucket-pipeline.yml
- Runner: I'm running on my local pc (tested also on a remote server)
After running the pipeline on the git change, I see only an error, and the pipeline stops
If we run on Bitbucket Runner, there are no errors and everything works.
If you have this issue with the self-runner in the pipeline, you will need to change the bitbucket-pipeline.yml.
script:
- # SSH
- eval $(ssh-agent -s)
- ssh-keygen -p -m PEM -f "$BITBUCKET_SSH_KEY_FILE" -N ""
- ssh-add "$BITBUCKET_SSH_KEY_FILE"
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- cp "$BITBUCKET_SSH_KEY_FILE" ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -t rsa ${SERVER} >> ~/.ssh/known_hosts
- ssh-add -l -E md5
Final bitbucker-pipeline.yml
image: quay.io/hypernode/deploy:3-php8.2-node18
pipelines:
branches:
master:
- step:
image: quay.io/hypernode/deploy:3-php8.3-node18
name: build
runs-on: [self.hosted, linux, docker, hypernode]
trigger: automatic
script:
- # SSH
- eval $(ssh-agent -s)
- ssh-keygen -p -m PEM -f "$BITBUCKET_SSH_KEY_FILE" -N ""
- ssh-add "$BITBUCKET_SSH_KEY_FILE"
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- cp "$BITBUCKET_SSH_KEY_FILE" ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -t rsa ${SERVER} >> ~/.ssh/known_hosts
- ssh-add -l -E md5
- export DEPLOYER_IMAGE="hypernode"
- hypernode-deploy build -vvv
artifacts:
- build/**
- parallel:
- step:
image: quay.io/hypernode/deploy:3-php8.3-node18
name: deploy
runs-on: [self.hosted, linux, docker, hypernode]
deployment: production
trigger: automatic
script:
- # SSH
- eval $(ssh-agent -s)
- ssh-keygen -p -m PEM -f "$BITBUCKET_SSH_KEY_FILE" -N ""
- ssh-add "$BITBUCKET_SSH_KEY_FILE"
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- cp "$BITBUCKET_SSH_KEY_FILE" ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -t rsa ${SERVER} >> ~/.ssh/known_hosts
- ssh-add -l -E md5
- export DEPLOYER_IMAGE="hypernode"
- hypernode-deploy deploy production -vvv
after-script:
- hypernode-deploy cleanup -vvv
This was tested and is working with self-runner and BitBucket pipeline
Those steps seem correct, and this would be supported by Atlassian Cloud runners executing the build without issues.
To troubleshoot this further - we will need access to your runner logs, YAML config/pipelines settings. For this - our system requires that you raise a support ticket. As you have access to a paid workspace - you can raise a support ticket from the link below:
If you have issues raising a support ticket, please let me know your timezone so I can raise one on your behalf with the team that operates within your region.
Cheers!
- Ben (Bitbucket Cloud Support)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.