Skip to content

fabric8io/openshift-jenkins-s2i-config

 
 

Repository files navigation

openshift-jenkins-s2i-config

The Jenkins image for OISO Tenants and https://jenkins.cd.test.fabric8.io.

Update plugins

we broke the plugin update after changes due to openshiftio/openshift.io#2612 Hence introduce new way to update plugins.

  1. Once you modified plugin.txt or added any .jpi/hpi in plugins folder
  2. Please run the script update-version.sh, it will just update the version.txt to next increamental number.
  3. git add version.txt
  4. commit this change with the PR required for upating the plugin

Prerequisites

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

Run

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

# 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

How to update plugins

It is really hard to update plugins correctly, you can get backward compatibility problems really easy.

First run (probably it is already deployed in OpenShift) the Jenkins instance you want to update from. Go to Manage Jenkins, Manage Plugins and update the plugins you need for next version.

After Jenkins is updated and you restart it, go to Manage Jenkins, Script Console and run next script:

Jenkins.instance.pluginManager.plugins.each{
  plugin ->
    println ("${plugin.getShortName()}:${plugin.getVersion()}")
}

Then just inspect the result and update the plugins.txt file properly.

Add/Update plugins configuration

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

About

Config repo used to build a customised OpenShift Jenkins image using S2I

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 98.9%
  • Makefile 1.1%