SCP Task Not Performing

Hello,

I am trying to do a simple deploy after I have completed a build. I am using an SCP Task to see if I can transfer a file to my remote server. The deploy says it completes successfully, but when I look at the log it says it can't find the file I want to transfer. I created a txt file in the local folder. I am guessing that my file path, relative to working directory is not correct, but cant seem to find what exactly my working directory is. Can someone please give me an example or point me in the correct direction? Thank you.

4 answers

I can answer the "I can't figure out what my working directory is" component of your question...

add an entry to the environment variables section of the task. add something like:

TELLMENOW=${bamboo.build.working.directory}

and you will see in the log where it substitutes the value so that it can be assigned to TELLMENOW

Matt Wopata · 1 karma ·yesterday

Thank you. So now that I have my working directory(/home/bamboo/bamboo-agent-home/xml-data/build-dir/, I seem to be unable to access it. When I try to get to it in putty, i get an access denied. Any way around that?

So, what ID is currently running the bamboo agent? It appears to be 'bamboo' based on this description.


I get this feeling that the problem lies in the permissions of that user. It should be /home/bamboo/bamboo-agent-home/xml-data/build-dir/PROJKEY-PLANKEY-JOBKEY

The fact that it isn't that location makes me scratch my chin. That, and knowing you are getting an access denied in going to that location from an ssh session. It is possible that the execute bit has been turned off on the directory. That prevents search.

So yeah, I am curious, perhaps you can run a script task before the scp task, which does some diagnostics.....

{noformat}
id -a
pwd
hostname
ls -ld .
{/noformat}

you don't have to share the results of hostname (for security reasons) or the id (if it doesnt match, and for the same reasons)... If it doesnt match, check to see if an admin (if it isnt you) can give permissions to that ID through its primary group specified through the 'id -a' command.

if 'ls -ld .' shows an issue in the execute bit or the write bit with respect to the user, get a chmod done to fix it. If the user running the agent happens to be 'bamboo' you can write a shell script task to do that with 'chmod u+rwx .'

And if there turns out to be no permissions issues... well... I would be very curious as to what else it could be, and why your working directory doesn't include the subdirectory for the job.

Thank you. So now that I have my working directory(/home/bamboo/bamboo-agent-home/xml-data/build-dir/, I seem to be unable to access it. When I try to get to it in putty, i get an access denied. Any way around that?

After further review, the issue had to do with the instance that we were trying to connect to not having Bamboo installed.

Before we started using Bamboo, we had already created and built an EC2 instance that contained our custom PHP server configuration. Since it wasn't one of Bamboo's default AMI's, it was difficult to connect it to the build server.

Moving foward we are either going to either

A. Create our own custom AMI that Bamboo can point to when it is creating its instances

or

B. Customize the default Bamboo AMI to have all the server-side features we need.

Here is some good documentation about custom AMI's: https://confluence.atlassian.com/display/BAMBOO/Creating+a+custom+elastic+image

-Matt

UPDATE:

The reason I was unable to access the directory via SSH was because I was using "ec2-user@instance_id" instead of "root@instance_id". If you want to be able to acceess every folder, make sure you are connecting to your EC2 instance as the root user via SSH.

-Matt

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,319 views 0 5
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you