Plain Old Builds with OneDev Shell Executor
While it is the trend to run CI/CD jobs inside container for isolation and reproducibility, some builds must run outside container, such as iOS builds. To support these “plain old” builds, OneDev 4.11 introduces two shell job executors:
- The server shell executor executes CI/CD jobs with server’s shell/batch facility. It can be used without installing agents, with the limitation that server environment and resource are used to execute jobs.
- The remote shell executor executes CI/CD jobs with agent’s shell/batch facility. While requiring you to install agents, it is much more flexible (agent can execute jobs either inside or outside container, depending on the executor using it)
As usual, we go through an example to get familiar with the shell executor. We will run OneDev server on a Ubuntu box, and run an agent on Mac to print Mac’s OS version. Let’s move on:
- Start OneDev server with below command on Ubuntu (this command is for demonstration purpose, follow installation guide for production use):
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd)/onedev:/opt/onedev -p 6610:6610 -p 6611:6611 1dev/server:4.11.0
2. Open browser to visit http://localhost:6610 to complete the setup. When specifying property Server URL, make sure it can be accessed from your Mac machine
3. Login to Mac machine, visit agent management page like below and download agent package
4. Make sure you have JDK/git installed as described in above screen (docker is required only if you want to run docker builds on Mac). Extract the agent package and run bin/agent.sh console to start the agent
5. If connected, the agent will be online in agent management page like below:
6. Now let’s create a job executor to use the agent. Switch to job executors page, create an executor of type Remote Shell Executor, give it a name and leave others as default. Test and save the executor:
7. Create a test project, define CI spec, add a job, add a step of type Execute Shell/Batch Commands, with commands specified as sw_vers. The image field can be specified with any value as it is ignored by shell executor. Run the job, and you will see that the job is printing OS version of your mac in build log
Thanks for reading!