Use the Jira cloud plugin for Jenkins
This plugin will send build and deployment events to Jira so that they’re visible in your Jira issues, on the deployments timeline, and in the Releases feature.
To send information from Jenkins to Jira, your team must include Jira issue keys (e.g. FUSE-123) in their commit messages (for deployment information) and branch names (for build information). Whenever a pipeline runs in Jenkins, the plugin will look for Jira issue keys in the branch name and commit messages. If it finds issue keys, it will send build and deployment information to Jira. If it doesn’t find issue keys, the Jenkins plugin won’t send anything to Jira.
Sending builds automatically
To automatically send build events without having to add anything to your Jenkinsfiles, go to Manage Jenkins > Configure System and enable the checkbox “Sends builds automatically”.
When you enable this, the plugin will send an "in progress" build event to Jira once a pipeline run has started and a "success" or "failure" build event once the pipeline has finished successfully or stopped due to an error.
If you also specify a regular expression for builds, the plugin will only send a build event to Jira once a build step with a matching name has been finished.
The regular expression ^build$ would match the build stage in the following Jenkinsfile, for example:
Pipeline Syntax
Table of Contents
This section builds on the information introduced in Getting started with Pipeline and should be treated solely as a reference. For more information on how to use Pipeline syntax in practical examples, refer to the Using a Jenkinsfile section of this chapter. As of version 2.5 of the Pipeline plugin, Pipeline supports two discrete syntaxes which are detailed below. For the pros and cons of each, see the Syntax Comparison.
As discussed at the start of this chapter, the most fundamental part of a Pipeline is the "step". Basically, steps tell Jenkins what to do and serve as the basic building block for both Declarative and Scripted Pipeline syntax.
For an overview of available steps, please refer to the Pipeline Steps reference which contains a comprehensive list of steps built into Pipeline as well as steps provided by plugins.