Skip to content

Commit 62eb7be

Browse files
committed
[Build] Define Docker images build using Jenkin's Job-DSL
This just preserves the existing and currently manually maintained 'Build-Docker-images' job in a Jenkins Job-DSL script under version control.
1 parent 6e6a136 commit 62eb7be

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-0
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
pipeline {
2+
options {
3+
timeout(time: 2, unit: 'HOURS')
4+
buildDiscarder(logRotator(numToKeepStr:'5'))
5+
disableConcurrentBuilds(abortPrevious: true)
6+
timestamps()
7+
}
8+
agent {
9+
label 'docker-build'
10+
}
11+
stages {
12+
stage('Clean workspace') {
13+
steps {
14+
sh '''#!/bin/bash -x
15+
docker images
16+
docker system prune -a -f
17+
cd ${WORKSPACE}
18+
rm -rf *
19+
'''
20+
}
21+
}
22+
stage('Get Docker Files') {
23+
steps {
24+
sh '''
25+
git clone -b master https://github.com/eclipse-platform/eclipse.platform.releng.aggregator.git
26+
git clone -b master https://git.eclipse.org/r/jdt/eclipse.jdt.core.git
27+
'''
28+
}
29+
}
30+
stage('Build Docker Images') {
31+
steps {
32+
sh '''#!/bin/bash -x
33+
cd ${WORKSPACE}/eclipse.platform.releng.aggregator/cje-production/dockerfiles/
34+
chmod +x *.sh
35+
(./build-centos_8.sh|tee centos8.log)&
36+
(./build-centos_swt_build.sh|tee swt_build.log)&
37+
(./build-centos_9.sh|tee centos9.log)&
38+
(./build-centos_9_swt_build.sh|tee swt_9_build.log)&
39+
(./build-ubuntu-22.04.sh|tee ubuntu22.log)&
40+
(./build-openSuse-15.sh|tee opensuse_leap.log)&
41+
cd ${WORKSPACE}/eclipse.jdt.core/org.eclipse.jdt.core/docker/
42+
chmod +x *.sh
43+
(./build-ubuntu-jikespg.sh|tee ubuntuJikespg.log)&
44+
wait
45+
docker images
46+
'''
47+
}
48+
}
49+
stage('Push docker image') {
50+
steps {
51+
withDockerRegistry([credentialsId: 'docker.com-bot', url: '']) {
52+
sh '''#!/bin/bash -x
53+
cd ${WORKSPACE}/eclipse.platform.releng.aggregator/cje-production/dockerfiles/
54+
chmod +x *.sh
55+
(./push-centos_8.sh|tee push-centos8.log)&
56+
(./push-centos_swt_build.sh|tee push-swt_build.log)&
57+
(./push-centos_9.sh|tee push-centos9.log)&
58+
(./push-centos9_swt_build.sh|tee push-swt_9_build.log)&
59+
(./push-ubuntu-22.04.sh|tee push-ubuntu22.log)&
60+
(./push-opensuse-15.sh|tee push-opensuse_leap.log)&
61+
cd ${WORKSPACE}/eclipse.jdt.core/org.eclipse.jdt.core/docker/
62+
chmod +x *.sh
63+
(./push-ubuntu-jikespg.sh|tee push-ubuntuJikespg.log)&
64+
wait
65+
'''
66+
}
67+
}
68+
}
69+
stage('Clean Docker Images') {
70+
steps {
71+
sh '''#!/bin/bash -x
72+
docker images
73+
docker system prune -a -f
74+
docker images
75+
'''
76+
}
77+
}
78+
}
79+
post {
80+
success {
81+
emailext body: "Container images used for testing eclipse platform - Build Successful. Please go to ${BUILD_URL}console and check the log",
82+
subject: "Container images - Build Successful",
83+
84+
85+
}
86+
87+
unsuccessful {
88+
emailext body: "Container images used for testing eclipse platform - Build Unsuccessful. Please go to ${BUILD_URL}console and check the log",
89+
subject: "Container images - Build Unsuccessful",
90+
91+
92+
}
93+
94+
always {
95+
archiveArtifacts '**/*.log'
96+
}
97+
}
98+
}

JenkinsJobs/Builds/FOLDER.groovy

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
11
folder('Builds') {
22
description('Eclipse periodic build jobs.')
33
}
4+
5+
pipelineJob('Builds/Build-Docker-images'){
6+
description('Build and publish custom Docker images')
7+
properties {
8+
pipelineTriggers {
9+
triggers {
10+
cron {
11+
spec('''
12+
H 0 * * 2
13+
H 8 * * 4
14+
H 16 * * 6
15+
''')
16+
}
17+
}
18+
}
19+
}
20+
definition {
21+
cpsScm {
22+
lightweight(true)
23+
scm {
24+
github('eclipse-platform/eclipse.platform.releng.aggregator', 'master')
25+
}
26+
scriptPath('JenkinsJobs/Builds/DockerImagesBuild.jenkinsfile')
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)