Make Jenkinsfile parallel
Some checks failed
andreas-personal/good-old-jenkins/pipeline/head There was a failure building this commit
Some checks failed
andreas-personal/good-old-jenkins/pipeline/head There was a failure building this commit
This commit is contained in:
parent
899b4e07bf
commit
f58dc78f4e
19
Jenkinsfile
vendored
19
Jenkinsfile
vendored
@ -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,14 +20,16 @@ pipeline {
|
||||
sh 'docker login -u ${DOCKER_HUB_CREDENTIALS_USR} -p ${DOCKER_HUB_CREDENTIALS_PSW}'
|
||||
}
|
||||
}
|
||||
stage('Build & Push') {
|
||||
parallel {
|
||||
stage('Default Image') {
|
||||
stages {
|
||||
stage('Build') {
|
||||
stage('Build Default Image') {
|
||||
steps {
|
||||
sh 'docker build -t fah16145/good-old-jenkins:latest .'
|
||||
}
|
||||
}
|
||||
stage('Push') {
|
||||
stage('Push Default Image') {
|
||||
steps {
|
||||
sh 'docker push fah16145/good-old-jenkins:latest'
|
||||
}
|
||||
@ -37,12 +38,12 @@ pipeline {
|
||||
}
|
||||
stage('Alpine Image') {
|
||||
stages {
|
||||
stage('Build') {
|
||||
stage('Build Alpine Image') {
|
||||
steps {
|
||||
sh 'docker build -t fah16145/good-old-jenkins:alpine alpine/'
|
||||
}
|
||||
}
|
||||
stage('Push') {
|
||||
stage('Push Alpine Image') {
|
||||
steps {
|
||||
sh 'docker push fah16145/good-old-jenkins:alpine'
|
||||
}
|
||||
@ -50,6 +51,8 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh 'docker logout'
|
||||
|
Loading…
x
Reference in New Issue
Block a user