From day 1, OneDev is able to run CI/CD jobs as pods on Kubernetes clusters. In case you do not have a Kubernetes cluster, it is now possible to install OneDev agents on other machines to get a CI/CD farm. Agent is designed to be maintenance free: the server will push updates to agents automatically when it is upgraded.
How to Set Up
Let’s go through an example to see how to set up the CI/CD farm:
- Start OneDev server with below command on Linux or Mac (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.10.3
2. Open browser to visit http://localhost:6610 to complete the setup
3. Visit agent management page like below and download agent package (this will be a bit slow for docker running on Mac)
4. For demonstration purpose we just run the agent from the same machine as OneDev server. Make sure you have JDK/docker/git installed as described in above screen. Extract the agent package and run bin/agent.sh console to start the agent. In case server url is not specified correctly at download time, it can be modified later in conf/agent.properties (followed by agent restart)
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, delete the default auto-discover executor, and create an executor of type Remote Docker Executor, give it a name and leave others as default. Test and save the setting:
7. Create a test project, define CI spec with a simple job, and run the job. You will see that the job is running on the agent:
When OneDev dispatches jobs to agents, it choses the best one based on agent cpu/memory capacity and job cpu/memory requirement. If no agents satisfies the requirement, the job will be in waiting state.
Thanks for reading!