Add exercise
12
exercises/06-notifications/instructions.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Exercise 6
|
||||||
|
|
||||||
|
This exercise will demonstrate the use of a Google Chat room as way to send a notification upon a failed build. Given the locked down nature of Google Chat, this exercise will only be demonstrated by the instructor.
|
||||||
|
|
||||||
|
## Notifying the Team Upon a Broken Build
|
||||||
|
|
||||||
|
1. Change the list of Gradle tasks to `doesnotexist` to emulate a failure. The build will fail as the task doesn't exist in the build script.
|
||||||
|
2. Install the [Google Chat Notification plugin](https://plugins.jenkins.io/google-chat-notification).
|
||||||
|
3. Create a new chat room in Google Chat named `jenkins-test` at [https://chat.google.com/](https://chat.google.com/).
|
||||||
|
4. For the chat room configure the webhook.
|
||||||
|
5. Configure the job to send a notification whenever the job fails. Use the webhook generated on Google Chat.
|
||||||
|
6. Execute the build. The build should fail and send a notification to the chat room.
|
||||||
BIN
exercises/06-notifications/solution/images/add-webhook.png
Normal file
|
After Width: | Height: | Size: 986 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
BIN
exercises/06-notifications/solution/images/chat-room-message.png
Normal file
|
After Width: | Height: | Size: 996 KiB |
BIN
exercises/06-notifications/solution/images/create-room.png
Normal file
|
After Width: | Height: | Size: 826 KiB |
|
After Width: | Height: | Size: 872 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
BIN
exercises/06-notifications/solution/images/webhook-naming.png
Normal file
|
After Width: | Height: | Size: 952 KiB |
BIN
exercises/06-notifications/solution/images/webhook-url.png
Normal file
|
After Width: | Height: | Size: 956 KiB |
33
exercises/06-notifications/solution/solution.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Solution
|
||||||
|
|
||||||
|
Change the list of Gradle tasks first.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Find the plugin and install it.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Add a new chat room.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
For the chat room, click the little cog icon and create a new webhook.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Enter an appropriate name for the webhook.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Copy the generate webhook URL to the clipboard.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
In the Jenkins job, create a new Google Chat notification. Add the webhook URL and provide a name.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Run a build. It should fail and send a new message to the chat room.
|
||||||
|
|
||||||
|

|
||||||