It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Can't Access SSH Key from Custom Pipe

James Stewart Mar 13, 2019

I'm working on a custom pipe (following simple-bash example). When I run the pipe I can see the docker command is mounting "/opt/atlassian/pipelines/agent/ssh", but not "/data". The id_rsa file inside the /ssh directory is symlinked to ../data/id_rsa; which isn't availble in the pipe. I can get around this by copying it somewhere else in the script before calling pipe, or creating a new variable through UI; but doesn't seem like either should be necessary. Am I missing something?

 

Pipe docker run command:

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 \
--workdir=$(pwd) \
--label=org.bitbucket.pipelines.system=true \
--env=CI="$CI" \
...

ls -al /opt/atlassian/pipelines/agent/ssh

drwxrwxrwt. 3 nobody nogroup 140 Mar 13 14:17 .
drwxr-xr-x. 4 root root 4096 Mar 13 14:18 ..
drwxr-xr-x. 2 nobody nogroup 100 Mar 13 14:17 ..2019_03_13_14_17_38.171792551
lrwxrwxrwx. 1 nobody nogroup 31 Mar 13 14:17 ..data -> ..2019_03_13_14_17_38.171792551
lrwxrwxrwx. 1 nobody nogroup 13 Mar 13 14:17 id_rsa -> ..data/id_rsa
lrwxrwxrwx. 1 nobody nogroup 17 Mar 13 14:17 id_rsa_tmp -> ..data/id_rsa_tmp
lrwxrwxrwx. 1 nobody nogroup 18 Mar 13 14:17 known_hosts -> ..data/known_hosts

 

1 answer

1 accepted

0 votes
Answer accepted
James Stewart Mar 13, 2019

I realized my conclusion was wrong in the original post. The ..data folder is there. If I do an "ls -al /opt/atlassian/pipelines/agent/ssh/..data/" I get:

total 12
drwxr-xr-x 2 nobody nobody 100 Mar 13 15:39 .
drwxrwxrwt 3 nobody nobody 140 Mar 13 15:39 ..
-r-------- 1 nobody nobody 2459 Mar 13 15:39 id_rsa
-rw-r--r-- 1 nobody nobody 2459 Mar 13 15:39 id_rsa_tmp
-rw-r--r-- 1 nobody nobody 816 Mar 13 15:39 known_hosts

So, I realized that while id_rsa is not readable, id_rsa_tmp is! I tried it and it worked for what I needed. Hopefully this helps someone else out.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

3,224 views 1 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you