Select Git revision
Jenkinsfile
Jenkinsfile 17.51 KiB
pipeline {
agent {
node {
label 'ozgcloud-jenkins-build-agent-jdk21-node20'
}
}
environment {
BLUE_OCEAN_URL = "https://jenkins.infra.ozg-cloud.systems/job/alfa/job/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/"
RELEASE_REGEX = /\d+.\d+.\d+/
SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/
FAILED_STAGE = ""
SH_SUCCESS_STATUS_CODE = 0
}
options {
timeout(time: 1, unit: 'HOURS')
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '5'))
}
stages {
stage('Check Version') {
steps {
script {
FAILED_STAGE = env.STAGE_NAME
VERSION = getRootPomVersion()
def serverVersion = getParentPomVersion('alfa-server/pom.xml')
def clientVersion = getParentPomVersion('alfa-client/pom.xml')
if(isReleaseBranch()){
if ( !isReleaseVersion([VERSION, serverVersion, clientVersion]) ) {
error("Keine Release Version für Branch ${env.BRANCH_NAME}.")
}
} else {
if ( !isSnapshotVersion([VERSION, serverVersion, clientVersion]) ) {
error("Keine Snapshot Version für Branch ${env.BRANCH_NAME}.")
}
}
if( !isSameVersion([serverVersion, clientVersion], VERSION) ){
error("Versionen sind nicht identisch")
}
}
}
}
stage('Client') {
environment {
FORCE_COLOR = 'false'
}
steps {
script {
FAILED_STAGE=env.STAGE_NAME
withNPM(npmrcConfig: 'npm-nexus-auth') {
sh 'npm --version'
sh 'node --version'
dir('alfa-client') {
sh 'npm cache verify'
sh 'npm install'
if (isMasterBranch()) {
withSonarQubeEnv('sonarqube-ozg-sh'){
sh 'npm run ci-sonar'
}
} else {
sh 'npm run ci-test'
}