Hi there,
Please, help, I can’t get working atlassian/ssh-run:0.2.2 step in deployment pipeline. SSH Always fails with "Execution failed" whatever command I provide.
This is not authentication issue. I downloaded bitbucket generated key pair to my own machine. I can login with this key pair from my own machine.
I installed docker, downloaded atlassian/ssh-run:0.2.2 container and run it from my own machine and the it works.
The problem only happens when I run pipeline from Bitbucket.
Here is my bitbucket-pipelines.yml:
image: atlassian/default-image:2
pipelines:
default:
- step:
script:
- echo "Everything is awesome!"
- step:
name: Deploy to production
deployment: Production
trigger: manual
script:
- echo "Deployment"
- pipe: atlassian/ssh-run:0.2.2
variables:
SSH_USER: 'username'
SERVER: ’server.name'
COMMAND: 'git status'
DEBUG: 'true'
Here is log from Bitbucket
<span>+ docker container run \<br></span><span> --volume=/opt/atlassian/pipelines/agent/build:/opt/atlassian/pipelines/agent/build \</span>
<span> --volume=/opt/atlassian/pipelines/agent/ssh:/opt/atlassian/pipelines/agent/ssh:ro \<br></span><span> --volume=/usr/local/bin/docker:/usr/local/bin/docker:ro \<br></span><span> --volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes \<br></span><span> --volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/ssh-run:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/ssh-run \</span>
<span> --workdir=$(pwd) \<br> --label=org.bitbucket.pipelines.system=true \</span>
--env=BITBUCKET_STEP_TRIGGERER_UUID="$BITBUCKET_STEP_TRIGGERER_UUID" \<br> --env=BITBUCKET_REPO_FULL_NAME="$BITBUCKET_REPO_FULL_NAME" \<br> --env=BITBUCKET_GIT_HTTP_ORIGIN="$BITBUCKET_GIT_HTTP_ORIGIN" \<br> --env=BITBUCKET_REPO_SLUG="$BITBUCKET_REPO_SLUG" \<br> --env=CI="$CI" \<br> --env=BITBUCKET_REPO_OWNER="$BITBUCKET_REPO_OWNER" \<br> --env=BITBUCKET_REPO_IS_PRIVATE="$BITBUCKET_REPO_IS_PRIVATE" \<br> --env=BITBUCKET_WORKSPACE="$BITBUCKET_WORKSPACE" \<br> --env=BITBUCKET_DEPLOYMENT_ENVIRONMENT_UUID="$BITBUCKET_DEPLOYMENT_ENVIRONMENT_UUID" \<br> --env=BITBUCKET_REPO_OWNER_UUID="$BITBUCKET_REPO_OWNER_UUID" \<br> --env=BITBUCKET_STEP_RUN_NUMBER="$BITBUCKET_STEP_RUN_NUMBER" \<br> --env=BITBUCKET_BUILD_NUMBER="$BITBUCKET_BUILD_NUMBER" \<br> --env=BITBUCKET_BRANCH="$BITBUCKET_BRANCH" \<br> --env=BITBUCKET_GIT_SSH_ORIGIN="$BITBUCKET_GIT_SSH_ORIGIN" \<br> --env=BITBUCKET_COMMIT="$BITBUCKET_COMMIT" \<br> --env=BITBUCKET_REPO_UUID="$BITBUCKET_REPO_UUID" \<br> --env=BITBUCKET_CLONE_DIR="$BITBUCKET_CLONE_DIR" \<br> --env=PIPELINES_JWT_TOKEN="$PIPELINES_JWT_TOKEN" \<br> --env=BITBUCKET_DEPLOYMENT_ENVIRONMENT="$BITBUCKET_DEPLOYMENT_ENVIRONMENT" \<br> --env=BITBUCKET_DOCKER_HOST_INTERNAL="$BITBUCKET_DOCKER_HOST_INTERNAL" \<br> --env=DOCKER_HOST="tcp://host.docker.internal:2375" \<br> --env=BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" \<br> --env=BITBUCKET_PIPE_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/ssh-run" \<br> --env=COMMAND="git status" \<br> --env=DEBUG="true" \<br> --env=MODE="command" \<br> --env=SERVER="<a href="http://otvebot.ru/" target="_blank" rel="noopener nofollow noreferrer">s</a>erver.name" \<br> --env=SSH_USER="username" \<br> --add-host="host.docker.internal:$BITBUCKET_DOCKER_HOST_INTERNAL" \<br> bitbucketpipelines/ssh-run:0.2.2<br>Unable to find image 'bitbucketpipelines/ssh-run:0.2.2' locally
0.2.2: Pulling from bitbucketpipelines/ssh-run<br>e7c96db7181b: Pulling fs layer
060724ebe89d: Pulling fs layera<br>547cdd87cce: Pulling fs layer
3aa2084f634b: Pulling fs layer
1937cc58f4cb: Pulling fs layer<br>3aa2084f634b: Waiting<br>1937cc58f4cb: Waiting<br>a547cdd87cce: Verifying Checksum<br>a547cdd87cce: Download complete<br>e7c96db7181b: Verifying Checksum<br>e7c96db7181b: Download complete<br>060724ebe89d: Verifying Checksum<br>060724ebe89d: Download complete<br>3aa2084f634b: Verifying Checksum
3aa2084f634b: Download complete<br>e7c96db7181b: Pull complete<br>1937cc58f4cb: Verifying Checksum<br>1937cc58f4cb: Download complete<br>060724ebe89d: Pull complete<br>a547cdd87cce: Pull complete<br>3aa2084f634b: Pull complete<br>1937cc58f4cb: Pull complete<br>Digest: sha256:ba5dade7cf6bd5136c412810e172aa70aa4f8381e0de356a305442d94d5c0891<br>Status: Downloaded newer image for bitbucketpipelines/ssh-run:0.2.2INFO: Executing the pipe...<br>INFO: Using default ssh key
INFO: Executing command on server.name<br>ssh -A -tt -i /root/.ssh/pipelines_id -o StrictHostKeyChecking=no -p 22 <a href="mailto:u0177672@otvebot.ru" target="_blank" rel="noopener nofollow noreferrer">username@s</a>erver.name git status<br>Warning: Permanently added ’<a href="http://otvebot.ru/" target="_blank" rel="noopener nofollow noreferrer">server.n</a>ame,X.X.X.X' (ECDSA) to the list of known hosts.<br>Connection to <a href="http://otvebot.ru/" target="_blank" rel="noopener nofollow noreferrer">s</a>erver.name closed.<br>✖ Execution failed.<br><br>
It works from my own machine though
docker run -it --volume=/home/use/.ssh:/opt/atlassian/pipelines/agent/ssh --volume=/home/user/ssh-test/project:/project --workdir=/project -e SSH_USER='username' -e SERVER=’server.name' -e COMMAND='git status' bitbucketpipelines/ssh-run:0.2.2
INFO: Executing the pipe...
INFO: Using default ssh key
INFO: Executing command on server.name
ssh -A -tt -i /root/.ssh/pipelines_id -o StrictHostKeyChecking=no -p 22 username@server.name git status
# On branch master
nothing to commit (working directory clean)
Connection to server.name closed.
✔ Execution finished.