2

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.

<builders>
    <hudson.plugins.jira.JiraEnvironmentVariableBuilder plugin="[email protected]"/>
    <hudson.plugins.jira.JiraIssueUpdateBuilder plugin="[email protected]">
      <jqlSearch>issue in (${JIRA_ISSUES})</jqlSearch>
      <workflowActionName>Ready for Review</workflowActionName>
      <comment>add comment</comment>
    </hudson.plugins.jira.JiraIssueUpdateBuilder>
</builders>

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

<publishers>
    <hudson.plugins.jira.JiraIssueUpdater plugin="[email protected]">
      <issueSelector class="hudson.plugins.jira.selector.JqlIssueSelector">
        <jql>issue=MYPROJECT-1234</jql>
      </issueSelector>
      <labels/>
    </hudson.plugins.jira.JiraIssueUpdater>
</publishers>

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 <[email protected]>
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?

2
  • Could you indicate whether you solved the issue?
    – 030
    Dec 23, 2019 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, 2019 at 23:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.