Skip to content

Latest commit

 

History

History
68 lines (45 loc) · 3.84 KB

README.md

File metadata and controls

68 lines (45 loc) · 3.84 KB

openshift-jenkins-s2i-config

Run the following steps to build and deploy this customised OpenShift Jenkins Pipeline image..

Prerequisites

  • Get the latest s2i
  • Run the following in the default namespace as explained in the todo below

Run

# 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'
}

List of plugin installed

Required:

  1. Pipeline plugin ability to run Jenkinsfile

  2. Pipeine stage view plugin useful visualisations

  3. Kubernetes plugin dynamically create Jenkins Agents on demand

  4. 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.

Optional but recommend:

  1. Pipeline Utility Steps Plugin useful library for working with Jenkinsfiles

  2. Mercurial to support mercurial but we've not tested this

Optional but not recommended

  1. 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.

  2. Simple build pipeline it didn't work for me but it looks promising in the future

Note

You'll need to expose the Jenkins JNLP port and create a separate agent service like this example

TODO

  1. 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.
  2. Add the SNAPSHOT openshift-jenkins-sync-plugin to this project