Compare commits

...

2 Commits

Author SHA1 Message Date
f58dc78f4e Make Jenkinsfile parallel
Some checks failed
andreas-personal/good-old-jenkins/pipeline/head There was a failure building this commit
2024-04-16 00:24:26 +02:00
899b4e07bf Messed up Dockerfiles previously 2024-04-16 00:19:51 +02:00
3 changed files with 33 additions and 30 deletions

View File

@ -5,7 +5,8 @@ RUN groupadd -g 281 docker
RUN usermod -aG docker jenkins
# Install tea
RUN apk add --no-cache tea
RUN git clone https://gitea.com/gitea/tea.git
RUN cd tea && make && make install
COPY --chown=jenkins:jenkins executors.groovy /usr/share/jenkins/ref/init.groovy.d/executors.groovy

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'
}
}
}
}
}

View File

@ -5,8 +5,7 @@ RUN addgroup --gid 281 docker
RUN addgroup jenkins docker
# Install tea
RUN git clone https://gitea.com/gitea/tea.git
RUN cd tea && make && make install
RUN apk add --no-cache tea
COPY --chown=jenkins:jenkins executors.groovy /usr/share/jenkins/ref/init.groovy.d/executors.groovy