-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better customization for slack messages #49
Comments
The most thorough way of allowing customization would be to extend "instant-messaging-plugin", the way "jabber-plugin" does: A simpler way would be to allow defining a custom message subject, with support for token macros. Even more simply, if the plugin allows using build.getFullDisplayName() and/or build.getDescription(), other logic can take care of choosing the description. Currently, the slack plugin is hardcoded to use build.getProject().getName(), which is particularly uninformative with foldered jobs. Example project: |
Feel free to make a contribution! I don't actively develop this plugin. I only manage pull requests and releases. |
If you would like to be invited to https://jenkins-slack-plugin.slack.com/ for testing then just ask. |
I was able to change the display by using the Build Name Setter Plugin. That might not be exacly what you are after, but it was enough for our needs. |
I would like to see this, too. I have users for whom a job name does not have much meaning. I need to post a message that they can relate to, like "Main TV 2.20 has been deployed." |
+1 I have the same use case as thorntonrose: deploy jobs which deploy specific versions of the product, and groups of people want to be notified of the availability of the new version. |
It's slated to be included. I'm leaving it open until around the 29th for code review. |
howdy! One thing I would like to customize is to add the username to the build output right now at the end of the build I get this message in slack:
It would be nice to customize this to something like:
|
Another customization that would be nice is the ability to add slack emoji based on build status. ❌ for failure or ✅ for success. |
@wickett you can include the commit list with the slack message. That calls out which users made the changes. Is this not good enough? |
How to make a multi-line message? |
@samrocketman I'm currently using an environment variable for the custom message; the message itself has \n but in Slack it's being outputted as a literal \n. Any ideas on how to fix it? |
@FaizVisram According to the Slack API multiline messages documentation including a |
I tested and confirmed your issue @FaizVisram. Please open a new issue describing the behavior. Perhaps a user will contribute a solution for you. Contributions are welcome. |
@samrocketman it seems as though the environment variable was taking it as a literal \n instead of parsing it as a new line. Had to re-write it to make it accept it as a new line. Thanks. |
@FaizVisram can you open an issue describing the fix? |
@samrocketman Created: Issue #135 |
I've set Custom message to |
@Nakilon environment variables exported inside the shell don't get exported into the Jenkins runtime. You'd have to set a build parameter MYVAR or a global variable MYVAR. There won't ever be support for that in this plugin due to the design of Jenkins. |
OK, I got it. |
There is a way from the shell script. You could technically use |
@mgedmin
Now you can enter your custom message. |
The above comments does not work. In Slack it just displays the plain text as Can anyone guide whats wrong here? |
Where could I find full list of env. variables provides to us in jenkins for publishing on slack like - |
Some of the variables (e.g. GIT_BRANCH) are provided by Jenkins plugins. I don't recall exactly which of the plugins I've used (GitHub Pull Request Builder plugin perhaps?). IIRC I ran |
@samrocketman I'm currently using the environment injection plugin to inject an environment from a bash command. I can use this everywhere but when slack posts it's message it still won't use the variable it will just say |
This is a 2 year old issue. If you like, open a new issue with additional details for the current maintainers. |
Have you found a workaround? |
I'm looking for the same. |
any updates? |
Including the branch name in the slack notifications.
Also, not sure how to provide better customization of the slack notifications.
Contributions are welcome.
The text was updated successfully, but these errors were encountered: