Skip to content
Snippets Groups Projects
Commit e8987fcf authored by OZGCloud's avatar OZGCloud
Browse files

Merge pull request 'OZG-3140-jenkins-umzug' (#19) from OZG-3140-jenkins-umzug into master

parents e9a61acb d9d82eab
No related branches found
No related tags found
No related merge requests found
pipeline { pipeline {
agent { agent {
node { node {
label 'jenkins-worker' label 'jenkins-build-agent'
} }
} }
environment { environment {
BLUE_OCEAN_URL = "https://jenkins.ozg-sh.de/blue/organizations/jenkins/intelliform-adapter/detail/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/pipeline" BLUE_OCEAN_URL = "https://jenkins.ozg-sh.de/job/intelliform-adapter/job/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/"
RELEASE_REGEX = /\d+.\d+.\d+/ RELEASE_REGEX = /\d+.\d+.\d+/
SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/ SNAPSHOT_REGEX = /\d+.\d+.\d+-SNAPSHOT/
FAILED_STAGE = "" FAILED_STAGE = ""
...@@ -60,7 +60,6 @@ pipeline { ...@@ -60,7 +60,6 @@ pipeline {
script { script {
FAILED_STAGE=env.STAGE_NAME FAILED_STAGE=env.STAGE_NAME
} }
container("maven-17"){
configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) { configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) {
sh 'mvn --version' sh 'mvn --version'
sh 'mvn -s $MAVEN_SETTINGS clean install spring-boot:build-image -Dmaven.wagon.http.retryHandler.count=3' sh 'mvn -s $MAVEN_SETTINGS clean install spring-boot:build-image -Dmaven.wagon.http.retryHandler.count=3'
...@@ -78,7 +77,6 @@ pipeline { ...@@ -78,7 +77,6 @@ pipeline {
} }
} }
} }
}
post { post {
always{ always{
junit testResults: '**/target/surefire-reports/*.xml', skipPublishingChecks: true junit testResults: '**/target/surefire-reports/*.xml', skipPublishingChecks: true
...@@ -97,13 +95,11 @@ pipeline { ...@@ -97,13 +95,11 @@ pipeline {
script { script {
FAILED_STAGE = env.STAGE_NAME FAILED_STAGE = env.STAGE_NAME
} }
container('maven-17') {
configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) { configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) {
sh 'mvn -s $MAVEN_SETTINGS -DskipTests deploy' sh 'mvn -s $MAVEN_SETTINGS -DskipTests deploy'
} }
} }
} }
}
stage('Tag and Push Docker image') { stage('Tag and Push Docker image') {
steps { steps {
...@@ -128,7 +124,6 @@ pipeline { ...@@ -128,7 +124,6 @@ pipeline {
stage('Test, build and deploy Helm Chart') { stage('Test, build and deploy Helm Chart') {
steps { steps {
container('k8s') {
script { script {
FAILED_STAGE=env.STAGE_NAME FAILED_STAGE=env.STAGE_NAME
HELM_CHART_VERSION = generateHelmChartVersion() HELM_CHART_VERSION = generateHelmChartVersion()
...@@ -145,7 +140,6 @@ pipeline { ...@@ -145,7 +140,6 @@ pipeline {
} }
} }
} }
}
stage('Trigger Dev rollout') { stage('Trigger Dev rollout') {
when { when {
...@@ -196,10 +190,10 @@ pipeline { ...@@ -196,10 +190,10 @@ pipeline {
Void deployHelmChart(String helmChartVersion) { Void deployHelmChart(String helmChartVersion) {
withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]){ withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]){
if (env.BRANCH_NAME == 'release') { if (env.BRANCH_NAME == 'release') {
result = sh script: '''curl -u $USERNAME:$PASSWORD http://nexus.dev-tools:8081/service/rest/v1/components?repository=ozg-base-apps -F file=@Intelliform-Adapter-'''+helmChartVersion+'''.tgz''', returnStdout: true result = sh script: '''curl -u $USERNAME:$PASSWORD https://nexus.ozg-sh.de/service/rest/v1/components?repository=ozg-base-apps -F file=@Intelliform-Adapter-'''+helmChartVersion+'''.tgz''', returnStdout: true
} }
else { else {
result = sh script: '''curl -u $USERNAME:$PASSWORD http://nexus.dev-tools:8081/service/rest/v1/components?repository=ozg-base-apps-snapshot -F file=@Intelliform-Adapter-'''+helmChartVersion+'''.tgz''', returnStdout: true result = sh script: '''curl -u $USERNAME:$PASSWORD https://nexus.ozg-sh.de/service/rest/v1/components?repository=ozg-base-apps-snapshot -F file=@Intelliform-Adapter-'''+helmChartVersion+'''.tgz''', returnStdout: true
} }
if (result != '') { if (result != '') {
...@@ -293,15 +287,13 @@ Void checkoutProvisioningRepo() { ...@@ -293,15 +287,13 @@ Void checkoutProvisioningRepo() {
} }
Void tagAndPushDockerImage(String imageName, String newTag){ Void tagAndPushDockerImage(String imageName, String newTag){
container("docker") { withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) {
withCredentials([usernamePassword(credentialsId: 'jenkins-docker-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) {
sh 'docker login docker.ozg-sh.de -u ${USER} -p ${PASSWORD}' sh 'docker login docker.ozg-sh.de -u ${USER} -p ${PASSWORD}'
sh "docker tag docker.ozg-sh.de/${imageName}:build-latest docker.ozg-sh.de/${imageName}:${newTag}" sh "docker tag docker.ozg-sh.de/${imageName}:build-latest docker.ozg-sh.de/${imageName}:${newTag}"
sh "docker push docker.ozg-sh.de/${imageName}:${newTag}" sh "docker push docker.ozg-sh.de/${imageName}:${newTag}"
} }
} }
}
String getPomVersion(String pomFile){ String getPomVersion(String pomFile){
def pom = readMavenPom file: pomFile def pom = readMavenPom file: pomFile
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment