donal
2018-07-03 7549a931ab871dc000a9cafad9772974dd569372
exercises/6-return-of-the-app-monitoring/README.md
@@ -1,11 +1,23 @@
# Return of the Application Monitoring
# Return of the Monitoring
> In this exercise we will create a build monitor to radiate vital build information and statistics
![monitoring-meme](../images/exercise6/monitoring-meme.jpg)
## Exercise Intro
Why do we use visual monitors? Visual monitors support the tight feedback loop which is vital to an agile working environment. Being in a centrally visible location, visual monitors radiate information rapidly, meaning the team doesn't have to go looking for it. Visual monitors also provide a degree of accountibility while also keeping the team motivated to fix problems. With broken components visualised, seeing progress monitors change from red to green can give the collective feeling that progress is being made. Finally visual monitors can promote team cohesion as it enables all team members to be on the same page regarding the current project status.
Build monitors provide a tight feedback loop which is vital to high performing teams. Being in a highly visible location, build monitors radiate crucial build and test information, meaning the team doesn't have to go out of their way to find it. Build monitors also provide a degree of accountability whilst also keeping the team motivated to fix problems. With broken components visualised, seeing build monitors change from red to green can give the collective feeling that progress is being made.
On residencies we display the build monitors on Raspberry Pi's hooked up to large TV screens that everyone can see at a glance. We've also used colour-changing lightbulbs in the labs that change from Green to Red depending on the success/fail status of jobs. There are many other ways to notify people of Build Failures such as Slack notices, text messages or just plain old email. This exercise is about radiating the information to allow teams respond quickly to change.
In this Exercise we will be creating a build monitor to display all of our jobs in one visual display as well as pipeline views. We will then add the cause of build failures for each job to the monitors. This will allow you to rapidly see why a particular build is failing and fix it faster.
Finally, build monitors can promote team cohesion as they enable all team members to be on the same page regarding the current project status. They can also engage business users and clients on the stats of the system. __The most important thing here isn't the tool, but the visual feedback.__
## Why do we use build monitors?
- Provides instant feedback to teams regarding the current status of the build.
- Tightens feedback loop by having vital information needed by teams, available upfront.
- Motivates teams to fix problems together.
____
## Learning Outcomes
As a learner you will be able to
@@ -25,14 +37,14 @@
_____
## 10,000 Ft View
> The goal of this exercise is to introduce Build Monitors to radiate teams progress on Dashboards.
> The goal of this exercise is to introduce Build Monitors to radiate team's progress on Dashboards.
2. Create a new Dashboard for our Builds using the plugin above. Use Regex to add jobs to it. Use the BuildFail Analyser to add meaningful data to the reason for failures.
2. Use the pipeline views in OpenShift and Jenkins to produce dashboards that teams can use.
2. Use the pipeline views in OpenShift and Jenkins to produce dashboards that teams can use.
## Step by Step Instructions
> This is a fairly structured guide with references to exact filenames and sections of text to be added. Include pictures and code snippets where appropriate. Rule of thumb is learners are dumb.... so over describe _why_ we're doing things
> This is a fairly structured guide with references to exact filenames and sections of text to be added. Include pictures and code snippets where appropriate.
### Part 1 - Create a build monitor
> _In this exercise we will create a new build monitor to show key information about our builds_
@@ -48,7 +60,7 @@
2. Check the box to use Regular Expression and set the value to be something that should scrape our apps such as `.*todolist.*` 
![config-regex](../images/exercise6/config-regex.png)
2. Finally; select `Display committers` and set the Failure Analyser to `Description`. This allows us to write regex for when fails occur in Jenkins and have the reasons plotted on the graph. For example; number of test scores or common compilation errors.
2. Finally; select `Display committers` and set the Failure Analyser to `Description`. This allows us to write regexes for when failures occur in Jenkins and have the reasons plotted on the graph. For example; number of test scores or common compilation errors.
![config-commiters](../images/exercise6/config-commiters.png)
2. Save your configuration to see your Build Monitor! 
@@ -74,7 +86,7 @@
2. Open the `todolist-fe` app in your favourite editor. In this exercise, we will fail a test and capture the message in the log and visualise it on a dashboard.
2. Open one of the tests you wrote in previous labs; for example `tests/unit/vue-components/TodoItem.spec.js`. Negate the test at the very bottom of the file by adding a `.not` to the `expect()` statement as shown below.
2. Open one of the tests you wrote in previous exercises; for example `tests/unit/vue-components/TodoItem.spec.js`. Negate the test at the very bottom of the file by adding a `.not` to the `expect()` statement as shown below.
```javascript
  it("call makImportant when clicked", () => {
    const wrapper = mount(TodoItem, {
@@ -99,13 +111,17 @@
2. Our dashboards are set to show the `Description` field from the `Build Fail Analyser`. Run a build by checking in our failed tests and check the result on the Build Monitor created in the previous step
```bash
$ git add .
$ git commit -m "TEST - failing build"
$ git push
git add .
```
```bash
git commit -m "TEST - failing build"
```
```bash
git push
```
![fail-dashboard](../images/exercise6/fail-dashboard.png)
2. We can save up these regex and inject them into the `jenkins-s2i` so the configuration is there the next time we launch and we don't have to code them up again. In `enablement-ci-cd` repo; the `jenkins-s2i/configuration/build-failure-analyzer.xml` already contains ones we've collected on previous residencies.
2. We can save up these regexes and inject them into the `jenkins-s2i` so the configuration is there the next time we launch and we don't have to code them up again. In `enablement-ci-cd` repo; the `jenkins-s2i/configuration/build-failure-analyzer.xml` already contains ones we've collected on previous residencies.
### Part 3 - Seed Jenkins Dashboards
> _TODO - Add instructions for creating dashboards as part of s2i in Jenkins setup using DSL_
@@ -121,7 +137,7 @@
 - Add `Slack` integration to the Pipeline by setting up a WebHook to call the slack endpoint with Build Stats
 - Add `Twillio` text integration to send you text messages when the build fails.
Additional Monitoring
 - Explore the Application's FEK stack inside OpenShift
 - Explore the Application's EFK stack inside OpenShift
## Additional Reading
> List of links or other reading that might be of use / reference for the exercise
@@ -130,4 +146,4 @@
- [Intro](https://docs.google.com/presentation/d/1nfv1f04HkvN6ruOZ5JRMnHsSfDClyMNOhXxcC7WsSr4/)
- [Wrap-up](https://docs.google.com/presentation/d/1-HI9Wd5WWlzaMWmFpBEclqdyt9pFumaVbfOUrkfYKY0/)
- [All Material](https://drive.google.com/drive/folders/1Lx0OotWjisugCY11Ef0dF7EZXMIPoXOO)
- [All Material](https://drive.google.com/drive/folders/1Lx0OotWjisugCY11Ef0dF7EZXMIPoXOO)