Missed Team ’24? Catch up on announcements here.

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

Bitbucket pipeline scp ignores user in deployment variable or statically entered. Always uses root

Alex De Smet
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 9, 2019

Hi,

I have a build pipeline which copies a tar.gz file at the end by using scp. I have added the SSH key of the user "deploy" to the settings, and the fingerprint of the server was added to the known_hosts.

I then created a deployment with a variable DEPLOY_USER with a value "deploy". This variable is populated correctly. The thing is, this setup works for a couple of times. After a while, I can't seem to pinpoint exactly when, the scp step fails. When this happens, I see the user root being used (which has no ssh access).

This happened on two of my pipelines in seperate projects, with seperate users.

I have added a screenshot to clarify the problem.

Update: I have tried:

  • removing and adding the known_hosts entry
  • removing and adding the ssh keys
  • replacing the variable with the user hard-coded deploy@...

Didn't help.

Any ideas?

Alex

problem_scp.png

1 answer

1 accepted

0 votes
Answer accepted
Alex De Smet
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 10, 2019

I've found a workaround.

Recreating the deployment variable isn't enough. I had to completely remove the Deployment (Settings > Deployments), recreate it and add the variables again.

I think the cause may have been a change in the IP-address of the server (scp destination). In both the projects where I had this problem, I changed the known_hosts and one of the deployment variables (DEPLOY_HOST). But I can't reproduce at the time

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events