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
|
#!groovy
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent none
|
agent {
|
||||||
|
label 'linux'
|
||||||
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Build/Push Docker Image') {
|
stage('Build/Push Docker Image') {
|
||||||
@ -9,9 +11,6 @@ pipeline {
|
|||||||
beforeAgent true;
|
beforeAgent true;
|
||||||
branch 'main'
|
branch 'main'
|
||||||
}
|
}
|
||||||
agent {
|
|
||||||
label 'linux'
|
|
||||||
}
|
|
||||||
environment {
|
environment {
|
||||||
DOCKER_HUB_CREDENTIALS = credentials('docker-hub-fah16145')
|
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}'
|
sh 'docker login -u ${DOCKER_HUB_CREDENTIALS_USR} -p ${DOCKER_HUB_CREDENTIALS_PSW}'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage('Build & Push') {
|
||||||
|
parallel {
|
||||||
stage('Default Image') {
|
stage('Default Image') {
|
||||||
stages {
|
stages {
|
||||||
stage('Build') {
|
stage('Build Default Image') {
|
||||||
steps {
|
steps {
|
||||||
sh 'docker build -t fah16145/good-old-jenkins:latest .'
|
sh 'docker build -t fah16145/good-old-jenkins:latest .'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Push') {
|
stage('Push Default Image') {
|
||||||
steps {
|
steps {
|
||||||
sh 'docker push fah16145/good-old-jenkins:latest'
|
sh 'docker push fah16145/good-old-jenkins:latest'
|
||||||
}
|
}
|
||||||
@ -37,12 +38,12 @@ pipeline {
|
|||||||
}
|
}
|
||||||
stage('Alpine Image') {
|
stage('Alpine Image') {
|
||||||
stages {
|
stages {
|
||||||
stage('Build') {
|
stage('Build Alpine Image') {
|
||||||
steps {
|
steps {
|
||||||
sh 'docker build -t fah16145/good-old-jenkins:alpine alpine/'
|
sh 'docker build -t fah16145/good-old-jenkins:alpine alpine/'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Push') {
|
stage('Push Alpine Image') {
|
||||||
steps {
|
steps {
|
||||||
sh 'docker push fah16145/good-old-jenkins:alpine'
|
sh 'docker push fah16145/good-old-jenkins:alpine'
|
||||||
}
|
}
|
||||||
@ -50,6 +51,8 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
sh 'docker logout'
|
sh 'docker logout'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user