-
Notifications
You must be signed in to change notification settings - Fork 368
Custom Jenkins slave agents
A slave is a Docker container running and connected to Jenkins via the Jenkins Slave plugin.
A generic slave agent is available for running Jenkins jobs. The slave agent is based off vfarcic/jenkins-swarm-agent
(Ref:https://github.com/vfarcic/docker-jenkins-slave-dind). Any job which needs to run on this slave needs to restrict the job to run on label: general-{env}
.
Any job which has simple job dependencies can have a pre-build stage, where the software(s) can be installed. Note that the image is build on Alpine, so you will need to use apk
and not apt
or yum
for software installations.
You may refer to https://github.com/project-sunbird/sunbird-devops/tree/master/pipelines for various pipeline definitions.
Sometimes, the dependencies may not be generic and cumbersome to install for every execution of the job. In such scenarios, you may build a custom slave agent by writing a slave Dockerfile
. Examples of custom slave agents are:
- https://github.com/project-sunbird/sunbird-devops/blob/master/images/api-manager-jenkins-swarm-agent/Dockerfile
- https://github.com/project-sunbird/sunbird-devops/blob/master/images/reporter-jenkins-swarm-agent/Dockerfile You will need to define a custom label, so that your job can execute on a custom slave agent. The label should match the label allocated to the slave agent.
You may need to just define your slave Dockerfile and hand it over to the DevOps team. Soon, this process of registry will be automated.