I am using the Jenkins Swarm Plug-in v.3.24 to run my 2020 M1 mac mini with macOS Ventura 13.3.1 as a Jenkins agent. The goal is to use Jenkins to schedule and execute iOS build scripts on that mac. The scripts work locally and upload to the app center, but when Jenkins executes the builds with the below pipeline script, I get an unable to build chain to self-signed root for signer error.
node('macos') {
stage('run deploy.sh Debug') {
sh '''
sudo -i -u myuser zsh << EOF
cd /Users/myuser/server/services/iosrepo/
./deploy.sh Debug
'''
}
}
Here's my plist file. The connection handshake only goes through if UserName is root or empty.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.jenkins.ci</string>
<key>SessionCreate</key>
<true/>
<key>EnvironmentVariables</key>
<key>JENKINS_HOME</key>
<string>/Users/myuser</string>
<key>ProgramArguments</key>
<array>
<string>java</string>
<string>-jar</string>
<string>/Users/myuser/iosbuildagent/swarm-client-3.24.jar</string>
<string>-master</string>
<string>http://jenkins-myaddress.com</string>
<string>-tunnel</string>
<string>123.123.123.123:50000</string>
<string>-username</string>
<string>myuser</string>
<string>-password</string>
<string>mypassword</string>
<string>-executors</string>
<string>1</string>
<string>-mode</string>
<string>exclusive</string>
<string>-workDir</string>
<string>/Users/myuser/</string>
<string>-fsroot</string>
<string>Users/myuser/</string>
</array>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/Users/myuser/iosbuildagent/stdout.log</string>
<key>StandardErrorPath</key>
<string>/Users/myuser/iosbuildagent/error.log</string>
</dict>
</plist>
This issue is very similar to Missing certificates and keys in the keychain while using Jenkins/Hudson as Continuous Integration for iOS and Mac development.
But when I implement the solution of adding <key>UserName</key> <string>myuser</string>
to my LaunchDaemon/com.jenkins.ci.plist file, the mac is unable to connect to Jenkins with the following error:
WARNING: Failed to initial retrieval
java.nio.file.FileSystemException: /Users/myuser/remoting.jarCache/OE/1234981273409182734.jar: Operation not permitted.