Skip to content
This repository has been archived by the owner on Nov 12, 2023. It is now read-only.

k8s-jenkins-slave-base

License

Notifications You must be signed in to change notification settings

cloutainer/k8s-jenkins-slave-base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 

Repository files navigation

‼️ DEPRECATED AND ARCHIVED

k8s-jenkins-slave-base

Base image for all k8s images.


 

Usage

Use in Dockerfile:

FROM cloutainer/k8s-jenkins-slave-base:v21

COPY docker-entrypoint-hook.sh /opt/docker-entrypoint-hook.sh

# ...

USER jenkins

Always provide a file called docker-entrypoint-hook.sh and copy it to /opt/. It will be sourced by the entrypoint before the JNLP remoting jar establishes the connection to Jenkins.


 

Jenkins Slave Documentation

A Jenkins Slave Dockerized Container is started by Kubernetes with the following parameters:

  • Docker CMD parameters (args):
    • secret and nodeName
      • We will use JENKINS_NAME Env var instead of nodeName
      • We will use JENKINS_SECRET Env var instead of secret
  • Docker ENV Vars:
JENKINS_LOCATION_URL: https://jenkins.foo.com/
JENKINS_SECRET:       050...42d
JENKINS_JNLP_URL:     http://jenkins.foo.com:8080/computer/k8s-jenkins-slave-
                      nodejs-xvfb-chrome-21ce6ca6fe87e/slave-agent.jnlp
JENKINS_NAME:         k8s-jenkins-slave-nodejs-xvfb-chrome-21ce6ca6fe87e
JENKINS_URL:          http://jenkins.foo.com:8080
HOME:                 /work

The secret and nodeName is the passed to the JNLP remoting JAR slave.jar to connect to the Jenkins Host via JNLP protocol. The outline of the process is as follows:

  • container creation with secret and nodeName
  • inside docker-entrypoint:
    • Download of ${JENKINS_URL}/jnlpJars/slave.jar.
    • Executing java -jar slave.jar -url ${JENKINS_URL} ${secret} ${nodeName}.

 

License

MIT © Bernhard Grünewaldt