Jenkins node cannot run fastlane command - command not found

54 Views Asked by At

We have a configured jenkins node (macOS) with SSH connection with user X. When trying to execute fastlane from the jenkins job (inside a shell executable build action) job output shows the below error.

/var/folders/jg/mjb6fch147sdj76ynnrgnjrr0000gr/T/jenkins5916553296139089998.sh: line 3: fastlane: command not found

However when connecting to node (macOS) directly we can run the fastlane command.

The user is the same for the both cases.

Any help would be appreciated thank you.

1

There are 1 best solutions below

5
JRichardsz On BEST ANSWER

I had similar error in ubuntu. Follow these checklist:

Login user

  • Get the active user during the execution with whoami or id -un in your jenkins script before the fastlane command
  • Then go to your macos and open a shell, login with the active user and execute fastlane
  • If you get the error: command not found, just install it in that shell instance for that user
  • If using the active user, fastlane command exist, we are in problems. Share the results to help you

PATH

Print the PATH variable inside of the jenkins script and then using the same user of previous paragraph, print the PATH in your mac. Compare them and share the results.

Just to try if they are different, you can override the PATH in the jenkins script with the value obtained in your mac. Something like this

echo "user:"
id -un
export PATH=/usr/local/bin:/Library/Frameworks/etc...

fastlane action get_version_number