Skip to content

jenkinsci/instant-messaging-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jenkins Instant-Messaging plugin

Jenkins Plugin GitHub release Jenkins Plugin Installs Build Status GitHub license Maintenance

Introduction

This plugin provides abstract support for instant-messaging notifications to Jenkins, including a common bot-driven command and query interface and the core for pipeline steps integration code.

Practical support for particular IM protocols is implemented by various concrete plugins like the Jabber/XMPP or the IRC plugin, allowing users to have the same interactions with their Jenkins server whatever messenger they use.

Note that there are some other IM protocol plugins that chose to implement everything from scratch, so they do not use instant-messaging-plugin as a dependency and do not enjoy its common features.

There are also plugins which add commands available via instant messaging such as Log Command.

For more information, visit the plugin information page: https://plugins.jenkins.io/instant-messaging/

The practical suggestions for freestyle or pipeline job setup may be seen in https://plugins.jenkins.io/ircbot/ and https://plugins.jenkins.io/jabber/ pages.

Regex support in bot commands

The currentlyBuilding (cb) and queue (q) commands now support an optional argument to apply regular expression filters to the lines they would output, and count and report hits compared to the full job lists.

The key argument for this is ~ and the rest of the argument string is assumed to be the regular expression (note however that whitespace between tokens of the argument string is converted during argument processing; for clarity it would be preferable to pass a single-token argument with \s+ in positions where whitespace matches are expected).

Beside ordinarily matching what is present in a line, this can be used with "negative lookups" for matching lines that do not contain certain patterns. Certain know-how applies to such expressions:

  • To negative-match the whole string from start, use a caret, e.g.:
developer> cb ~ ^(?!master)

to skip jobs running on nodes whose name starts with (or equals) master. Without the caret it did not work.

  • For matching inside a job name, the .* must be also inside the lookahead pattern:
developer> cb ~ ^(?!.*rescan)

would list only jobs whose IM report line does NOT include rescan.

  • Similarly, these commands can be used to quickly gauge how many builds are queued or running (without spelling out each one), with a regex filter or overall:
developer> jenkins: q # ~ mycomponent
jenkins> (notice) Build queue (19 items total, of which 2 items matched the filter)

developer> jenkins: cb #
jenkins> (notice) Currently building (11 items)
  • The currentlyBuilding command can also be asked to provide URLs to the console of the reported running builds, so you can quickly tap into them, e.g.:
developer> jenkins: cb @ ~ UI
jenkins> (notice) - ui-builder-1#0: UIbuild #25190
  @ https://jenkins.some.org/job/UIbuild/25190/console
  (Elapsed time: 2 min 31 sec, Estimated remaining time: 4 min 35 sec)