Skip to content

Commit

Permalink
[Build] Simplify and clean-up Docker image build
Browse files Browse the repository at this point in the history
- Don't send mails on success only on failure and only to the
mailing-list and not specific people
- Delete complete workspace content after the build
- Update to jdt.core git repository at Github
- Inline bash-scripts to build and push docker-images
  - Just delete thos scripts that are not used
  - Remove push of images that are not built (anymore)
  • Loading branch information
HannesWell committed Aug 28, 2024
1 parent c359e17 commit d284d5c
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 197 deletions.
90 changes: 49 additions & 41 deletions JenkinsJobs/Builds/DockerImagesBuild.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -32,54 +32,69 @@ pipeline {
stages {
stage('Clean workspace') {
steps {
sh \'''#!/bin/bash -x
docker images
docker system prune -a -f
cd ${WORKSPACE}
rm -rf *
\'''
cleanWs()
}
}
stage('Get Docker Files') {
steps {
sh \'''
git clone -b master https://github.com/eclipse-platform/eclipse.platform.releng.aggregator.git
git clone -b master https://git.eclipse.org/r/jdt/eclipse.jdt.core.git
git clone -b master https://github.com/eclipse-jdt/eclipse.jdt.core
\'''
}
}
stage('Build Docker Images') {
steps {
sh \'''#!/bin/bash -x
cd ${WORKSPACE}/eclipse.platform.releng.aggregator/cje-production/dockerfiles/
chmod +x *.sh
(./build-centos_9.sh|tee centos9.log)&
(./build-centos_9_swt_build.sh|tee swt_9_build.log)&
(./build-ubuntu-22.04.sh|tee ubuntu22.log)&
(./build-openSuse-15.sh|tee opensuse_leap.log)&
cd ${WORKSPACE}/eclipse.jdt.core/org.eclipse.jdt.core/docker/
chmod +x *.sh
(./build-ubuntu-jikespg.sh|tee ubuntuJikespg.log)&
wait
docker images
\'''
dir('eclipse.platform.releng.aggregator/cje-production/dockerfiles') {
sh \'''
(cd centos-gtk4-mutter/9-gtk4 && \
echo "Building Centos 9 docker image" && \
docker build --pull -t eclipse/platformreleng-centos-gtk4-mutter:9 . \
|tee centos9.log)&
(cd centos-gtk4-mutter/9-swtBuild && \
echo "Building Centos 9 swt build image" && \
docker build --pull -t eclipse/platformreleng-centos-swt-build:9 . \
|tee swt_9_build.log)&
(cd ubuntu-gtk3-metacity/22.04-gtk3 && \
echo "Building Ubuntu 22.04 docker image" && \
docker build --pull -t eclipse/platformreleng-ubuntu-gtk3-metacity:22.04 . \
|tee ubuntu22.log)&
(cd opensuse-gtk3-metacity/15-gtk3 && \
echo "Building Opensuse Leap 15 docker image" && \
docker build --pull -t eclipse/platformreleng-opensuse-gtk3-metacity:15 . \
|tee opensuse_leap.log)&
wait
\'''
}
dir('eclipse.jdt.core/org.eclipse.jdt.core/docker') {
sh \'''
chmod +x *.sh
(./build-ubuntu-jikespg.sh|tee ubuntuJikespg.log)&
wait
\'''
}
sh 'docker images'
}
}
stage('Push docker image') {
steps {
withDockerRegistry([credentialsId: 'docker.com-bot', url: '']) {
sh \'''#!/bin/bash -x
cd ${WORKSPACE}/eclipse.platform.releng.aggregator/cje-production/dockerfiles/
chmod +x *.sh
(./push-centos_9.sh|tee push-centos9.log)&
(./push-centos9_swt_build.sh|tee push-swt_9_build.log)&
(./push-ubuntu-22.04.sh|tee push-ubuntu22.log)&
(./push-opensuse-15.sh|tee push-opensuse_leap.log)&
cd ${WORKSPACE}/eclipse.jdt.core/org.eclipse.jdt.core/docker/
chmod +x *.sh
(./push-ubuntu-jikespg.sh|tee push-ubuntuJikespg.log)&
wait
\'''
dir('eclipse.platform.releng.aggregator/cje-production/dockerfiles') {
sh \'''
(docker push eclipse/platformreleng-centos-gtk4-mutter:9|tee centos9.log)&
(docker push eclipse/platformreleng-centos-swt-build:9|tee push-swt_9_build.log)&
(docker push eclipse/platformreleng-opensuse-gtk3-metacity:15|tee push-ubuntu22.log)&
(docker push eclipse/platformreleng-ubuntu-gtk3-metacity:22.04|tee push-opensuse_leap.log)&
wait
\'''
}
dir('eclipse.jdt.core/org.eclipse.jdt.core/docker') {
sh \'''
chmod +x *.sh
(./push-ubuntu-jikespg.sh|tee push-ubuntuJikespg.log)&
wait
\'''
}
}
}
}
Expand All @@ -94,22 +109,15 @@ pipeline {
}
}
post {
success {
emailext body: "Container images used for testing eclipse platform - Build Successful. Please go to ${BUILD_URL}console and check the log",
subject: "Container images - Build Successful",
to: "[email protected] [email protected] [email protected] [email protected] [email protected]",
from:"[email protected]"
}
unsuccessful {
emailext body: "Container images used for testing eclipse platform - Build Unsuccessful. Please go to ${BUILD_URL}console and check the log",
subject: "Container images - Build Unsuccessful",
to: "[email protected] [email protected] [email protected] [email protected] [email protected]",
to: "[email protected]",
from:"[email protected]"
}
always {
archiveArtifacts '**/*.log'
cleanWs()
}
}
}
Expand Down
21 changes: 0 additions & 21 deletions cje-production/dockerfiles/build-centos_9.sh

This file was deleted.

21 changes: 0 additions & 21 deletions cje-production/dockerfiles/build-centos_9_swt_build.sh

This file was deleted.

21 changes: 0 additions & 21 deletions cje-production/dockerfiles/build-openSuse-15.sh

This file was deleted.

21 changes: 0 additions & 21 deletions cje-production/dockerfiles/build-ubuntu-22.04.sh

This file was deleted.

18 changes: 0 additions & 18 deletions cje-production/dockerfiles/push-centos9_swt_build.sh

This file was deleted.

18 changes: 0 additions & 18 deletions cje-production/dockerfiles/push-centos_9.sh

This file was deleted.

18 changes: 0 additions & 18 deletions cje-production/dockerfiles/push-opensuse-15.sh

This file was deleted.

18 changes: 0 additions & 18 deletions cje-production/dockerfiles/push-ubuntu-22.04.sh

This file was deleted.

0 comments on commit d284d5c

Please sign in to comment.