A syntax error started appearing out of the blue during a regularly scheduled run:
Started by user xyz
[EnvInject] - Loading node environment variables.
Building in workspace /location/of/workspace
No emails were triggered.
[workspace] $ /bin/sh -xe /tmp/hudson43340.sh
+ /location/of/script
if: Expression Syntax.
Build step 'Execute shell' marked build as failure
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: FAILURE
This is a very simple project where a script is executed in a shell without any additional code or options. There isn't an if-statement anywhere in the script. The script is written for C shell, and in my test, this would produce the error:
#!/bin/csh
echo "Test"
However, if I swap to the Bourne shell, the script works fine:
#!/bin/sh
echo "Test"
Started by user xyz
[EnvInject] - Loading node environment variables.
Building in workspace /location/of/workspace
[workspace] $ /bin/sh -xe /tmp/hudson43526.sh
+ /location/of/script
Test
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: SUCCESS
I updated to the latest version of Jenkins, but the issue persists. If I could view the temp. file in which the build step is written into (i.e. hudsonXXXXX.sh), I think I would be able to see the problem, but I am not sure how I can copy the temp. script before it is removed.
This issue resolved itself without any changes made...but I would like to find out how to read the temp. file in case this happens again.