mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-21 06:52:11 +01:00
Merged 2.0.0-m3 into feature/global_config_v2_endpoint
This commit is contained in:
124
Jenkinsfile
vendored
124
Jenkinsfile
vendored
@@ -1,47 +1,107 @@
|
||||
#!groovy
|
||||
@Library('github.com/cloudogu/ces-build-lib@ac17d45')
|
||||
|
||||
// Keep the version in sync with the one used in pom.xml in order to get correct syntax completion.
|
||||
@Library('github.com/cloudogu/ces-build-lib@9aadeeb')
|
||||
import com.cloudogu.ces.cesbuildlib.*
|
||||
|
||||
node() { // No specific label
|
||||
|
||||
properties([
|
||||
// Keep only the last 10 build to preserve space
|
||||
buildDiscarder(logRotator(numToKeepStr: '10')),
|
||||
// Don't run concurrent builds for a branch, because they use the same workspace directory
|
||||
disableConcurrentBuilds()
|
||||
])
|
||||
// Change this as when we go back to default - necessary for proper SonarQube analysis
|
||||
mainBranch = "2.0.0-m3"
|
||||
|
||||
String defaultEmailRecipients = env.EMAIL_SCM_RECIPIENTS
|
||||
properties([
|
||||
// Keep only the last 10 build to preserve space
|
||||
buildDiscarder(logRotator(numToKeepStr: '10')),
|
||||
])
|
||||
|
||||
catchError {
|
||||
catchError {
|
||||
|
||||
Maven mvn = new MavenWrapper(this)
|
||||
Maven mvn = setupMavenBuild()
|
||||
// Maven build specified it must be 1.8.0-101 or newer
|
||||
def javaHome = tool 'JDK-1.8.0-101+'
|
||||
|
||||
stage('Checkout') {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
mvn 'clean install -DskipTests -DperformRelease'
|
||||
archive '**/target/*.jar,**/target/*.zip'
|
||||
}
|
||||
|
||||
stage('Unit Test') {
|
||||
mvn 'test -Dsonia.scm.test.skip.hg=true'
|
||||
}
|
||||
|
||||
stage('SonarQube') {
|
||||
def sonarQube = new SonarQube(this, 'ces-sonar')
|
||||
|
||||
sonarQube.analyzeWith(mvn)
|
||||
withEnv(["JAVA_HOME=${javaHome}", "PATH=${env.JAVA_HOME}/bin:${env.PATH}"]) {
|
||||
|
||||
stage('Checkout') {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
mvn 'clean install -DskipTests'
|
||||
}
|
||||
|
||||
stage('Unit Test') {
|
||||
mvn 'test -Dsonia.scm.test.skip.hg=true'
|
||||
}
|
||||
|
||||
stage('SonarQube') {
|
||||
|
||||
def sonarQube = new SonarQube(this, 'sonarcloud.io')
|
||||
|
||||
analyzeWith(mvn)
|
||||
|
||||
if (!sonarQube.waitForQualityGateWebhookToBeCalled()) {
|
||||
currentBuild.result = 'UNSTABLE'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Archive Unit and integration test results, if any
|
||||
junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml,**/target/surefire-reports/TEST-*.xml,**/target/jest-reports/TEST-*.xml'
|
||||
// Archive Unit and integration test results, if any
|
||||
junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml,**/target/surefire-reports/TEST-*.xml,**/target/jest-reports/TEST-*.xml'
|
||||
|
||||
// Find maven warnings and visualize in job
|
||||
warnings consoleParsers: [[parserName: 'Maven']], canRunOnFailed: true
|
||||
// Find maven warnings and visualize in job
|
||||
warnings consoleParsers: [[parserName: 'Maven']], canRunOnFailed: true
|
||||
|
||||
mailIfStatusChanged(defaultEmailRecipients)
|
||||
mailIfStatusChanged(commitAuthorEmail)
|
||||
}
|
||||
|
||||
String mainBranch
|
||||
|
||||
Maven setupMavenBuild() {
|
||||
Maven mvn = new MavenWrapper(this)
|
||||
|
||||
if (mainBranch.equals(env.BRANCH_NAME)) {
|
||||
// Release starts javadoc, which takes very long, so do only for certain branches
|
||||
mvn.additionalArgs += ' -DperformRelease'
|
||||
// JDK8 is more strict, we should fix this before the next release. Right now, this is just not the focus, yet.
|
||||
mvn.additionalArgs += ' -Dmaven.javadoc.failOnError=false'
|
||||
}
|
||||
return mvn
|
||||
}
|
||||
|
||||
void analyzeWith(Maven mvn) {
|
||||
|
||||
withSonarQubeEnv('sonarcloud.io') {
|
||||
|
||||
String mvnArgs = "${env.SONAR_MAVEN_GOAL} " +
|
||||
"-Dsonar.host.url=${env.SONAR_HOST_URL} " +
|
||||
"-Dsonar.login=${env.SONAR_AUTH_TOKEN} "
|
||||
|
||||
if (isPullRequest()) {
|
||||
echo "Analysing SQ in PR mode"
|
||||
mvnArgs += "-Dsonar.pullrequest.base=${env.CHANGE_TARGET} " +
|
||||
"-Dsonar.pullrequest.branch=${env.CHANGE_BRANCH} " +
|
||||
"-Dsonar.pullrequest.key=${env.CHANGE_ID} " +
|
||||
"-Dsonar.pullrequest.provider=bitbucketcloud " +
|
||||
"-Dsonar.pullrequest.bitbucketcloud.owner=sdorra " +
|
||||
"-Dsonar.pullrequest.bitbucketcloud.repository=scm-manager "
|
||||
} else {
|
||||
mvnArgs += " -Dsonar.branch.name=${env.BRANCH_NAME} "
|
||||
if (!mainBranch.equals(env.BRANCH_NAME)) {
|
||||
// Avoid exception "The main branch must not have a target" on main branch
|
||||
mvnArgs += " -Dsonar.branch.target=${mainBranch} "
|
||||
}
|
||||
}
|
||||
mvn "${mvnArgs}"
|
||||
}
|
||||
}
|
||||
|
||||
String getCommitAuthorComplete() {
|
||||
new Sh(this).returnStdOut 'hg log --branch . --limit 1 --template "{author}"'
|
||||
}
|
||||
|
||||
String getCommitAuthorEmail() {
|
||||
def matcher = getCommitAuthorComplete() =~ "<(.*?)>"
|
||||
matcher ? matcher[0][1] : ""
|
||||
}
|
||||
|
||||
23
pom.xml
23
pom.xml
@@ -145,10 +145,31 @@
|
||||
<version>${mokito.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<!-- Dependency used in Jenkinsfile. Including this in maven provides code completion in Jenkinsfile. -->
|
||||
<groupId>com.github.cloudogu</groupId>
|
||||
<artifactId>ces-build-lib</artifactId>
|
||||
<!-- Keep this version in sync with the one used in Jenkinsfile -->
|
||||
<version>9aadeeb</version>
|
||||
<!-- Don't ship this dependency with the app -->
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
@@ -254,7 +275,6 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9</version>
|
||||
<configuration>
|
||||
<useStandardDocletOptions>true</useStandardDocletOptions>
|
||||
<charset>${project.build.sourceEncoding}</charset>
|
||||
@@ -439,7 +459,6 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.8.1</version>
|
||||
<configuration>
|
||||
<doclet>org.jboss.apiviz.APIviz</doclet>
|
||||
<docletArtifact>
|
||||
|
||||
@@ -159,7 +159,6 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9</version>
|
||||
<configuration>
|
||||
<useStandardDocletOptions>true</useStandardDocletOptions>
|
||||
<charset>${project.build.sourceEncoding}</charset>
|
||||
|
||||
@@ -566,7 +566,7 @@
|
||||
<sonar.issue.ignore.multicriteria>e1</sonar.issue.ignore.multicriteria>
|
||||
<sonar.issue.ignore.multicriteria.e1.ruleKey>javascript:S3827</sonar.issue.ignore.multicriteria.e1.ruleKey>
|
||||
<sonar.issue.ignore.multicriteria.e1.resourceKey>**.js</sonar.issue.ignore.multicriteria.e1.resourceKey>
|
||||
<sonar.exclusions>src/main/webapp/resources/extjs/**,src/main/webapp/resources/moment/**,src/main/webapp/resources/syntaxhighlighter/**</sonar.exclusions>
|
||||
<sonar.exclusions>src/main/webapp**</sonar.exclusions>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
|
||||
Reference in New Issue
Block a user