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

Pipelines "scp-deploy" puts everything in "build" dir on the remote server

We're trying to deploy a simple PHP project with no build process, all we need to do in the pipeline is `scp` copy the files up to a remote server.

Here's our pipeline config:

image: php:5.6.30

pipelines:
branches:
master:
- step:
script:
- pipe: atlassian/scp-deploy:0.3.3
variables:
USER: '<username>'
SERVER: '<ip addr>'
REMOTE_PATH: '/var/www/api/v1/'
LOCAL_PATH: $BITBUCKET_CLONE_DIR

We want it to put the files from the repo into /var/www/api/v1 on the remote machine, but instead it creates a `build` dir that looks like it has 777 permissions, and puts them in there. (/var/www/api/v1/build/<files>)

Where does this build dir come from? Can we disable that? Or do we have the wrong `LOCAL_PATH` value?

 

1 answer

1 accepted

1 vote
Answer accepted

Hi Duncan,

Thank you for your question.

In your case use:


LOCAL_PATH: '${BITBUCKET_CLONE_DIR}/*'

To deploy only files from your directory to the remote you can provide '/local/path/build/*' with trailing asterisk symbol (*) as a LOCAL_PATH variable.

Thanks! That looks like it copies the correct files, but they all have 777 permissions on the remote machine. Is there something else I need to do to specify the target permissions?

Like # people like this

Pipe "SCP deploy" preserves modification times, access times, and modes from the original file. Try to check permissions on your local at first.

But additionally, you can add to your config "SSH run" pipe with a command that modifies targets permissions on the remote:

- pipe: atlassian/ssh-run:0.1.3
variables:
SSH_USER: $USER
SERVER: $SERVER
COMMAND: 'chmod 755 <your_target_file>'

More information about pipe "SSH run" you can find in the Bitbucket Pipelines SSH run repository.

Atlassian created pipes are kept in the Bitbucket Pipelines pipes project.

Like # people like this

It would be good to have this on the pipeline information screen (on the screen when adding a new pipeline)

Like mkarthauser likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,053 views 0 3
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