Skip to content

Customize the Jenkins S2I image to include plugins, k8s pod templates, etc.

License

Notifications You must be signed in to change notification settings

Cingulara/custom-jenkins-openshift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

custom-jenkins-openshift

Customize the Jenkins S2I image to include plugins, k8s pod templates, etc. This works for OpenShift as well as Minishift. To use this custom setup,

  • Import the imagestreamCustomJenkins.yaml definition into your OpenShift cluster
  • Import the buildConfig.yaml into your OpenShift cluster
  • Go to the openshift project/namespace and then go to Builds --> Builds and see the BuildConfig just loaded
  • Click on the build name to go into the build defintion
  • Click Start Build
  • When Complete go to your project namespace you wish to use
  • Click on the jenkins deployment configuration link in the Overview area of your project
  • Click the Actions --> Edit button on the top right
  • In the image to deploy, choose the "custom-jenkins" and then "latest" listed with the openshift namespace
  • Click Save

The new Jenkins will automatically deploy and be ready after a few minutes. Log in and verify your plugins are there! If you want more plugins, just fork this GH repo and edit.

The plugins I want to include by default

ConfigMaps for the K8s Pod Template setup in Jenkins within OpenShift

  • baseJenkinsSlave - the CentOS7 base image used to run build commands and such
  • dotnetcore21JenkinsSlave - The Red Hat .NET Core 2.1 Jenkins Slave
  • dotnetcore22JenkinsSlave - The Red Hat .NET Core 2.2 Jenkins Slave
  • nodejs8JenkinsSlave - The Red Hat NodeJS 8 Jenkins Slave
  • sonardotnetJenkinsSlave - a custom SonarQube Jenkins Slave with the dotnet sonarscanner global tool installed

You can add others by studying the structure and using the correct parameters and image references internal or external

Adding Access to the Red Hat Docker Registry

If you have not already done so you need to setup a secret in OpenShift to pull from the RH Registry as it requires a Red Hat Developer account. The link is at the bottom of this page but the steps are really here. Perform them inside the "openshift" namespace specifically after you login with your OC command from the Username --> Copy Login Command in the top right corner of the OpenShift Web Console. Replace the "user-name" and "password" with your Red Hat Developer login and password. If you do not have one, go here: https://developers.redhat.com/.

oc project openshift

oc create secret docker-registry redhat-registry \
    --docker-server=registry.redhat.io \
    --docker-username=<user-name> \
    --docker-password=<password> \
    --docker-email=unused

oc secrets link default redhat-registry --for=pull

oc secrets link builder redhat-registry

oc create -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/dotnet_imagestreams.json

oc replace -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/dotnet_imagestreams.json

You may get warnings on the imagestreams. I ran both as I had to create a couple and update the rest. You can go to the OpenShift Web Console and then go to the openshift project and list the Build --> Images to ensure they are there.

Great reference points that will help you

About

Customize the Jenkins S2I image to include plugins, k8s pod templates, etc.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages