Commit changes to GitHub & new test results
Jenkins
We are going to commit a code change to GitHub from what we've got (Build Action for GitHub Java application with Maven - Console Output, Updating Maven) and see what happens, using the source code we checked out (Git/GitHub plugins, SSH keys configuration, and Fork/Clone).
Since we have Jenkins configured to monitor our GitHub fork, if we make any changes, Jenkins should be able to pick them up.
So let's make a change to introduce a code change that will cause the unit tests to fail.
Open the file, 'game-of-life/gameoflife-core/src/main/java/ com/wakaleo/gameoflife/domain/Cell.java':
package com.wakaleo.gameoflife.domain; public enum Cell { LIVE_CELL("*"), DEAD_CELL("."); private String symbol; private Cell(final String initialSymbol) { this.symbol = initialSymbol; } @Override public String toString() { return symbol; } static Cell fromSymbol(final String symbol) { Cell cellRepresentedBySymbol = null; for (Cell cell : Cell.values()) { if (cell.symbol.equals(symbol)) { cellRepresentedBySymbol = cell; break; } } return cellRepresentedBySymbol; } public String getSymbol() { return symbol; } }
Now we want us pluses (+) instead of stars (*) for LIVE_CELL:
package com.wakaleo.gameoflife.domain; public enum Cell { LIVE_CELL("*+"), DEAD_CELL(".");
Save this change, and then commit them to the local Git repository by running git commit:
$ sudo git commit -a -m "Changes stars to pluses for LIVE_CELL" [sudo] password for k: [master 68ca833] Changes stars to pluses for LIVE_CELL 1 file changed, 1 insertion(+), 1 deletion(-)
This will commit the changes locally, but since Git is a distributed repository, we now have to push these changes through to our fork on GitHub. We do this by running git push:
$ sudo git push Username for 'https://github.com': bogo-devops Password for 'https://bogo-devops@github.com': Counting objects: 53, done. Delta compression using up to 2 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (11/11), 756 bytes | 0 bytes/s, done. Total 11 (delta 4), reused 9 (delta 3) To https://github.com/bogo-devops/game-of-life.git 1805132..68ca833 master -> master
We can check if the push was successful or not by visiting GitHub:
We can see the the code push was successful.
Now go back to the Jenkins web page.
After a minute or so, a new build should kick off, and fail. In fact, there are several other places which are affected by this change, and the regression tests related to these features are now failing.
We see clouds on the home page. The cloud gives us a general idea of how stable our build is over time.
If we click on the new build history entry, Jenkins will give us some more details about what went wrong. Jenkins tells us that there were 35 new test failures in this build, something which can be seen at a glance in the Test Result Trend graph - red indicates test failures. We can even see which tests are failing, and how long they have been broken.
If we want to know exactly what went wrong, we just click on the failed test classes, Jenkins brings up the actual details of the test failures , which is a great help when it comes to reproducing and fixing the issue.
Jenkins
Ph.D. / Golden Gate Ave, San Francisco / Seoul National Univ / Carnegie Mellon / UC Berkeley / DevOps / Deep Learning / Visualization