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.
- SonarQube
- Aqua Microscanner
- Slack - https://github.com/jenkinsci/slack-plugin
- Google Login - https://github.com/jenkinsci/google-login-plugin
- GitHub oAuth - https://github.com/jenkinsci/github-oauth-plugin
- Sonar Quality Gates - https://github.com/jenkinsci/sonar-quality-gates-plugin/blob/master/pom.xml
- Others
- 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
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.