Skip to content

Commit 2f91e81

Browse files
committed
[Build] Simplify and clean-up Docker image build
- Inline bash-scripts to build and push docker-images - Just delete those scripts that are not used - Remove push of images that are not built (anymore)
1 parent 4e3b63f commit 2f91e81

File tree

9 files changed

+27
-189
lines changed

9 files changed

+27
-189
lines changed

JenkinsJobs/Builds/DockerImagesBuild.jenkinsfile

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,44 +21,28 @@ pipeline {
2121
'''
2222
}
2323
}
24-
stage('Build Docker Images') {
24+
stage('Build and push Docker Images') {
2525
steps {
26-
sh '''#!/bin/bash -x
27-
cd ${WORKSPACE}/eclipse.platform.releng.aggregator/cje-production/dockerfiles/
28-
chmod +x *.sh
29-
(./build-centos_9.sh|tee centos9.log)&
30-
(./build-centos_9_swt_build.sh|tee swt_9_build.log)&
31-
(./build-ubuntu-22.04.sh|tee ubuntu22.log)&
32-
(./build-openSuse-15.sh|tee opensuse_leap.log)&
33-
cd ${WORKSPACE}/eclipse.jdt.core/org.eclipse.jdt.core/docker/
34-
chmod +x *.sh
35-
(./build-ubuntu-jikespg.sh|tee ubuntuJikespg.log)&
36-
wait
37-
docker images
38-
'''
39-
}
40-
}
41-
stage('Push docker image') {
42-
steps {
43-
withDockerRegistry([credentialsId: 'docker.com-bot', url: '']) {
44-
sh '''#!/bin/bash -x
45-
cd ${WORKSPACE}/eclipse.platform.releng.aggregator/cje-production/dockerfiles/
46-
chmod +x *.sh
47-
(./push-centos_9.sh|tee push-centos9.log)&
48-
(./push-centos9_swt_build.sh|tee push-swt_9_build.log)&
49-
(./push-ubuntu-22.04.sh|tee push-ubuntu22.log)&
50-
(./push-opensuse-15.sh|tee push-opensuse_leap.log)&
51-
cd ${WORKSPACE}/eclipse.jdt.core/org.eclipse.jdt.core/docker/
52-
chmod +x *.sh
53-
(./push-ubuntu-jikespg.sh|tee push-ubuntuJikespg.log)&
54-
wait
55-
'''
26+
script {
27+
dir('eclipse.platform.releng.aggregator/cje-production/dockerfiles') {
28+
parallel(
29+
'centos9-gtk4': { buildAndPushImage('centos-gtk4-mutter/9-gtk4', 'eclipse/platformreleng-centos-gtk4-mutter:9') },
30+
'centos9-gtk4-swt': { buildAndPushImage('centos-gtk4-mutter/9-swtBuild', 'eclipse/platformreleng-centos-swt-build:9') },
31+
'ubuntu-gtk3': { buildAndPushImage('ubuntu-gtk3-metacity/22.04-gtk3', 'eclipse/platformreleng-ubuntu-gtk3-metacity:22.04') },
32+
'opensuse-gtk3': { buildAndPushImage('opensuse-gtk3-metacity/15-gtk3', 'eclipse/platformreleng-opensuse-gtk3-metacity:15') },
33+
failFast: false)
34+
}
35+
dir('eclipse.jdt.core/org.eclipse.jdt.core/docker') {
36+
parallel(
37+
'jikespg': { buildAndPushImage('jikespg', 'eclipse/platformreleng-ubuntu-gtk3-metacity:jikespg') },
38+
failFast: false)
39+
}
5640
}
5741
}
5842
}
5943
stage('Clean Docker Images') {
6044
steps {
61-
sh '''#!/bin/bash -x
45+
sh '''
6246
docker images
6347
docker system prune -a -f
6448
docker images
@@ -74,8 +58,18 @@ pipeline {
7458
7559
}
7660
always {
77-
archiveArtifacts '**/*.log'
7861
cleanWs()
7962
}
8063
}
8164
}
65+
66+
def buildAndPushImage(directory, imageId) {
67+
withDockerRegistry([credentialsId: 'docker.com-bot', url: '']) {
68+
sh """
69+
pushd ${directory}
70+
docker build --pull -t ${imageId} .
71+
docker push ${imageId}
72+
popd
73+
"""
74+
}
75+
}

cje-production/dockerfiles/build-centos_9.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

cje-production/dockerfiles/build-centos_9_swt_build.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

cje-production/dockerfiles/build-openSuse-15.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

cje-production/dockerfiles/build-ubuntu-22.04.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

cje-production/dockerfiles/push-centos9_swt_build.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

cje-production/dockerfiles/push-centos_9.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

cje-production/dockerfiles/push-opensuse-15.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

cje-production/dockerfiles/push-ubuntu-22.04.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)