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

SCP Task Not Performing

Matt Wopata October 3, 2013

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

0 votes
Matt Wopata October 15, 2013

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

0 votes
Matt Wopata October 10, 2013

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

0 votes
Matt Wopata October 3, 2013

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?

0 votes
roy_lyons
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 3, 2013

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

roy_lyons
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 5, 2013

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events