Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can't Access SSH Key from Custom Pipe

James Stewart March 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 March 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
TAGS
AUG Leaders

Atlassian Community Events