Lab 15 - Trigger the Software Supply Chain

Return to Workshop

Trigger the Trusted Software Supply Chain with Code Check-ins

Through automation, you will trigger the Trusted Software Supply Chain with code check-ins.

Verify Webhook in Gogs

The Webhook is what triggers your pipeline upon code check-ins. You want your SCM to trigger the pipeline as opposed to Jenkins constantly polling the source code for changes.

Click on the Gogs route url in the CI/CD project which takes you to the home page. Sign in using the credentials given to you by your Instructor.

Go to the openshift-tasks repository.

Select Settings.

Select Webhooks

Verify the Webhook. Make sure the url includes the name ‘tasks-pipeline’ of the your imported pipeline.

This should match the webhook of the pipeline you previously created except the domain will be openshift.default.svc.cluster.local because the gogs pod calls the internal dns to resolve the address.

The webhook url is located in builds > pipeline > tasks-pipeline > configuration > generic webhook url

Click on Eclipse Che route url in the CI/CD project which takes you to the workspace administration page. Select the Java stack and click on the Create button to create a workspace for yourself.

You may need to start the workspace. Click Start.

It might take a little while before your workspace is set up and ready to be used in your browser. Once it’s ready, click on Import Project in order to import the openshift-tasks Gogs repository into your workspace.

Enter the Gogs repository http url for openshift-tasks as the Git repository url with Git username and password in the url. You can copy this link from your Gogs using the link to clone the openshift-tasks project.

See the url below as an example.

You can find the repository url in Gogs web console.

Important: Make sure to check the Branch field and enter eap-7 in order to clone the eap-7 branch which is used in this demo.

Click on Import

Change the project configuration to Maven and then click Save

Configure you name and email to be stamped on your Git commity by going to Profile > Preferences > Git > Committer. Click Save and Close the Window once Saved.

Remove the @Ignore annotation from src/test/java/org/jboss/as/quickstarts/tasksrs/service/UserResourceTest.java test methods to enable the unit tests.

Click the Git Menu at the top > Commit

Important: Mare sure you select the check mark for “Push committed changes to: orgin/eap-7”

Click Commit

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.

Fix the test by modifying src/main/java/org/jboss/as/quickstarts/tasksrs/service/UserResource.java and uncommenting the sort function in getUsers method.

You can use CTRL+/ to uncomment multiple lines

Click on Git > Commit to commit the changes to the openshift-tasks git repository. Make sure Push commited changes to: origin/eap7 is checked. Click on Commit button.

As soon the changes are committed to the git repository, a new instances of pipeline gets triggers to test and deploy the code changes.

Go Back to OpenShift and Promote to Stage to finish your Pipeline Run


Workshop Details

Domain
Workshop
Student ID

Return to Workshop