Skip to content

Latest commit

 

History

History
66 lines (45 loc) · 2.13 KB

cicd.adoc

File metadata and controls

66 lines (45 loc) · 2.13 KB

Use case: CI/CD Pipeline

Deploy Jenkins

Give Jenkins an admin privilege

$ oc login -u admin -p admin
$ oc adm policy add-cluster-role-to-user cluster-admin system:serviceaccount:ci:jenkins -n ci

Install the Jenkins/OpenShift Pipeline BuildConfig in another project

$ oc login -u developer -p developer
$ oc new-project ci
$ oc create -f https://raw.githubusercontent.com/redhat-helloworld-msa/aloha/master/pipeline.yml
$ oc project helloworld-msa

Once approved, the fixed project will be applied to the "production".

  • First introduce an error in the production.

$ cd aloha/
$ vim src/main/java/com/redhat/developers/msa/aloha/AlohaVerticle.java

#  replace  return String.format("Aloha mai %s", hostname);
#  by       return String.format("Aloca mai %s", hostname);
  • Deploy the erroneous version in the production area.

$ mvn clean package; oc start-build aloha --from-dir=. --follow

Now Browse to the ci project and select BuildsPipelines in the lateral menu. Click on the gray button called Start Pipeline.

pipeline

The projects helloworld-msa-dev and helloworld-msa-qa will be created automatically according to the defined Pipeline.

You will need to manually approve the deployment to production.