How do I enable, somehow, my Jenkins instance (installed via homebrew) to use the packages that I've installed via homebrew. For example I can't call git from a SH job in Jenkins because I'v installed Git ia homebrew and due that this package (Git) is not available to the Jenkins user.
Below I'm trying to call brew
for test and I'm getting a error:
Started by user anonymous
Building in workspace /var/root/.jenkins/workspace/sandbox
[sandbox] $ /bin/sh -xe /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/jenkins2268498674034232648.sh
+ brew
/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/jenkins2268498674034232648.sh: line 2: brew: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Should I had install homebrew for all users?
Just add /usr/local/bin
to the environment variable PATH
.
There is many ways to accomplish this. You can configure it in the global properties (Manage Jenkins -> Configure System -> Global Properties) or use plugin such as EnvInject or even simply set it in the beginning of the script block, e.g.
PATH=$PATH:/usr/local/bin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With