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

Cannot get source branch in PR build in Bitbucket team project

    Details

    • Similar Issues:

      Description

      I need to get JIRA issue key from the name of the branch, but from the PR build I cannot obtain in. Source branch name is not listed in the 'env' list. It would be useful if we could somehow obtain the source branch name from the PR build

        Attachments

          Activity

          Hide
          marcinl Marcin L added a comment - - edited

          I updated to the latest 2.0.11 but still I can't get the source branch name. It's always set to "PR-" but I think it should be set to `head.ref` from Github api?

          Show
          marcinl Marcin L added a comment - - edited I updated to the latest 2.0.11 but still I can't get the source branch name. It's always set to "PR-" but I think it should be set to `head.ref` from Github api?
          Hide
          jglick Jesse Glick added a comment -

          Marcin L $CHANGE_BRANCH

          Show
          jglick Jesse Glick added a comment - Marcin L $CHANGE_BRANCH
          Hide
          marcinl Marcin L added a comment -

          I checked and $CHANGE_BRANCH environment variable is not set. This is my current setup:

          Are you sure it's working with GitHub PRs? I saw some comments online that it's only working with BitBucket.

          Show
          marcinl Marcin L added a comment - I checked and $CHANGE_BRANCH environment variable is not set. This is my current setup: Are you sure it's working with GitHub PRs? I saw some comments online that it's only working with BitBucket.
          Hide
          trusktr Joe Pea added a comment -

          Hello, how can we use the original branch for pull request builds, instead of the PR-XXX branches?

          Show
          trusktr Joe Pea added a comment - Hello, how can we use the original branch for pull request builds, instead of the PR-XXX branches?
          Hide
          trusktr Joe Pea added a comment -

          Figured it out. I set the `Discover branches Strategy` to `only branches that are filed as PRs`, and removed the `discover pull requests` options. Now it builds straight from my pull request branches, exactly like I wanted.

          Show
          trusktr Joe Pea added a comment - Figured it out. I set the `Discover branches Strategy` to `only branches that are filed as PRs`, and removed the `discover pull requests` options. Now it builds straight from my pull request branches, exactly like I wanted.

            People

            • Assignee:
              Unassigned
              Reporter:
              pkozikow Paweł Kozikowski
            • Votes:
              4 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: