Reputation: 57
I have four different but very similar jobs in the same Jenkins instance and ran with the same user, that have the same shell step definition. The shell step definition is like this:
#!/bin/sh
echo $WORKSPACE
cd $JENKINS_HOME/users/foo
sh script.sh
When I execute the job, it throws the next error:
cd: /var/lib/jenkins/users/foo: No such file or directory
sh: script.sh: No such file or directory
In the other jobs that I have the same command sequence in the shell step, it works well and the script.sh is executed.
I have seen several posts and I have tried to change to bin/bash
, execute the script directly with source
or ./
, but none of the solutions worked.
Upvotes: 1
Views: 15891
Reputation: 57
I have already found the solution. The problem was that the failed job was being executed in the slave node, and in the slave node, making a ls in the $JENKINS_HOME folder, there was no /users/foo folder at all.
So, I have marked that my failed job ran in the principal node instead of the slave node. I have executed the job again and now it works well.
The problem, in fact, was that the principal and slave nodes in Jenkins server weren't synchronized correctly.
Upvotes: 1