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 RUN usermod -aG docker jenkins
# Install tea # 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 COPY --chown=jenkins:jenkins executors.groovy /usr/share/jenkins/ref/init.groovy.d/executors.groovy

55
Jenkinsfile vendored
View File

@ -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,30 +20,34 @@ 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('Default Image') { stage('Build & Push') {
stages { parallel {
stage('Build') { stage('Default Image') {
steps { stages {
sh 'docker build -t fah16145/good-old-jenkins:latest .' 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') { stage('Alpine Image') {
steps { stages {
sh 'docker push fah16145/good-old-jenkins:latest' stage('Build Alpine Image') {
} steps {
} sh 'docker build -t fah16145/good-old-jenkins:alpine alpine/'
} }
} }
stage('Alpine Image') { stage('Push Alpine Image') {
stages { steps {
stage('Build') { sh 'docker push fah16145/good-old-jenkins:alpine'
steps { }
sh 'docker build -t fah16145/good-old-jenkins:alpine alpine/' }
}
}
stage('Push') {
steps {
sh 'docker push fah16145/good-old-jenkins:alpine'
} }
} }
} }

View File

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