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 deploy.sh 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:
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?
Hi @Uros Cvijan ,
You don't need separate script commands for each pipe. Instead use
In terms of using ssh outside of a pipe the easiest way is to consult our documentation here https://confluence.atlassian.com/bitbucket/use-ssh-keys-in-bitbucket-pipelines-847452940.html.
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:
./deploy $USERNAME $PASSWORD
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?
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".
name: Deploy-push via sftp
- pipe1: atlassian/sftp-deploy:0.3.1
- pipe2: atlassian/ssh-run:0.2.2
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
- pipe: atlassian/sftp-deploy:0.5.3
variables: USER: $SSH_USER
- pipe: atlassian/ssh-run:0.2.3
COMMAND: "sudo /opt/bitnami/ctlscript.sh restart parse"
Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...
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