mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-03 06:09:46 +01:00
Run docker build and deployment only for main branch
This commit is contained in:
33
Jenkinsfile
vendored
33
Jenkinsfile
vendored
@@ -48,20 +48,21 @@ node('docker') {
|
||||
def commitHash = getCommitHash()
|
||||
def dockerImageTag = "2.0.0-dev-${commitHash.substring(0,7)}-${BUILD_NUMBER}"
|
||||
|
||||
stage('Docker') {
|
||||
// TODO only on mainBranch
|
||||
def image = docker.build('cloudogu/scm-manager')
|
||||
docker.withRegistry('', 'hub.docker.com-cesmarvin') {
|
||||
image.push(dockerImageTag)
|
||||
image.push('latest')
|
||||
if (isMainBranch()) {
|
||||
stage('Docker') {
|
||||
def image = docker.build('cloudogu/scm-manager')
|
||||
docker.withRegistry('', 'hub.docker.com-cesmarvin') {
|
||||
image.push(dockerImageTag)
|
||||
image.push('latest')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deployment') {
|
||||
build job: 'scm-manager/next-scm.cloudogu.com', propagate: false, wait: false, parameters: [
|
||||
string(name: 'changeset', value: commitHash),
|
||||
string(name: 'imageTag', value: dockerImageTag)
|
||||
]
|
||||
stage('Deployment') {
|
||||
build job: 'scm-manager/next-scm.cloudogu.com', propagate: false, wait: false, parameters: [
|
||||
string(name: 'changeset', value: commitHash),
|
||||
string(name: 'imageTag', value: dockerImageTag)
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +82,7 @@ Maven setupMavenBuild() {
|
||||
// Keep this version number in sync with .mvn/maven-wrapper.properties
|
||||
Maven mvn = new MavenInDocker(this, "3.5.2-jdk-8")
|
||||
|
||||
if (mainBranch.equals(env.BRANCH_NAME)) {
|
||||
if (isMainBranch()) {
|
||||
// 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.
|
||||
@@ -108,7 +109,7 @@ void analyzeWith(Maven mvn) {
|
||||
"-Dsonar.pullrequest.bitbucketcloud.repository=scm-manager "
|
||||
} else {
|
||||
mvnArgs += " -Dsonar.branch.name=${env.BRANCH_NAME} "
|
||||
if (!mainBranch.equals(env.BRANCH_NAME)) {
|
||||
if (!isMainBranch()) {
|
||||
// Avoid exception "The main branch must not have a target" on main branch
|
||||
mvnArgs += " -Dsonar.branch.target=${mainBranch} "
|
||||
}
|
||||
@@ -117,6 +118,10 @@ void analyzeWith(Maven mvn) {
|
||||
}
|
||||
}
|
||||
|
||||
boolean isMainBranch() {
|
||||
return mainBranch.equals(env.BRANCH_NAME)
|
||||
}
|
||||
|
||||
boolean waitForQualityGateWebhookToBeCalled() {
|
||||
boolean isQualityGateSucceeded = true
|
||||
timeout(time: 2, unit: 'MINUTES') { // Needed when there is no webhook for example
|
||||
|
||||
Reference in New Issue
Block a user