Run the following steps to build and deploy this customised OpenShift Jenkins Pipeline image..
- Get the latest s2i
- Run the following in the default namespace as explained in the todo below
# modify the existing OpenShift Jenkins image adding Pipeline plugins and configuration
s2i build https://github.com/fabric8io/openshift-jenkins-s2i-config.git openshift/jenkins-1-centos7 fabric8/jenkins-openshift-pipeline:latest
oc new-app -f https://raw.githubusercontent.com/rawlingsj/openshift-jenkins-s2i-config/master/jenkins-template.yml -p JENKINS_PASSWORD=admin
# expose the Jenkins service as you would normally e.g.
oc expose service jenkins --hostname=jenkins.vagrant.f8
Access Jenkins via your OpenShift route, admin/admin
to log in.
You will have an example pipeline job already created that you can run. Also the configuration for kubernetes-plugin will have been setup automatically. You can see in the Job configuration which it references a Jenkinsfile in another repo, this is the recommended approach where a Jenkinsfile lives with the source code. The Jenkinsfile uses the agent
node label which requests a new Kubernetes Pod to be scheduled to run our basic stages.
Example basic Jenkinsfile..
node('agent'){
stage 'first'
echo 'worked'
stage 'second'
echo 'again'
}
-
Pipeline plugin ability to run Jenkinsfile
-
Pipeine stage view plugin useful visualisations
-
Kubernetes plugin dynamically create Jenkins Agents on demand
-
Remote loader allows loading Pipeline scripts from remote locations. Note until global library is versioned this is what we're suggesting users use to ensure reusable functions are versioned.
-
Pipeline Utility Steps Plugin useful library for working with Jenkinsfiles
-
Mercurial to support mercurial but we've not tested this
-
Github branch source plugin still not too sure about this one, it sounds good but its usability is a little raw. For example, it will automatically trigger any new job that gets created after a repo scan which is a little scary.
-
Simple build pipeline it didn't work for me but it looks promising in the future
You'll need to expose the Jenkins JNLP port and create a separate agent service like this example
- This example is currently hard coded to run in the default namespace at the moment. I had a go at using a
KUBERNETES_NAMESPACE
env var as per the fabric8 version which is set and available in the container but I ran into an issue starting the agent pod, so it needs to be looked at again. - Add the SNAPSHOT openshift-jenkins-sync-plugin to this project