Nexus image for openshift with Fuse and RedHat maven repositories
177
This repository includes the infrastructure and pipeline definition for continuous delivery using Jenkins, Nexus and SonarQube on OpenShift. On every pipeline execution, the code goes through the following steps:
The following diagram shows the steps included in the deployment pipeline:

Create a new project for CI/CD components
$ oc new-project cicd --display-name="CI/CD"
Create Dev and Stage projects for Tasks JAX-RS application
$ oc new-project dev --display-name="Tasks - Dev"
$ oc new-project stage --display-name="Tasks - Stage"
Jenkins needs to access OpenShift API to discover slave images as well accessing container images. Grant Jenkins service account enough privileges to invoke OpenShift API for the created projects:
$ oc policy add-role-to-user edit system:serviceaccount:cicd:default -n cicd
$ oc policy add-role-to-user edit system:serviceaccount:cicd:default -n dev
$ oc policy add-role-to-user edit system:serviceaccount:cicd:default -n stage
Create the CI/CD components based on the provided template (in cicd - project)
$ oc process -f cicd-gogs-template.yaml | oc create -f -
RunJenkins has the Pipeline plugin pre-installed. A Jenkins pipeline job is also pre-configured which clones Tasks JAX-RS application source code from GitHub, builds, deploys and promotes the result through the deployment pipeline. Click on tasks-cd-pipeline and Configure and explore the pipeline definition.
If using Gogs, modify the git repository url in the pipeline definition and set it to http://gogs:3000/gogs/openshift-tasks.git.
Run an instance of the pipeline by starting the tasks-cd-pipeline job.
During pipeline execution, verify a new Jenkins slave pod is created withing CI/CD project to execute the pipeline.
After pipeline completion, demonstrate the following:
snapshots repository in Nexus and verify openshift-tasks is pushed to the repositoryIf using Gogs, webhooks configuration is in repository's Settings > Webhooks and the tasks-cd-pipeline webhook url is http://jenkins:8080/job/tasks-cd-pipeline/build?delay=0sec.
Note: if GitHub is used and Jenkins route is not accessible from the Internet, use SCM Polling instead of webhooks to trigger builds.
Clone the openshift-tasks git repository and using an IDE (e.g. JBoss Developer Studio), remove the @Ignore annotation from src/test/java/org/jboss/as/quickstarts/tasksrs/service/UserResourceTest.java test methods to enable the unit tests. Commit and push to the git repo.
Check out Jenkins, a pipeline instance is created and is being executed. The pipeline will fail during unit tests due to the enabled unit test.
Check out the failed unit and test src/test/java/org/jboss/as/quickstarts/tasksrs/service/UserResourceTest.java and run it in the IDE.
Fix the test by modifying src/main/java/org/jboss/as/quickstarts/tasksrs/service/UserResource.java and uncommenting the sort function in getUsers method.
Run the unit test in the IDE. The unit test runs green. Commit and push the fix to the git repository and verify a pipeline instance is created in Jenkins and executes successfully.

Content type
Image
Digest
Size
198.4 MB
Last updated
almost 10 years ago
docker pull jalammas/nexus:2.13.0-01