diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2018-02-05 22:06:35 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2018-02-06 20:18:25 +0100 |
commit | 75873f6400090795cefd51f8e469900d1df938f4 (patch) | |
tree | e29c992e51df434a90c9c264a01cda117de04023 /travis.sh | |
parent | cf9eb2f6a2bc594e3007eff1494817a42a6f2d35 (diff) | |
download | sonarqube-75873f6400090795cefd51f8e469900d1df938f4.tar.gz sonarqube-75873f6400090795cefd51f8e469900d1df938f4.zip |
Add PR properties to Artifactory build info
Diffstat (limited to 'travis.sh')
-rwxr-xr-x | travis.sh | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/travis.sh b/travis.sh index 9ad2e069f49..f19d6be04ca 100755 --- a/travis.sh +++ b/travis.sh @@ -116,6 +116,19 @@ configureTravis # @TravisCI please provide the feature natively, like at AppVeyor or CircleCI ;-) cancel_branch_build_with_pr || if [[ $? -eq 1 ]]; then exit 0; fi +# configure environment variables for Artifactory +export GIT_COMMIT=$TRAVIS_COMMIT +export BUILD_NUMBER=$TRAVIS_BUILD_NUMBER +if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then + export GIT_BRANCH=$TRAVIS_BRANCH + unset PULL_REQUEST_BRANCH_TARGET + unset PULL_REQUEST_NUMBER +else + export GIT_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH + export PULL_REQUEST_BRANCH_TARGET=$TRAVIS_BRANCH + export PULL_REQUEST_NUMBER=$TRAVIS_PULL_REQUEST +fi + case "$TARGET" in BUILD) @@ -148,9 +161,9 @@ BUILD) -Dsonar.host.url=$SONAR_HOST_URL \ -Dsonar.login=$SONAR_TOKEN \ -Dsonar.projectVersion=$INITIAL_VERSION \ - -Dsonar.analysis.buildNumber=$TRAVIS_BUILD_NUMBER \ - -Dsonar.analysis.pipeline=$TRAVIS_BUILD_NUMBER \ - -Dsonar.analysis.sha1=$TRAVIS_COMMIT \ + -Dsonar.analysis.buildNumber=$BUILD_NUMBER \ + -Dsonar.analysis.pipeline=$BUILD_NUMBER \ + -Dsonar.analysis.sha1=$GIT_COMMIT \ -Dsonar.analysis.repository=$TRAVIS_REPO_SLUG elif [[ "$TRAVIS_BRANCH" == "branch-"* ]] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then @@ -165,9 +178,9 @@ BUILD) -Dsonar.login=$SONAR_TOKEN \ -Dsonar.branch.name=$TRAVIS_BRANCH \ -Dsonar.projectVersion=$INITIAL_VERSION \ - -Dsonar.analysis.buildNumber=$TRAVIS_BUILD_NUMBER \ - -Dsonar.analysis.pipeline=$TRAVIS_BUILD_NUMBER \ - -Dsonar.analysis.sha1=$TRAVIS_COMMIT \ + -Dsonar.analysis.buildNumber=$BUILD_NUMBER \ + -Dsonar.analysis.pipeline=$BUILD_NUMBER \ + -Dsonar.analysis.sha1=$GIT_COMMIT \ -Dsonar.analysis.repository=$TRAVIS_REPO_SLUG elif [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ -n "${GITHUB_TOKEN:-}" ]; then @@ -184,8 +197,8 @@ BUILD) -Dsonar.login=$SONAR_TOKEN \ -Dsonar.branch.name=$TRAVIS_PULL_REQUEST_BRANCH \ -Dsonar.branch.target=$TRAVIS_BRANCH \ - -Dsonar.analysis.buildNumber=$TRAVIS_BUILD_NUMBER \ - -Dsonar.analysis.pipeline=$TRAVIS_BUILD_NUMBER \ + -Dsonar.analysis.buildNumber=$BUILD_NUMBER \ + -Dsonar.analysis.pipeline=$BUILD_NUMBER \ -Dsonar.analysis.sha1=$TRAVIS_PULL_REQUEST_SHA \ -Dsonar.analysis.prNumber=$TRAVIS_PULL_REQUEST \ -Dsonar.analysis.repository=$TRAVIS_REPO_SLUG \ @@ -193,17 +206,10 @@ BUILD) -Dsonar.pullrequest.github.id=$TRAVIS_PULL_REQUEST \ -Dsonar.pullrequest.github.repository=$TRAVIS_REPO_SLUG - elif [[ "$TRAVIS_BRANCH" == "dogfood-on-"* ]] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then - echo 'Build dogfood branch' - - mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy \ - $MAVEN_ARGS \ - -Pdeploy-sonarsource,release - else echo 'Build feature branch or external pull request' - mvn install $MAVEN_ARGS -Dsource.skip=true + mvn deploy $MAVEN_ARGS -Dsource.skip=true -Pdeploy-sonarsource fi ./run-integration-tests.sh "Lite" "" |