Jenkins There is no such file or directory error. But the file exists

I had a problem running a bash script as a job in Jenkins (execute shell step). Basically, I narrowed down my script to be a single line to check why Jenkins is not running it. Here he is:

waxsim 

So this is just one line. This should give me this result when working without parameters:

 No app-path was specified! usage: waxsim [options] app-path example: waxsim -s 2.2 /path/to/app.app Available options are: -s sdk Version number of sdk to use (-s 3.1) -f family Device to use (-f ipad) -e VAR=value Environment variable to set (-e CFFIXED_HOME=/tmp/iphonehome) -a Available SDKs -v path Output video recording at path -h Prints out this wonderful documentation! 

Jenkins works as a jenkins user. When the task runs, it fails:

 + waxsim /var/folders/gx/t63prwt53w7gr2jjt9k66q9800009c/T/hudson4478539334800834890.sh: line 3: waxsim: No such file or directory Build step 'Execute shell' marked build as failure 

When I execute waxsim manually, logged in as a jenkins user, everything works fine. It works for every user on the machine. He works not only on Jenkins' quest. Does anyone know what the problem is?

I tried to specify the full path to waxsim , which is: /usr/bin/waxsim , but that does not make any difference.

Thanks!

+6
source share
3 answers

The reason this works when you were running in the Terminal, and this does not happen when Jenkins ran, turned out to be trivial.

In terminal, I run bash, and Jenkins uses a shell. Thus, adding the PATH export to the Jenkins script execution shell solved the problem.

+4
source

Just adding #!/bin/bash to the top of your shell should produce the desired result.

0
source

I suffered in the same situation. I tried adding #!/bin/bash to the start of the Jenkins shell, but again failed @ NightOwl888.

The shell configuration is as follows:

#! / bin / bash cd / root / build toolbar -t edgar / dashboard.

accomplished result:

, /var/tempshell_1547306787716-1061830206.sh

-bash: cd: / root / dashboard: there is no file or directory that cannot prepare the context: cannot evaluate symbolic links in the Dockerfile path: lstat / root / Dockerfile: there is no such file or directory

I have no idea about it

0
source

Source: https://habr.com/ru/post/947452/


All Articles