Shell script not running in Jenkins pipeline

Hi All,

I am trying to run a shell script via Jenkins. Its a simple shell script that will run a command called autopkg run -v Firefox.munki

When I run this in the prompt from CLI it works fine. When I add the same script to Jenkins I get an error

Script Location : /Users/mstark/Desktop/scripts/t2.sh

Error:
Started by user Michael Stark
Running as SYSTEM
Building in workspace /Users/mstark/.jenkins/workspace/autopkg
[autopkg] $ /bin/sh -xe /var/folders/ln/814pyyl53jgb9lszytdwxl3w0000gn/T/jenkins11923866224901317891.sh

  • /Users/mstark/Desktop/tscript/ts2.sh
    /var/folders/ln/814pyyl53jgb9lszytdwxl3w0000gn/T/jenkins11923866224901317891.sh: line 2: /Users/mstark/Desktop/tscript/ts2.sh: No such file or directory
    Build step ‘Execute shell’ marked build as failure
    Finished: FAILURE

Strange but the shell script works fine via CLI.

Should that be script or tscript?

1 Like

tscript is only the folders name.
I managed to figure it out
I had to add the path where the command is located.

/usr/local/bin/autopkg run -v coconutBattery.munki -k MUNKI_REPO_PLUGIN=“SimpleMDMRepo” -k MUNKI_REPO=“” -k extract_icon=True

This worked.
So if I add this to the .sh file then it should work.

my bad its only

1 Like

Thanks for your feedback @jalsaman .