I have jenkins job for with GitHub Pull Request Builder.

In build, I added first step to set the JIRA_ISSUE variable.

JIRA: Add related environment variables to build

Extracts JIRA information for the build to environment variables.
Available variables:
JIRA_ISSUES - A comma separated list of issues which are referenced in the version control system changelog
JIRA_URL - Primary URL for the JIRA server
Typical usage:

Add this build step
Use the "Progress JIRA issues by workflow action" or "Move issues matching JQL to the specified version" with JQL like:
issue in (${JIRA_ISSUES})

Second step is to update these jira issues.

    <hudson.plugins.jira.JiraEnvironmentVariableBuilder plugin="jira@3.0.0"/>
    <hudson.plugins.jira.JiraIssueUpdateBuilder plugin="jira@3.0.0">
      <jqlSearch>issue in (${JIRA_ISSUES})</jqlSearch>
      <workflowActionName>Ready for Review</workflowActionName>
      <comment>add comment</comment>

When I create PR, and it trigger the job, it not set JIRA_ISSUES

GitHub pull request #356 of commit 2e2b92d107a5460c4cc593fcab78c63f800d6472, no merge conflicts.
Setting status of 2e2b92d107a5460c4cc593fcab78c63f800d6472 to PENDING with url https://myjenkins.com/job/cicd-myjob-prtest-unittest/69/ and message: 'running tox...'
Using context: tox testing
[EnvInject] - Loading node environment variables.
Building remotely on myslave.node.box.com (linux) in workspace /var/lib/jenkins/workspace/cicd-myjob-prtest-unittest
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://mygithub.com/myuser/myproject.git # timeout=10
Fetching upstream changes from https://mygithub.com/myuser/myproject.git
 > git --version # timeout=10
using GIT_ASKPASS to set credentials Github Service Account Username with token
 > git fetch --tags --progress https://mygithub.com/myuser/myproject.git +refs/pull/*:refs/remotes/origin/pr/*
 > git rev-parse refs/remotes/origin/pr/356/merge^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/pr/356/merge^{commit} # timeout=10
Checking out Revision 0ff9e43bbc1385303429f7bcf93fea36e8c455d3 (refs/remotes/origin/pr/356/merge)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 0ff9e43bbc1385303429f7bcf93fea36e8c455d3
Commit message: "Merge 2e2b92d107a5460c4cc593fcab78c63f800d6472 into 731994024e723b1257374f521b4784060df9e5b5"
First time build. Skipping changelog.
[JIRA] Setting JIRA_ISSUES to .
[JIRA] Updating issues using workflow action Ready for Review.
[JIRA] JQL: issue in ()
[JIRA] Updating issue MYPROJECT-1234
Setting status of 2e2b92d107a5460c4cc593fcab78c63f800d6472 to SUCCESS with url https://myjenkins.com/job/cicd-myjob-prtest-unittest/69/ and message: 'All is well.
Using context: tox testing
Finished: SUCCESS

The [JIRA] Updating issue MYPROJECT-1234 is from publisher

    <hudson.plugins.jira.JiraIssueUpdater plugin="jira@3.0.0">
      <issueSelector class="hudson.plugins.jira.selector.JqlIssueSelector">

If I look for change log for commit 2e2b92d107a5460c4cc593fcab78c63f800d6472 it has the jira issue in comment and title.

commit 2e2b92d107a5460c4cc593fcab78c63f800d6472 (HEAD -> MYPROJECT-1234, origin/MYPROJECT-1234)
Author: myuser <myuser@mygithub.com>
Date:   Tue Aug 21 15:55:41 2018 -0500

    MYPROJECT-1234: Tox testing

    MYPROJECT-1234 change the data.

Why is the JiraEnvironmentVariableBuilder not able to set JIRA_ISSUES to MYPROJECT-1234 while it is present in the changelog?

  • Could you indicate whether you solved the issue?
    – 030
    Dec 23 '19 at 10:05
  • 1
    No, I moved my job to pipeline, and now I am running loop over all the issues. If you get solution, please update this.
    – Nilesh
    Dec 25 '19 at 23:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.