<p>I have jenkins job for with <code>GitHub Pull Request Builder</code>.</p>

<p>In build, I added first step to set the <code>JIRA_ISSUE</code> variable.</p>

<p><strong>JIRA: Add related environment variables to build</strong></p>

<pre><code>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})
</code></pre>

<p>Second step is to update these jira issues.</p>

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

<p>When I create PR, and it trigger the job, it not set <code>JIRA_ISSUES</code></p>

<pre><code>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
 &gt; git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 &gt; git config remote.origin.url https://mygithub.com/myuser/myproject.git # timeout=10
Fetching upstream changes from https://mygithub.com/myuser/myproject.git
 &gt; git --version # timeout=10
using GIT_ASKPASS to set credentials Github Service Account Username with token
 &gt; git fetch --tags --progress https://mygithub.com/myuser/myproject.git +refs/pull/*:refs/remotes/origin/pr/*
 &gt; git rev-parse refs/remotes/origin/pr/356/merge^{commit} # timeout=10
 &gt; git rev-parse refs/remotes/origin/origin/pr/356/merge^{commit} # timeout=10
Checking out Revision 0ff9e43bbc1385303429f7bcf93fea36e8c455d3 (refs/remotes/origin/pr/356/merge)
 &gt; git config core.sparsecheckout # timeout=10
 &gt; 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
</code></pre>

<p>The <code>[JIRA] Updating issue MYPROJECT-1234</code> is from <code>publisher</code></p>

<pre><code>&lt;publishers&gt;
    &lt;hudson.plugins.jira.JiraIssueUpdater plugin="jira@3.0.0"&gt;
      &lt;issueSelector class="hudson.plugins.jira.selector.JqlIssueSelector"&gt;
        &lt;jql&gt;issue=MYPROJECT-1234&lt;/jql&gt;
      &lt;/issueSelector&gt;
      &lt;labels/&gt;
    &lt;/hudson.plugins.jira.JiraIssueUpdater&gt;
&lt;/publishers&gt;
</code></pre>

<p>If I look for change log for commit <code>2e2b92d107a5460c4cc593fcab78c63f800d6472</code> it has the jira issue in comment and title.</p>

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

    MYPROJECT-1234: Tox testing

    MYPROJECT-1234 change the data.
</code></pre>

<p>Why is the <code>JiraEnvironmentVariableBuilder</code> not able to set <code>JIRA_ISSUES</code> to <code>MYPROJECT-1234</code> while it is present in the changelog?</p>

CC BY-SA 4.0
2019-12-23T10:05:09.533Z
Could you indicate whether you solved the issue?
030
CC BY-SA 4.0
2019-12-25T23:56:46.410Z
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
<jenkins><jenkins-plugins><jira>
JIRA plugin on jenkins not set the JIRA_ISSUES variable
Nilesh
# JIRA plugin on jenkins not set the JIRA_ISSUES variable

(Asked by: username_0 on 2018-08-21)

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.

    
    
      issue in (${JIRA_ISSUES})
      Ready for Review
      add 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

    
      
        issue=MYPROJECT-1234
      
      
    


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 
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?

**Tags:** jenkins, jenkins-plugins, jira

> **Comments:**
> **username_1**: Could you indicate whether you solved the issue?  
> **username_0**: No, I moved my job to pipeline, and now I am running loop over all the issues. If you get solution, please update this.  

---

## 0 answers

