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
+ docker container run \
--volume=/opt/atlassian/pipelines/agent/build:/opt/atlassian/pipelines/agent/build \
--volume=/opt/atlassian/pipelines/agent/ssh:/opt/atlassian/pipelines/agent/ssh:ro \
--volume=/usr/local/bin/docker:/usr/local/bin/docker:ro \
--volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes \
--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 \
--workdir=$(pwd) \
--label=org.bitbucket.pipelines.system=true \--env=BITBUCKET_STEP_TRIGGERER_UUID="$BITBUCKET_STEP_TRIGGERER_UUID" \
--env=BITBUCKET_REPO_FULL_NAME="$BITBUCKET_REPO_FULL_NAME" \
--env=BITBUCKET_GIT_HTTP_ORIGIN="$BITBUCKET_GIT_HTTP_ORIGIN" \
--env=BITBUCKET_REPO_SLUG="$BITBUCKET_REPO_SLUG" \
--env=CI="$CI" \
--env=BITBUCKET_REPO_OWNER="$BITBUCKET_REPO_OWNER" \
--env=BITBUCKET_REPO_IS_PRIVATE="$BITBUCKET_REPO_IS_PRIVATE" \
--env=BITBUCKET_WORKSPACE="$BITBUCKET_WORKSPACE" \
--env=BITBUCKET_DEPLOYMENT_ENVIRONMENT_UUID="$BITBUCKET_DEPLOYMENT_ENVIRONMENT_UUID" \
--env=BITBUCKET_REPO_OWNER_UUID="$BITBUCKET_REPO_OWNER_UUID" \
--env=BITBUCKET_STEP_RUN_NUMBER="$BITBUCKET_STEP_RUN_NUMBER" \
--env=BITBUCKET_BUILD_NUMBER="$BITBUCKET_BUILD_NUMBER" \
--env=BITBUCKET_BRANCH="$BITBUCKET_BRANCH" \
--env=BITBUCKET_GIT_SSH_ORIGIN="$BITBUCKET_GIT_SSH_ORIGIN" \
--env=BITBUCKET_COMMIT="$BITBUCKET_COMMIT" \
--env=BITBUCKET_REPO_UUID="$BITBUCKET_REPO_UUID" \
--env=BITBUCKET_CLONE_DIR="$BITBUCKET_CLONE_DIR" \
--env=PIPELINES_JWT_TOKEN="$PIPELINES_JWT_TOKEN" \
--env=BITBUCKET_DEPLOYMENT_ENVIRONMENT="$BITBUCKET_DEPLOYMENT_ENVIRONMENT" \
--env=BITBUCKET_DOCKER_HOST_INTERNAL="$BITBUCKET_DOCKER_HOST_INTERNAL" \
--env=DOCKER_HOST="tcp://host.docker.internal:2375" \--env=BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" \
--env=BITBUCKET_PIPE_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/ssh-run" \
--env=COMMAND="git status" \
--env=DEBUG="true" \
--env=MODE="command" \
--env=SERVER="server.name" \
--env=SSH_USER="username" \
--add-host="host.docker.internal:$BITBUCKET_DOCKER_HOST_INTERNAL" \
bitbucketpipelines/ssh-run:0.2.2
Unable to find image 'bitbucketpipelines/ssh-run:0.2.2' locally
0.2.2: Pulling from bitbucketpipelines/ssh-run
e7c96db7181b: Pulling fs layer
060724ebe89d: Pulling fs layer
a
547cdd87cce: Pulling fs layer3aa2084f634b: Pulling fs layer
1937cc58f4cb: Pulling fs layer
3aa2084f634b: Waiting
1937cc58f4cb: Waiting
a547cdd87cce: Verifying Checksum
a547cdd87cce: Download completee7c96db7181b: Verifying Checksum
e7c96db7181b: Download complete060724ebe89d: Verifying Checksum
060724ebe89d: Download complete3aa2084f634b: Verifying Checksum
3aa2084f634b: Download complete
e7c96db7181b: Pull complete
1937cc58f4cb: Verifying Checksum
1937cc58f4cb: Download complete
060724ebe89d: Pull complete
a547cdd87cce: Pull complete3aa2084f634b: Pull complete
1937cc58f4cb: Pull complete
Digest: sha256:ba5dade7cf6bd5136c412810e172aa70aa4f8381e0de356a305442d94d5c0891
Status: Downloaded newer image for bitbucketpipelines/ssh-run:0.2.2
INFO: Executing the pipe...
INFO: Using default ssh keyINFO: Executing command on server.name
ssh -A -tt -i /root/.ssh/pipelines_id -o StrictHostKeyChecking=no -p 22 username@server.name git status
Warning: Permanently added ’server.name,X.X.X.X' (ECDSA) to the list of known hosts.
Connection to server.name closed.
✖ Execution failed.
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.
Hi @isharfme . I'd first check the authentication logs on your server. If your server is running Ubuntu you can run
sudo less /var/log/auth.log
Let's see if there is a successful authentication event from the pipe. Other than that, the pipe checks the output of the ssh, which also shares the exist status of the last executed remote command, so I'd check that as well.
Thanks! The cause was -tt switch with ssh. According to manual multiple -t switches are allowed, but in my case it caused issue with pty allocation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.