When running a job step on a Cloudbees CD agent running on a Mac (which is running Mac OS Catalina), the step is hanging with “waiting for resource” and the following message is shown:
Step error [AgentFailedCreateWorkspace]: unable to run the command on the agent The agent was unable to create the workspace directory: Error in mkdir(/net/rose/home/ec-wksp/w2017/csdk-2015/J-79608-catalina): Operation not permitted
This looks like an issue caused by not enough privilege in the workspace directory. However, the following test confirms that the user does have enough privilege:
br-mac-17:~ ecagent$ cd /net/rose/home/ec-wksp/w2017/csdk-2015/ br-mac-17:csdk-2015 ecagent$ touch abc br-mac-17:csdk-2015 ecagent$ ls -l abc -rw-r--r-- 1 ecagent engineering 0 Jul 16 14:31 abc br-mac-17:csdk-2015 ecagent$ br-mac-17:~ ecagent$ ls -l /net/rose/home/ec-wksp/w2017/csdk-2015 | grep J-79608-catalina br-mac-17:~ ecagent$ mkdir /net/rose/home/ec-wksp/w2017/csdk-2015/J-79608-catalina br-mac-17:~ ecagent$ ls -l /net/rose/home/ec-wksp/w2017/csdk-2015 | grep J-79608-catalina drwxr-xr-x 2 ecagent engineering 4096 Jul 17 14:56 J-79608-catalina br-mac-17:~ ecagent$ mkdir /net/rose/home/ec-wksp/w2017/csdk-2015/J-79692-catalina br-mac-17:~ ecagent$ ls -l /net/rose/home/ec-wksp/w2017/csdk-2015 | grep J-79692-catalina drwxr-xr-x 2 ecagent engineering 4096 Jul 17 14:57 J-79692-catalina
One possible cause of the issue is that the privilege is missing in this case with the following details:
- the directory is “/net/rose/home/ec-wksp/w2017” is mounted from another machine. This is a typical setup of workspace for Cloudbees CD agent running on a mac.
- the Cloudbees CD agent is started by the default way as mentioned in Starting and Stopping Servers and Agents Manually with the command
sudo launchctl load /Library/LaunchDaemons/ecmdrAgent.plist
The issue can be worked around by:
- stop the agent with
sudo launchctl unload /Library/LaunchDaemons/ecmdrAgent.plist
- start the agent in a terminal with
/opt/electriccloud/electriccommander/bin/ecmdrAgent.bin --config /opt/electriccloud/electriccommander/conf/agent.conf. The actual command can be found in the file “ecmdrAgent.plist”.
This starts the Cloudbees CD agent in interactive mode.