Make Jenkinsfile parallel
Some checks failed
andreas-personal/good-old-jenkins/pipeline/head There was a failure building this commit

This commit is contained in:
Andreas Fahrecker 2024-04-16 00:24:26 +02:00
parent 899b4e07bf
commit f58dc78f4e

57
Jenkinsfile vendored
View File

@ -1,7 +1,9 @@
#!groovy
pipeline {
agent none
agent {
label 'linux'
}
stages {
stage('Build/Push Docker Image') {
@ -9,9 +11,6 @@ pipeline {
beforeAgent true;
branch 'main'
}
agent {
label 'linux'
}
environment {
DOCKER_HUB_CREDENTIALS = credentials('docker-hub-fah16145')
}
@ -21,30 +20,34 @@ pipeline {
sh 'docker login -u ${DOCKER_HUB_CREDENTIALS_USR} -p ${DOCKER_HUB_CREDENTIALS_PSW}'
}
}
stage('Default Image') {
stages {
stage('Build') {
steps {
sh 'docker build -t fah16145/good-old-jenkins:latest .'
stage('Build & Push') {
parallel {
stage('Default Image') {
stages {
stage('Build Default Image') {
steps {
sh 'docker build -t fah16145/good-old-jenkins:latest .'
}
}
stage('Push Default Image') {
steps {
sh 'docker push fah16145/good-old-jenkins:latest'
}
}
}
}
stage('Push') {
steps {
sh 'docker push fah16145/good-old-jenkins:latest'
}
}
}
}
stage('Alpine Image') {
stages {
stage('Build') {
steps {
sh 'docker build -t fah16145/good-old-jenkins:alpine alpine/'
}
}
stage('Push') {
steps {
sh 'docker push fah16145/good-old-jenkins:alpine'
}
stage('Alpine Image') {
stages {
stage('Build Alpine Image') {
steps {
sh 'docker build -t fah16145/good-old-jenkins:alpine alpine/'
}
}
stage('Push Alpine Image') {
steps {
sh 'docker push fah16145/good-old-jenkins:alpine'
}
}
}
}
}