To get notifications about your Jenkins builds, use the Jenkins app in Chat.
Before you begin
- Get permission from your Google Workspace administrator to install apps.
- Add the app to Chat. Learn how to find and add apps to Chat.
Step 1: Install Chat plugin on Jenkins server
To do this task, you must sign in as a Jenkins administrator.
- On your device, download the Chat Notifier Plugin file.
- In “Jenkins,” select Manage Jenkins Manage Plugins.
- On the “Advanced” tab, under “Upload Plugin,” select the plug-in file.
- Click Upload.
People in your organization can now install and set up the Jenkins app.
Step 2: Set up the Jenkins app in Chat
To send build notifications to Chat, Jenkins needs the token that the app generates. Each space where you add the app gets a token. The app sends notifications to all spaces where it's a member.
- Open Google Chat.
- Open a direct message or go to a space.
- Copy the token in the app.
- (Optional) To display the token again, select an option:
- In a direct message, enter token.
- In a space, enter /jenkins_token.
- (Optional) To regenerate the token, click Regenerate Token.
Step 3: Set up notifications
- Open “Jenkins.”
- Go to the build that you want to add Chat notifications for.
- Under “Build,” next to “Add build step,” click the Down arrow .
- Choose which notifications you want to get.
- Under “Post-build Actions,” next to “Add post-build actions,” click the Down arrow .
- Select Notify Hangouts Chat.
- Choose an option and paste the token you copy from Chat.
- Chat: Choose a global configuration that you previously set up.
- Chat Token: Override the global configuration for a specific Chat space.
- Check the boxes for the items that you want to get notifications about in Chat.
- Click Save.
From a Build event notification, click:
- Open Build: This modifies the build configuration in Jenkins.
- View Details: This lets you view information about the notification.
Step 4: Get notifications for a pipeline
- Open "Jenkins."
- Open the pipeline that you want to add Chat notifications for.
-
In your pipeline script, enter:
hangoutsNotify message: "This message is from a pipeline!",token: {your_jenkins_token},threadByJob: false
Tip: Make sure to replace{your_jenkins_token}
with the token you requested from the Chat app. You can setthreadByJob
totrue
orfalse
. - Click Save.
Using the app in spaces
To use the app in spaces, you must @mention the app in each message to the app and in replies to messages from the app. The @mention confirms you're sending the message to the app and not to others in the space. You can also type /jenkins_ and select the desired command from the dropdown.
Triggering builds from Chat
- In a space with Jenkins installed, or in a Jenkins direct message, enter /jenkins_triggerJob.
- In the dialog that opens, fill in the required fields: "Jenkins URL," "Job Name," "UserName" and "ApiToken."
- Click Submit.
Optionally, you can select whether you want to store your token (it will never be shown) and pass optional parameters to your build request.
Google, Google Workspace, and related marks and logos are trademarks of Google LLC. All other company and product names are trademarks of the companies with which they are associated.