代码拉取完成,页面将自动刷新
#!groovy
node('docker') {
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()
])
def cesBuildLib = libraryFromLocalRepo().com.cloudogu.ces.cesbuildlib
def mvn = cesBuildLib.MavenInDocker.new(this, "3.6.3-jdk-11")
mvn.useLocalRepoFromJenkins = true
def git = cesBuildLib.Git.new(this)
if ("master".equals(env.BRANCH_NAME)) {
mvn.additionalArgs = "-DperformRelease"
currentBuild.description = mvn.getVersion()
}
String emailRecipients = env.EMAIL_RECIPIENTS
catchError {
stage('Checkout') {
checkout scm
/* Don't remove folders starting in "." like
* .m2 (maven)
* .npm
* .cache, .local (bower)
*/
git.clean('".*/"')
}
stage('Build') {
// Run the maven build
mvn 'clean install -DskipTests'
archive 'target/*.jar'
}
stage('Unit Test') {
mvn 'test -Dmaven.test.failure.ignore=true'
// Archive Unit and integration test results, if any
junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml,**/target/surefire-reports/TEST-*.xml'
}
stage('SonarQube') {
generateCoverageReportForSonarQube(mvn)
def sonarQube = cesBuildLib.SonarQube.new(this, 'ces-sonar')
sonarQube.updateAnalysisResultOfPullRequestsToGitHub('sonarqube-gh-token')
sonarQube.analyzeWith(mvn)
if (!sonarQube.waitForQualityGateWebhookToBeCalled()) {
unstable("Pipeline unstable due to SonarQube quality gate failure")
}
}
}
mailIfStatusChanged(findEmailRecipients(emailRecipients))
}
static void generateCoverageReportForSonarQube(def mvn) {
mvn 'org.jacoco:jacoco-maven-plugin:0.8.5:report'
}
def libraryFromLocalRepo() {
// Workaround for loading the current repo as shared build lib.
// Checks out to workspace local folder named like the identifier.
// We have to pass an identifier with version (which is ignored). Otherwise the build fails.
library(identifier: 'ces-build-lib@snapshot', retriever: legacySCM(scm))
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。