Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-25269

Allow use of sonar.groovy for pull requests (multibranch)

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.3
    • Component/s: Dev Tools, Tests

      Description

      The sonar.groovy pipeline currently works with BRANCH and PARENT_BRANCH parameters. BRANCH is set by Jenkins in most situations but not with multibranch job that is used for PR and which populates BRANCH_NAME and CHANGE_TARGET.

      BRANCH_NAME
          For a multibranch project, this will be set to the name of the branch being built, for example in case you wish to deploy to production from master but not from feature branches.
      CHANGE_ID
          For a multibranch project corresponding to some kind of change request, this will be set to the change ID, such as a pull request number.
      CHANGE_URL
          For a multibranch project corresponding to some kind of change request, this will be set to the change URL.
      CHANGE_TITLE
          For a multibranch project corresponding to some kind of change request, this will be set to the title of the change.
      CHANGE_AUTHOR
          For a multibranch project corresponding to some kind of change request, this will be set to the username of the author of the proposed change.
      CHANGE_AUTHOR_DISPLAY_NAME
          For a multibranch project corresponding to some kind of change request, this will be set to the human name of the author.
      CHANGE_AUTHOR_EMAIL
          For a multibranch project corresponding to some kind of change request, this will be set to the email address of the author.
      CHANGE_TARGET
          For a multibranch project corresponding to some kind of change request, this will be set to the target or base branch to which the change could be merged.

      The CHANGE_BRANCH parameter being introduced with branch-api-2.0.0 (JENKINS-41104, JENKINS-47617, JENKINS-43507), here is a workaround to retrieve the PR source branch name from the PR ID:

      curl -s -XGET "https://api.github.com/repos/nuxeo/nuxeo/pulls/$CHANGE_ID"|jq -r ".head.ref"

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jcarsique Julien Carsique
                Reporter:
                jcarsique Julien Carsique
                Participants:
                Reviewers:
                Alexis Timic, Mincong Huang, Stéphane Lacoin
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: