CI/CD in Action¶
Make a change in GitHub¶
- 
Navigate to your GitHub fork's main page (this is the Codetab if you are on a different tab such as settings)
- 
Choose to Go to file 
- 
Type (or paste) the name of the following file into the search bar and select it (copy and paste box below image):  src/main/resources/db/mysql/data.sqlIf the file doesn't appear right away Depending on your internet connection to GitHub, there may be a slight delay before the file appears for editing (your screen matches the picture above and you can click to select the file). 
- 
Select to edit the file  
- 
Change the file to add the pet field of your choice and commit it to your GitHub fork (description and copy and paste box are below image)  - 
Make a change using the pet type you want to add (example is a turtle) Note The copy and paste box below can be entered on line 24 with enterpressed after it to match the image above.Turtle INSERT IGNORE INTO types VALUES (7, 'turtle');I want to add Willow, an awesome armadillo, not Yertle the turtle! If you want to add something other than a turtle as an option, please change turtleto that animal (i.e.armadillo) in the mysql statement above. For the armadillo example, the statement becomes:INSERT IGNORE INTO types VALUES (7, 'armadillo');
- 
Type in a commit message (you can make this whatever you want) and commit the change (example copy and paste boxes from image above) Yertle the turtle TitleTurtle TimeExtended DescriptionI want to be able to add Yertle the turtle.
 
- 
- 
Take note of the git commit message and hash  
Continuous Integration via OpenShift Pipelines¶
Successfully Run Pipeline via GitHub¶
- 
Visit the newly triggered pipeline run in the Pipelinesmenu in the OpenShift UI 
- 
View the pipeline run from the Detailsview You can see the event listener has triggered the PipelineRuninstead of a user this time.
- 
You can see the variables populated with the correct values from Github in the YAMLview of the pipeline run. 
- 
Watch the results of your build pipeline run. It should complete successfully as in the pictures below. Your pipeline may take a while to run The pipeline run may take anywhere from 10-25 minutes to complete depending on the current system load. You can see the progress of your build, as well as if any errors occur, via the UI. Thus, by monitoring the UI, you can make sure things are going as planned. What should you do if your pipeline run ends in failure If your pipeline run ends in failure, please look at the Failuretab (immediately below this message) to get back on track (instead of the defaultSuccesstab).Pipeline Run Success View Perspective:  Pipeline Run Details View In the pipeline run Detailsview, you can see the pipeline run succeeded with all tasks having a green check mark. Additionally, observe that the event listener has triggered thePipelineRuninstead of a user this time.Pipeline Run Success Logs Perspective:  Pipeline Run Logs View 1 In the pipeline run Logsview, you can also see that the pipeline run tasks all have green check marks. Looking at the last task, you can see that the that the external connection check worked and the PetClinic application is available at the route printed in the logs. Additionally, you can see via the series of tasks marked with green checks that the dev deployment ran successfully and the system cleaned it up and ran the staging deployment successfully to complete the pipeline. Pipeline Run Logs View 2 When you switch to the deploy-stagingtask logs, by clicking on thetaskon the left hand side of theLogsview of the pipeline run, you see this was an automated build from git since the task prints out theGIT_MESSAGEthat you typed in your commit word for word. (Note: If you chose a different commit message that will show instead of the one displayed in the image above.).Your pipeline failed, here is how to get back on the happy path - 
Please review your pipelineRunand see what error caused the failure.
- 
Make changes to fix the error. (If it's unclear what is causing the error / how to fix it, please ask the instructors for help) 
- 
Resend the webhook from GitHub to trigger a new pipelineRunwith the same values as before (see images below for help)- 
Click on your webhook from the Webhookssection of the repository settings for your GitHub repository fork of thespring-petclinicrepository 
- 
Click on the 3 dots for the most recent delivery 
- 
Click Redeliver 
- 
Confirm Redelivery  
 
- 
 
- 
See Changes in Application¶
- 
Navigate to the Topologyview and open a new tab with your recently deployedstagingversion of the PetClinic application by clickingOpen URL. 
- 
Navigate to the Find Ownerstab 
- 
Choose to add a new owner  
- 
Add the owner with details of your choice  
- 
Choose to add one of the owner's pets  
- 
Fill in the pet's details and select the new type of pet you added (turtle for the example)  
- 
View the newly created pet of the new type (Yertle the turtle for the example)  
Summary  ¶
¶
In this section, you made a change to your PetClinic application to add a new pet type of your choice and pushed the change to GitHub. This triggered a new pipeline run which built a new image for the application tagged with the git commit hash and displayed the commit message explaining the change the build was implementing. Next, your pipeline deployed this change to OpenShift in development, tested it internally and externally and then rolled it out to staging (where it was also tested automatically). Finally, you visited the application and used the new feature (new type of pet) by adding a pet of that type to a new owner successfully. In other words, you are off the ground and running with "cloud native" CI/CD for your PetClinic application on IBM Z/LinuxONE! Congratulations!!!
Created: April 13, 2021