DB_ENGINE=$(sed "s/run-db-integration-tests-//g" <<< $RUN_ACTIVITY | cut -d \- -f 1)
CATEGORY_GROUP=$(sed "s/run-db-integration-tests-//g" <<< $RUN_ACTIVITY | cut -d \- -f 2)
- if [[ "$GITHUB_BRANCH" == "PULLREQUEST-"* ]] && [[ "$DB_ENGINE" != "postgresql93" ]]; then
- # execute PR QA only on postgres
+ if [[ "$GITHUB_BRANCH" != "PULLREQUEST-"* ]] && [[ "$GITHUB_BRANCH" != "master" ]] && [[ "$GITHUB_BRANCH" != "branch-"* ]] && [[ "$GITHUB_BRANCH" != "dogfood-on-next" ]]; then
+ # do not execute QA tests on feature branch outside pull request
exit 0
- elif [[ "$GITHUB_BRANCH" == "dogfood-on-next" ]] && [[ "$DB_ENGINE" != "postgresql93" ]]; then
- # execute dogfood QA only on postgres
+
+ elif [[ "$GITHUB_BRANCH" == "PULLREQUEST-"* ]] && [[ "$DB_ENGINE" != "postgresql93" ]]; then
+ # restrict QA tests to PostgreSQL on pull requests
+ exit 0
+
+ elif [[ "$GITHUB_BRANCH" == "dogfood-on-next" ]] && [[ "$DB_ENGINE" != "postgresql93" ]]; then
+ # restrict QA tests to PostgreSQL on dogfood branch
exit 0
+
else
mvn clean package -B -e -V -f tests/plugins/pom.xml
run-upgrade-tests-*)
DB_ENGINE=$(sed "s/run-upgrade-tests-//g" <<< $RUN_ACTIVITY)
- if [[ "$GITHUB_BRANCH" == "PULLREQUEST-"* ]] && [[ "$DB_ENGINE" != "postgresql93" ]]; then
- exit 0
+ if [[ "$GITHUB_BRANCH" != "master" ]] && [[ "$GITHUB_BRANCH" != "branch-"* ]] && [[ "$DB_ENGINE" != "postgresql93" ]]; then
+ # restrict upgrade tests to PostgreSQL on feature branches and dogfood
+ exit 0
+
else
./run-upgrade-tests.sh "http://infra.internal.sonarsource.com/jenkins/orch-${DB_ENGINE}.properties"
fi
<module>tests/plugins</module>
</modules>
</profile>
+
+ <profile>
+ <id>deploy-sonarsource</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>enforce-deploy-settings</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireProperty>
+ <property>gitRepositoryName</property>
+ <message>You must set name of Git repository in your pom</message>
+ </requireProperty>
+ <requireEnvironmentVariable>
+ <variableName>ARTIFACTORY_URL</variableName>
+ </requireEnvironmentVariable>
+ <requireEnvironmentVariable>
+ <variableName>ARTIFACTORY_DEPLOY_REPO</variableName>
+ </requireEnvironmentVariable>
+ <requireEnvironmentVariable>
+ <variableName>ARTIFACTORY_DEPLOY_USERNAME</variableName>
+ </requireEnvironmentVariable>
+ <requireEnvironmentVariable>
+ <variableName>ARTIFACTORY_DEPLOY_PASSWORD</variableName>
+ </requireEnvironmentVariable>
+ </rules>
+ <fail>true</fail>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <!-- this maven plugin is not deployed in Maven Central. It should be downloaded
+ from JFrog JCenter or from SonarSource repositories -->
+ <groupId>org.jfrog.buildinfo</groupId>
+ <artifactId>artifactory-maven-plugin</artifactId>
+ <version>${version.artifactory.plugin}</version>
+ <executions>
+ <execution>
+ <id>build-info</id>
+ <goals>
+ <goal>publish</goal>
+ </goals>
+ <configuration>
+ <artifactory>
+ <envVarsExcludePatterns>
+ *password*,*PASSWORD*,*secret*,*MAVEN_CMD_LINE_ARGS*,sun.java.command,*token*,*TOKEN*,*LOGIN*,*login*
+ </envVarsExcludePatterns>
+ <includeEnvVars>true</includeEnvVars>
+ <timeoutSec>60</timeoutSec>
+ </artifactory>
+ <deployProperties>
+ <build.name>${gitRepositoryName}</build.name>
+ <build.number>{{BUILD_NUMBER}}</build.number>
+ <pr.branch.target>{{PULL_REQUEST_BRANCH_TARGET}}</pr.branch.target>
+ <pr.number>{{PULL_REQUEST_NUMBER}}</pr.number>
+ <vcs.branch>{{GIT_BRANCH}}</vcs.branch>
+ <vcs.revision>{{GIT_COMMIT}}</vcs.revision>
+ <version>${project.version}</version>
+ </deployProperties>
+ <licenses>
+ <autoDiscover>true</autoDiscover>
+ <includePublishedArtifacts>false</includePublishedArtifacts>
+ <runChecks>true</runChecks>
+ <scopes>project,provided</scopes>
+ <violationRecipients>licences-control@sonarsource.com</violationRecipients>
+ </licenses>
+ <publisher>
+ <contextUrl>${env.ARTIFACTORY_URL}</contextUrl>
+ <repoKey>${env.ARTIFACTORY_DEPLOY_REPO}</repoKey>
+ <username>${env.ARTIFACTORY_DEPLOY_USERNAME}</username>
+ <password>${env.ARTIFACTORY_DEPLOY_PASSWORD}</password>
+ <publishBuildInfo>true</publishBuildInfo>
+ <publishArtifacts>true</publishArtifacts>
+ </publisher>
+ <buildInfo>
+ <buildName>${gitRepositoryName}</buildName>
+ <buildNumber>{{BUILD_NUMBER}}</buildNumber>
+ <buildUrl>{{CI_BUILD_URL|BUILD_URL}}</buildUrl>
+ <vcsRevision>{{GIT_COMMIT}}</vcsRevision>
+ </buildInfo>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
</profiles>
</project>
# @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)
-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
-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
-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 \
-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" ""