Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Muliptle pipes in one step?



Is there a possibility to have mutliple pipes,each as its own script but only in one step?

Cause i want to deploy my new docker image, i have a script. My steps are use SCP pipe to copy the script, use SSH pipe to run the script with some variables.

When i tried that in a format:


   - script:


   - script:


It only executes the last script, and skips the first one.


Is there some better way to do this, or i have to create two steps each with one script/pipe?

And is there a way from me to access the ssh private key i added? If i would not to use pipe, how would I ssh to my server, what would be the path to the private key? Woud it be ssh -i ~/.ssh/config?


1 answer

1 accepted

2 votes
Answer accepted
Tom Bradshaw Atlassian Team Jun 17, 2019

Hi @Uros Cvijan ,

You don't need separate script commands for each pipe. Instead use

- step:
- script:
- pipe1:
- pipe2:

In terms of using ssh outside of a pipe the easiest way is to consult our documentation here

The location of your private key is in /opt/atlassian/pipelines/agent/ssh/

If you have any question let me know.


So that is the way, just multiple pipes in one script, nice. Will try it out. Thank you. If i have to create another question and mark your answer above as correct i can do it, not a problem. 

I have one more question, not sure if i should open new question. But lets try it here: 

If i want to use SSH pipe for example with command: script, and if i have some variables inside of that script (variables that i have setup in pipeline settings), username/password login for my docker private registry. Is there a way for bitbucket pipeline to use the variables from its setup or i have to do something like:


And to create script with anchors $1, @$2 . I would very much would like to use $USERNAME and $PASSWORD inside of the script and just use variables from bitbucket. Or what would be the preferred way of having variables in deploy script and to use them from bitbucket if that is even possible? 


Thank you, 


Well that didn't work for me, I get an editor warning (with no commit option) that gets me an "expected a string or a pipe".


- step: 
name: Deploy-push via sftp
deployment: QA
trigger: manual
- pipe1: atlassian/sftp-deploy:0.3.1
DEBUG: 'true'

- pipe2: atlassian/ssh-run:0.2.2
COMMAND: 'some_linux_cmd'

You don't have to name them pipe1, pipe2, i think that was just an example from Thomas. It works for me. I have practically the same code as you, just put pipe without the numbers and it should work. 

Awesome, thanks!

After adding a second pipe I'm getting an error when trying to run the pipeline: "The step provided was invalid".


- step: &step-deploy-prod 
name: Deploy to Prod Server
deployment: Production
- pipe: atlassian/sftp-deploy:0.5.3
variables: USER: $SSH_USER
REMOTE_PATH: "apps/parse/htdocs/cloud_code/build/cloud"
LOCAL_PATH: "build/cloud"
- pipe: atlassian/ssh-run:0.2.3
COMMAND: "sudo /opt/bitnami/ restart parse"
Like Matt Mills likes this

I have a different issue. I can run, but the pipelne ignores second pipe. 

For me, it's an anchor issue. it's working.

I'm having the same issue raschidjfr.  "The step provided was invalid". 

Suggest an answer

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

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

3,499 views 3 10
Read article

Atlassian Community Events