OpenShift CI/CD Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(58 intermediate revisions by the same user not shown)
Line 2: Line 2:


* [[OpenShift Operations#Subjects|OpenShift Operations]]
* [[OpenShift Operations#Subjects|OpenShift Operations]]
* [[Jenkins and OpenShift]]
* [[OpenShift CI/CD Concepts#Overview|OpenShift CI/CD Concepts]]


=Overview=
=End-to-End Procedures=


=Set Up a Jenkins CI/CD Pipeline=
* [[OpenShift CI/CD Operations - Collocated Persistent Jenkins Set Up|Collocated Jenkins Deployment and Set Up]]
* [[CI/CD Infrastructure Setup]]


==Create Required Image Streams==


{{Internal|OpenShift_Image_and_ImageStream_Operations#Create_an_Image_Stream|Create an Image Stream}}
{{Error|ALL THIS MUST BE REFACTORED}}


==Create Required Projects==
=Resources=


Create the following projects:
This is the memory consumption based on a test installation:
* jenkins/jenkins-jnlp pod: 880 MB
* nexus pod: 1.5 GB
* gogs pod: 140 MB
* gogs postgresql pod: 42 MB
* sonar pod: 2.0 GB
* sonar postgresql pod: 77 MB


1. A project for the CI/CD components, named "cicd":
=Set Up a CI/CD Pipeline=


oc new-project cicd --display-name="CI/CD pipeline with Jenkins"


2. A project to host development-stage containers and processes, named "dev":


oc new-project dev --display-name="Tasks - Dev"


3. A project to host publicly-accessible application produced by the CI/CD pipeline, named "stage":
=Configure the Jenkins Pipeline with Pipeline Plug-In=


oc new-project stage --display-name="Tasks - Stage"
New Item -> "hello-nodejs-pipeline" -> Pipeline -> OK


==Grant Jenkins Needed Privileges for the Projects that Require CI/CD Services==
Pipeline -> Definition -> Pipeline script:


The Jenkins components need to access the OpenShift API for various operations: access container images, etc. so they need to be granted sufficient privileges to invoke the OpenShift API for the projects requiring CI/CD pipeline services - in our case "dev" and "stage":
=Set up Continuous Delivery=


oc policy add-role-to-user edit system:serviceaccount:cicd:jenkins -n dev
Set up a development, QA and production project.
oc policy add-role-to-user edit system:serviceaccount:cicd:jenkins -n stage


For more details, see {{Internal|Oc_policy#add-role-to-user|oc policy add-role-to-user}}
<font color=red>TODO: Example: "Continuous Delivery Using OpenShift and Jenkins Pipeline Plug-in" 07 1 CD JEE Lab, Advanced Development on-line class.</font>


<font color=red>oc policy add-role-to-user edit system:service account:cicd:default -n cicd
=Troubleshooting=
oc policy add-role-to-user edit system:service account:cicd:default -n cicd-dev
oc policy add-role-to-user edit system:service account:cicd:default -n cicd-stage</font>


==Create the CI/CD Components==
* [[OpenShift Jenkins fails to Communicate with Maven slaves]]
 
oc project cicd
oc process -f cicd-template.yaml | oc create -f -
 
oc process -f cicd-template.yaml \
    --param DEV_PROJECT=dev-project-name \
    --param STAGE_PROJECT=stage-project-name \
    | oc create -f - -n cicd-project-name
 
=Organizatorium=
 
oc project cicd
 
Instantiate components. Use templates. 'cicd-github-template.yaml'.
 
oc process -f https&#58;//raw.githubusercontent.com/OpenShiftDemos/openshift-cd-demo/master/cicd-github-template.yaml | oc create -f -
 
 
Inspect Nexus
 
Inspect Jenkins

Latest revision as of 23:53, 8 December 2017

Internal

End-to-End Procedures



ALL THIS MUST BE REFACTORED

Resources

This is the memory consumption based on a test installation:

  • jenkins/jenkins-jnlp pod: 880 MB
  • nexus pod: 1.5 GB
  • gogs pod: 140 MB
  • gogs postgresql pod: 42 MB
  • sonar pod: 2.0 GB
  • sonar postgresql pod: 77 MB

Set Up a CI/CD Pipeline

Configure the Jenkins Pipeline with Pipeline Plug-In

New Item -> "hello-nodejs-pipeline" -> Pipeline -> OK

Pipeline -> Definition -> Pipeline script:

Set up Continuous Delivery

Set up a development, QA and production project.

TODO: Example: "Continuous Delivery Using OpenShift and Jenkins Pipeline Plug-in" 07 1 CD JEE Lab, Advanced Development on-line class.

Troubleshooting