gocd - making custom command script available to agent

2.1k views Asked by At

I am trying to add a custom command which in turn calls a python script, as per example here https://support.thoughtworks.com/hc/en-us/articles/213253646-Go-s-custom-command,

<exec command="myecho.sh">
</exec>

In my case,

<exec command="/usr/bin/python cd_dashboard.py">
  <arg>-v</arg>
</exec>

But when I execute the pipeline it fails with following error,

[go] Task: "/usr/bin/python cd_dashboard.py" -vtook: 0.2s Error happened while attempting to execute '/usr/bin/python cd_dashboard.py -v'. Please make sure [/usr/bin/python cd_dashboard.py] can be executed on this agent.

So the question is where should the python script reside to be accessible to agent? Should be in agent's PATH.

Is this correct understanding?

1

There are 1 answers

3
grundic On BEST ANSWER

The command should be /usr/bin/python, please move cd_dashboard.py to the args. Right now GoCD trying to run executable /usr/bin/python cd_dashboard.py, which of course doesn't exist. You should have something like this:

<exec command="/usr/bin/python">
  <arg>-v</arg>
  <arg>cd_dashboard.py</arg>
</exec>