JIRA Cloud: Execute script on remote server

Dave Miller January 28, 2020

Hello,

We are looking at adding a post function to a workflow transition that will execute a script (shell or ?) on a remote server when the transition is changed to "Approved".  Something like:

ssh userdude@192.168.10.10 ./myscript.sh

Looking at "Power Scripts for JIRA", but I couldn't find any doc on how to do something like this.  Has anyone else been able to do this and if so, what tool/plug-in did you use, etc. to make it work? 

1 answer

0 votes
Cprime Apps February 17, 2020

Hi Dave, there are quite a few ways to do something like this with Power Scripts.

Triggering the script on the remote system:

  1. Set up a Remote System link. Once that is established you can simply use the call() routine to execute the script on the other system. The first parameter of the call() routine is which system the script should run on.
  2. Or, use the Common REST Service to trigger a script on the remote system. The httpPost() routine can be used to send a POST request to the remote system in order to trigger the script.
  3. Or, use a custom SIL Webhook  to create a custom REST enpoint. You would still use the httpPost() routine to send the request to the custom endpoint.

Which option you choose depends on the amount of data you need to send to remote system. The custom webhook will allow you to send JSON data that offers the most versatility when it comes to passing data to the remote system. However, if you don't have much data to pass then the call() routine would be the simplest to implement.

Once the script is triggered on the remote system then the system() routine is used to run the shell script. The nice part about this routine is that you can also receive a response from the shell script. With all 3 examples above a response can be received to indicate success or failure from the script on the remote system.

Hope this helps.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events