You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hello Guys
Below is my pipe code and want to use multiple command so how can i do that.
Thank you.
pipe: atlassian/ssh-run:0.1.3
variables:
SSH_USER: $USER
SERVER: $SERVER
#SSH_KEY: $MYKEY
PORT: 22
COMMAND: 'sudo chmod -R 755 filename/*'
The command variable only accepts a single command. If the shell on the remote server happens to be Bourne shell-like (such as bash), you can use a YAML multiline block with command chaining to get this effect.
- pipe: atlassian/ssh-run:0.1.3
variables:
# ... other vars ...
COMMAND: >
sudo chmod -R 755 filename/* &&
sudo other command/*
This style will not run the second command if the first one fails. If you want the second command run no matter what, you can use `;` instead of `&&` as a separator.
As the docs suggest, it's probably better to use a script file, as you can control the shell being used and can more easily write tests around the command.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hardik,
I haven't used this pipe myself, but from reading the docs I think what you want is the "script" mode, as per this example (taken straight from the docs):
script: - pipe: atlassian/ssh-run:0.2.0 variables: SSH_USER: 'ec2-user' SERVER: '127.0.0.1' SSH_KEY: $MY_SSH_KEY MODE: 'script' COMMAND: 'myscript.sh' # path to a script in your repository
If you don't want to add the script to your repository, then you could always create it in your build script just before launching the pipe, eg:
script:
- 'echo ''command 1'' > myscript.sh'
- 'echo ''command 2'' >> myscript.sh'
- 'echo ''command 3'' >> myscript.sh'
- pipe: atlassian/ssh-run:0.2.0
... etc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Steven,
Thankx for your response. But I am looking like something as below
pipe: atlassian/ssh-run:0.1.3
variables:
SSH_USER: $USER
SERVER: $SERVER
#SSH_KEY: $MYKEY
PORT: 22
COMMAND: 'sudo chmod -R 755 filename/*'
COMMAND: 'sudo other command/*'
Is this possible?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this:
script:
- 'echo ''sudo chmod -R 755 filename/*'' > my-ssh-script.sh'
- 'echo ''sudo other command/*'' >> my-ssh-script.sh'
- pipe: atlassian/ssh-run:0.2.0
variables:
SSH_USER: $USER
SERVER: $SERVER
PORT: 22
MODE: 'script'
COMMAND: 'my-ssh-script.sh'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi everyone, We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.