Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-52577

CHANGE_ variables are missing

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Not A Defect
    • Component/s: bitbucket-plugin
    • Labels:
      None
    • Environment:
      2.121.1, SLES 12.4
    • Similar Issues:

      Description

      When using one of the variables, eg. ${env.CHANGE_URL} then null is printed instead.

      My usecase is to add an JIRA issue comment, for the successful build stage and every development stage to inform the user that tests are now possible on this Environment from now on.

      This seems to be similar to https://issues.jenkins-ci.org/browse/JENKINS-39838 but here for bitbucket instead. Interesting is that in classic GUI and Blue ocean an link to Bitbucket commit is shown!

        Attachments

          Activity

          Hide
          tkleiber Torsten Kleiber added a comment - - edited

          I import my pipeline from Bitbucket Server via Blue Ocean. Bitbucket Branch Source plugin is used. So I should see change_ environment variables - right? But I see null:

          Here you see in the configuration, that Bitbucket Branch Source plugin is used:

          So the issue should be reopened and the component should be changed back to Bitbucket Branch Source plugin.

          Show
          tkleiber Torsten Kleiber added a comment - - edited I import my pipeline from Bitbucket Server via Blue Ocean. Bitbucket Branch Source plugin is used. So I should see change_ environment variables - right? But I see null: Here you see in the configuration, that Bitbucket Branch Source plugin is used: So the issue should be reopened and the component should be changed back to Bitbucket Branch Source plugin.
          Hide
          jglick Jesse Glick added a comment -

          If you are running at least https://github.com/jenkinsci/bitbucket-branch-source-plugin/releases/tag/cloudbees-bitbucket-branch-source-2.9.0 (which includes https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/325) and the branch project you are testing this in is actually derived from a pull request (Jenkins job name PR-nnn) rather than an origin repository branch (job name my-feature) then please reopen, move to cloudbees-bitbucket-branch-source-plugin, clear Assignee, and provide steps to reproduce from scratch or at least whatever details you can share (Server vs. Cloud, forked PR vs. not, etc.).

          Show
          jglick Jesse Glick added a comment - If you are running at least https://github.com/jenkinsci/bitbucket-branch-source-plugin/releases/tag/cloudbees-bitbucket-branch-source-2.9.0 (which includes https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/325 ) and the branch project you are testing this in is actually derived from a pull request (Jenkins job name PR-nnn ) rather than an origin repository branch (job name my-feature ) then please reopen, move to cloudbees-bitbucket-branch-source-plugin , clear Assignee , and provide steps to reproduce from scratch or at least whatever details you can share (Server vs. Cloud, forked PR vs. not, etc.).
          Hide
          tkleiber Torsten Kleiber added a comment - - edited

          Ok - now I understand. The change variables are only set for pull requests, not for changes (commits) in branches and I can reproduce this behavior.

          Maybe the documentation should be changed for all change_ variables.

          Do you now any other concepts of change requests other than pull request?

          eg.:

          CHANGE_URL: For a multibranch project corresponding to some kind of change request like an pull request, this will be set to the change URL, if supported; else unset.

          or:

          CHANGE_URL: For a multibranch project corresponding to pull request, this will be set to the pull request URL, if supported; else unset.

          Show
          tkleiber Torsten Kleiber added a comment - - edited Ok - now I understand. The change variables are only set for pull requests, not for changes (commits) in branches and I can reproduce this behavior. Maybe the documentation should be changed for all change_ variables. Do you now any other concepts of change requests other than pull request? eg.: CHANGE_URL: For a multibranch project corresponding to some kind of change request like an pull request , this will be set to the change URL, if supported; else unset. or: CHANGE_URL: For a multibranch project corresponding to pull  request, this will be set to the pull   request URL, if supported; else unset.
          Hide
          jglick Jesse Glick added a comment -

          Maybe the documentation should be changed

          Feel free to open docs pull requests if you see some descriptions which are unclear.

          Do you now any other concepts of change requests other than pull request?

          The API terms and environment variables are deliberately left a bit abstract so it can encompass variant terminology in different branch source plugins. For example GitLab uses merge request but the concept and behavior is very similar. There is a Gerrit branch source plugin too, and if it implements the right APIs (I have no idea offhand), then the corresponding concept would I suppose be a patchset or whatever it is called. Still, by far the best known example is the GitHub pull request.

          Show
          jglick Jesse Glick added a comment - Maybe the documentation should be changed Feel free to open docs pull requests if you see some descriptions which are unclear. Do you now any other concepts of change requests other than pull request? The API terms and environment variables are deliberately left a bit abstract so it can encompass variant terminology in different branch source plugins. For example GitLab uses merge request but the concept and behavior is very similar. There is a Gerrit branch source plugin too, and if it implements the right APIs (I have no idea offhand), then the corresponding concept would I suppose be a patchset or whatever it is called. Still, by far the best known example is the GitHub pull request .
          Hide
          tkleiber Torsten Kleiber added a comment -

          Thank you!

          Show
          tkleiber Torsten Kleiber added a comment - Thank you!

            People

            Assignee:
            tzach_solomon Tzach Solomon
            Reporter:
            tkleiber Torsten Kleiber
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: