Jump to content

Jenkins, problems with cm on Mac

Recommended Posts

I'm trying to setup iOS build on MacOS and checkout are failing with following error

[TestScripts] $ cm lwk --format={wkname}#{path}#{wkid}
FATAL: Cannot run program "cm" (in directory "/Volumes/LittleBigBOSS/JA1/workspace/TestJobs/TestScripts"): error=2, No such file or directory


Pipeline script is very simple and it works if i launch it on Windows Node

    cm branch: context.BranchName, repository: context.SCMRepository, server: context.SCMServer


I checked all steps manually and they works.

  1. cd to the path "/Volumes/LittleBigBOSS/JA1/workspace/TestJobs/TestScripts"
  2. launched command "cm lwk --format={wkname}#{path}#{wkid}"

Here are shell log for this:

Last login: Fri May 15 23:28:59 on ttys000
bizon:~ admin$ cd /Volumes/LittleBigBOSS/JA1/workspace/TestJobs/TestScripts
bizon:TestScripts admin$ cm lwk --format={wkname}#{path}#{wkid}
bizon:TestScripts admin$ 


Noticed, that i previously opened shell from admin user. Repeated test, using Jenkins user with same results

Link to post
Share on other sites

Maybe i did something wrong on the mac?

I just did another test.

Shell script executed from Jenkins pipeline "cm worspace create ..." returned "cm: command not found"

[Pipeline] sh
+ cm workspace create hc-smf-living-pictures-client /Volumes/LittleBigBOSS/JA1/workspace/hc-smf/hc-smf-living-pictures-client/hc-smf-living-pictures-client --repository=hc-smf/hc-smf-living-pictures-client@__@cloud
/Volumes/LittleBigBOSS/JA1/workspace/hc-smf/hc-smf-living-pictures-client@tmp/durable-62867457/script.sh: line 1: cm: command not found

I copyed the same command in bash and executed it manually and worspace was succesfully created

bizon:TestScripts jenkins$ cm workspace create hc-smf-living-pictures-client /Volumes/LittleBigBOSS/JA1/workspace/hc-smf/hc-smf-living-pictures-client/hc-smf-living-pictures-client --repository=hc-smf/hc-smf-living-pictures-client@__@cloud
Workspace hc-smf-living-pictures-client has been correctly created

What am i missing?

Link to post
Share on other sites


Could you manually copy the "/Users/xxx/plastic4/client.conf" to the client binaries folder?


The Jenkins server may be be run with a different user than yours. By Copying the configuration file in the client binaries folder, all the machine users will use the same Plastic clienbt configuration.

- Also review that "cm" is in the system PATH variable. You can also include the full path in the Jenkins configuration:




Link to post
Share on other sites

Jenkins server is running on Windows and i'm trying to setup agent on MacOS. So i can't use absolute path to cm - that will brake all windows builds.

What i tryed

- Reinstall Plastic under Jenkins user (Should'n this add cm to Path?)

- Add Plastic to /etc/paths 


And it didn't work

bizon:TestScripts jenkins$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin
bizon:TestScripts jenkins$ sudo open /etc/paths

- I tryed to execute cm in Bash (under Jenkins user) and it works. It seems, that cm is added to Path, but it only visible from Bash. And not visible from scripts.

Link to post
Share on other sites

I added all paths to the Agent Path variable and cm began to work trough the shell. It worth mentioning, that you can't add just Plastic path, as it will replace all other paths and event "sh" wouldn't be found.

But cm command from Jenkins Plugin are still failing with the same error.

Link to post
Share on other sites


I'm reviewing a previous ticket where we spent some tiem debugging the same error when using a Jenkins macOS ssh slave:



We've been debugging the issue. It seems to be a reported Jenkins bug affecting us:


When configuring an ssh slave, the environment variables are not loaded. That's the reason why the Plastic "cm" is not being found (even if it's included in the PATH variable for the jenkins user in the MacOS machine).


I've tested with the Java Web Start and I'm not able to reproduce the issue:

On the macOS:
- Running:
sudo java -jar agent.jar -jnlpUrl http://MySERVER84/computer/macOsJava/slave-agent.jnlp -secret f5dcf86e0ceed3f22c08bc27fa07d680aff3e11c25452677af4fee218bcfb1aa -workDir "/tmp"

- I'm not using ssh for login.

I can successfully run a build with this configuration. 



Using the following workaroud the user was able to configure the PATH variable to include "mono" and the "cm" when connecting via SSH:




Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...