GIT_URL env variable not set for multibranch PR build

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major
    • Component/s: git-plugin
    • Environment:
      Jenkins LTS 2.263.4 on RHEL7 with Red Hat OpenJDK 8
      git-plugin 4.6.0
      git-client-plugin 3.6.0
      bitbucket-branch-source-plugin 2.9.7
    • git plugin 4.7.1 released 4 Apr 2021

      In a multibranch pipeline job we see that GIT_URL is set in builds for branches, but for PR builds it is null. However, GIT_COMMIT is set in both cases.
      We're using bitbucket-branch-source-plugin for the multibranch part but I believe it's git-plugin that sets the GIT_URL env variable.
      We are also using declarative pipelines, with implicit checkout.

      It should be reproducable with a simple pipeline like this:

      pipeline {
          agent any
          stages {
              stage('Test') {
                  steps {
                      echo "GIT_COMMIT: ${env.GIT_COMMIT}"
                      echo "GIT_URL: ${env.GIT_URL}"
                  }
              }
          }
      }
      

            Assignee:
            Unassigned
            Reporter:
            Anders Hammar
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: