Verified Commit 891d519a authored by Lukas Wiest's avatar Lukas Wiest 🚂
Browse files

ci: add jenkins script for multibranch pipeline

parent 87de694f
def version = ""
pipeline {
environment {
registry = "hftstuttgart/modocot-openjdk11-juni5-testrunner"
registryCredential = 'Dockerhub'
dockerImage = ''
}
agent any
tools {
jdk 'Java11'
maven 'Maven_Home'
}
stages {
stage('prepare') {
steps {
checkout ([
$class: 'GitSCM',
branches: scm.branches,
extensions: scm.extensions + [[$class: 'CloneOption', noTags: false, reference: '', shallow: false]],
userRemoteConfigs: scm.userRemoteConfigs
])
script {
version = sh(script: 'git describe --tags --always', returnStdout: true).trim()
echo sh(script: 'env|sort', returnStdout: true)
}
}
}
stage('compile') {
steps {
sh 'mvn clean package'
}
}
stage('build Docker image') {
steps {
script {
dockerImage = docker.build registry
}
}
}
stage('push development image') {
steps {
script {
docker.withRegistry( '', registryCredential ) {
dockerImage.push("${env.GIT_BRANCH}")
}
}
}
}
stage('release') {
when {
expression { version ==~ /[0-9]+.[0-9]+.[0-9]+/ }
}
steps {
script {
docker.withRegistry( '', registryCredential ) {
dockerImage.push("latest")
dockerImage.push("${version}")
}
}
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment