Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-12001

Auto-configuration of branches and pull requests on Travis CI

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Branch & PR
    • Labels:
      None
    • Edition:
      Developer
    • Production Notes:
      The change should be compatible with the Travis Addon. Once it has been deployed in production, the Travis Addon should be updated to remove all the part about branch/PR autodetection to only keep the scanner engine logic of this ticket.

      Description

      Why

      Configuring analysis of branches and pull requests is not straightforward. Some parameters should be defined on the project itself, through the administration console, and some others through the scanner. The latter parameters are misleading and hard to tune on the heterogeneous CI environments.

      Auto-configuration of scanner on the major CI services makes on-boarding easier. This approach has already been validated successfully for Bitbucket Pipelines and CirrusCI.

      What

      On TravisCI, the scanner properties should not be set by users. Values should be guessed by the scanner itself when it detects that runtime is TravisCI.

      How

      Runtime is considered as being TravisCI if the environment variable TRAVIS is true.

      Analysis of pull request is configured if TRAVIS_PULL_REQUEST is not "false":

      • sonar.pullrequest.provider is set to "github"
      • sonar.pullrequest.key is provided by the env variable TRAVIS_PULL_REQUEST
      • sonar.pullrequest.base is provided by the env variable TRAVIS_BRANCH
      • sonar.pullrequest.branch is provided by the env variable TRAVIS_PULL_REQUEST_BRANCH
      • sonar.pullrequest.github.repository is provided by the env variable TRAVIS_REPO_SLUG
      • the Git revision used to feed Github Checks should be provided by the env variable TRAVIS_PULL_REQUEST_SHA, not by the SCM Git plugin.

      Analysis of branch is configured if TRAVIS_PULL_REQUEST is "false" or empty:

      • the Git revision used to feed Github Checks should be provided by the env variable TRAVIS_COMMIT, not by the SCM Git plugin.
      • sonar.branch.name is provided by the env variable TRAVIS_BRANCH

      TBD:

      • pull requests from forked repositories
      • compatibility with Travis add-on
      • documentation to be completed
      • on-boarding tutorial

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              christophe.havard Christophe Havard
              Reporter:
              simon.brandhof Simon Brandhof (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: