Skip to content

Jenkins Shared Library with Pipelines meant for OpenShift Deployments

Notifications You must be signed in to change notification settings

domenicbove/openshift-pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

openshift-pipeline

Configure Jenkins with your OpenShift Cluster http://v1.uncontained.io/playbooks/continuous_delivery/external-jenkins-integration.html

As a result of that effort you should have a jenkins service account that all your jenkins agents run as.

Create build, test and prod projects. Name as you please

oc new-project demo-build
oc new-project demo-test
oc new-project demo-prod

Give jenkins SA permission to those projects

oc policy add-role-to-user edit system:serviceaccount:cicd:jenkins -n demo-build
oc policy add-role-to-user edit system:serviceaccount:cicd:jenkins -n demo-test
oc policy add-role-to-user edit system:serviceaccount:cicd:jenkins -n demo-prod

Create a image inspector SA in test project with privileged scc

oc create sa image-inspector -n demo-test
oc adm policy add-scc-to-user privileged -z image-inspector -n demo-test

Now you can create a Jenkinsfile like this:

library identifier: 'openshift-pipeline@master', retriever: modernSCM([$class: 'GitSCMSource',
   remote: 'https://github.com/domenicbove/openshift-pipeline.git']) _

mainPipeline {
    gitRepoUrl = "https://github.com/domenicbove/simple-server.git"
    microservice = "simple-server"
    templateGitRepoUrl = "https://github.com/domenicbove/openshift-templates.git"
    templateGitTag = "master"
    ocpUrl = "master1.ocp.com"
    buildProject = "demo-build"
    testProject = "demo-test"
    prodProject = "demo-prod"
}

Note it is required that the above project steps completed for this pipeline to work. Also the mainPipeline is tied closely with my openshift-templates repo. There are many options of where to store openshift templates. I decided to put them in github

About

Jenkins Shared Library with Pipelines meant for OpenShift Deployments

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages