Skip to content

Commit 261627b

Browse files
authored
Revive test suite on Linux (#330)
1 parent 1ee556b commit 261627b

File tree

5 files changed

+25
-24
lines changed

5 files changed

+25
-24
lines changed

Jenkinsfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
https://github.com/jenkins-infra/pipeline-library/
44
*/
55
buildPlugin(
6-
forkCount: '1C', // run this number of tests in parallel for faster feedback. If the number terminates with a 'C', the value will be multiplied by the number of available CPU cores
76
useContainerAgent: false, // Set to `false` if you need to use Docker for containerized tests
87
configurations: [
98
[platform: 'linux', jdk: 21],
10-
[platform: 'maven-17-windows', jdk: 17], // TODO Docker-based tests fail when using Docker on Windows. The maven-windows agents do not have Docker installed so tests that require Docker are skipped.
9+
[platform: 'linux', jdk: 17],
10+
// TODO Windows tests seem to be failing on temporary Windows CI infrastructure from https://github.com/jenkins-infra/helpdesk/issues/4490
11+
//[platform: 'maven-17-windows', jdk: 17], // TODO Docker-based tests fail when using Docker on Windows. The maven-windows agents do not have Docker installed so tests that require Docker are skipped.
1112
])

src/test/java/org/jenkinsci/plugins/docker/workflow/DockerDSLTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private static void grep(File dir, String text, String prefix, Set<String> match
113113
assumeDocker();
114114
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj");
115115
p.setDefinition(new CpsFlowDefinition(
116-
"def r = docker.image('httpd:2.4.59').inside {\n" +
116+
"def r = docker.image('httpd:2.4.62').inside {\n" +
117117
" semaphore 'wait'\n" +
118118
" sh 'cat /usr/local/apache2/conf/extra/httpd-userdir.conf'\n" +
119119
" 42\n" +
@@ -140,7 +140,7 @@ private static void grep(File dir, String text, String prefix, Set<String> match
140140
assumeDocker();
141141
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p");
142142
p.setDefinition(new CpsFlowDefinition(
143-
"docker.image('maven:3.5.3-jdk-8').inside {\n" +
143+
"docker.image('maven:3.9.9-eclipse-temurin-17').inside {\n" +
144144
" sh 'mvn -version'\n" +
145145
"}", true));
146146

@@ -185,7 +185,7 @@ private static void grep(File dir, String text, String prefix, Set<String> match
185185
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj");
186186
p.setDefinition(new CpsFlowDefinition(
187187
"node {\n" +
188-
" def img = docker.image('httpd:2.4.59')\n" +
188+
" def img = docker.image('httpd:2.4.62')\n" +
189189
" img.run().stop()\n" +
190190
" img.run('--memory-swap=-1').stop()\n" +
191191
" img.withRun {}\n" +
@@ -204,7 +204,7 @@ private static void grep(File dir, String text, String prefix, Set<String> match
204204
assumeDocker();
205205
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj");
206206
p.setDefinition(new CpsFlowDefinition(
207-
"def r = docker.image('httpd:2.4.59').withRun {c ->\n" +
207+
"def r = docker.image('httpd:2.4.62').withRun {c ->\n" +
208208
" semaphore 'wait'\n" +
209209
" sh \"docker exec ${c.id} cat /usr/local/apache2/conf/extra/httpd-userdir.conf\"\n" +
210210
" 42\n" +
@@ -230,7 +230,7 @@ private static void grep(File dir, String text, String prefix, Set<String> match
230230
assumeDocker();
231231
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj");
232232
p.setDefinition(new CpsFlowDefinition(
233-
" docker.image('maven:3.3.9-jdk-8').withRun(\"--entrypoint mvn\", \"-version\") {c ->\n" +
233+
" docker.image('maven:3.9.9-eclipse-temurin-17').withRun(\"--entrypoint mvn\", \"-version\") {c ->\n" +
234234
" sh \"docker logs ${c.id}\"" +
235235
"}", true));
236236
story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
@@ -346,7 +346,7 @@ private static void grep(File dir, String text, String prefix, Set<String> match
346346
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj");
347347
p.setDefinition(new CpsFlowDefinition(
348348
"docker.withTool('default') {\n" +
349-
" docker.image('httpd:2.4.59').withRun {}\n" +
349+
" docker.image('httpd:2.4.62').withRun {}\n" +
350350
" sh 'echo PATH=$PATH'\n" +
351351
"}", true));
352352
story.j.assertLogContains("PATH=/usr/bin:", story.j.assertBuildStatusSuccess(p.scheduleBuild2(0)));
@@ -437,7 +437,7 @@ private static void grep(File dir, String text, String prefix, Set<String> match
437437
WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj");
438438
p.setDefinition(new CpsFlowDefinition(
439439
"node {\n" +
440-
" def img = docker.image('httpd:2.4.59')\n" +
440+
" def img = docker.image('httpd:2.4.62')\n" +
441441
" def port = img.withRun('-p 12345:80') { c -> c.port(80) }\n" +
442442
" echo \"container running on ${port}\"" +
443443
"}", true));

src/test/java/org/jenkinsci/plugins/docker/workflow/declarative/DockerAgentTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public void nonExistentDockerImage() throws Exception {
167167
public void fromDockerfile() throws Exception {
168168
DockerTestUtil.assumeDocker();
169169

170-
sampleRepo.write("Dockerfile", "FROM ubuntu:14.04\n\nRUN echo 'HI THERE' > /hi-there\n\n");
170+
sampleRepo.write("Dockerfile", "FROM ubuntu:noble\n\nRUN echo 'HI THERE' > /hi-there\n\n");
171171
sampleRepo.git("init");
172172
sampleRepo.git("add", "Dockerfile");
173173
sampleRepo.git("commit", "--message=Dockerfile");
@@ -185,7 +185,7 @@ public void fromDockerfile() throws Exception {
185185
public void userHandbookDockerfile() throws Exception {
186186
DockerTestUtil.assumeDocker();
187187

188-
sampleRepo.write("Dockerfile", "FROM node:16.13.1-alpine\nRUN apk add -U subversion\n");
188+
sampleRepo.write("Dockerfile", "FROM node:22.13.0-alpine\nRUN apk add -U subversion\n");
189189
sampleRepo.git("init");
190190
sampleRepo.git("add", "Dockerfile");
191191
sampleRepo.git("commit", "--message=Dockerfile");
@@ -200,7 +200,7 @@ public void userHandbookDockerfile() throws Exception {
200200
public void additionalDockerBuildArgs() throws Exception {
201201
DockerTestUtil.assumeDocker();
202202

203-
sampleRepo.write("Dockerfile", "FROM ubuntu:14.04\n\nARG someArg=thisArgHere\n\nRUN echo \"hi there, $someArg\" > /hi-there\n\n");
203+
sampleRepo.write("Dockerfile", "FROM ubuntu:noble\n\nARG someArg=thisArgHere\n\nRUN echo \"hi there, $someArg\" > /hi-there\n\n");
204204
sampleRepo.git("init");
205205
sampleRepo.git("add", "Dockerfile");
206206
sampleRepo.git("commit", "--message=Dockerfile");
@@ -219,7 +219,7 @@ public void additionalDockerBuildArgs() throws Exception {
219219
public void additionalDockerBuildArgsImageHash() throws Exception {
220220
DockerTestUtil.assumeDocker();
221221

222-
sampleRepo.write("Dockerfile", "FROM ubuntu:14.04\n\nARG someArg=thisArgHere\n\nRUN echo \"hi there, $someArg\" > /hi-there\n\n");
222+
sampleRepo.write("Dockerfile", "FROM ubuntu:noble\n\nARG someArg=thisArgHere\n\nRUN echo \"hi there, $someArg\" > /hi-there\n\n");
223223
sampleRepo.git("init");
224224
sampleRepo.git("add", "Dockerfile");
225225
sampleRepo.git("commit", "--message=Dockerfile");
@@ -230,11 +230,11 @@ public void additionalDockerBuildArgsImageHash() throws Exception {
230230
.withProjectName("parallelImageHashTest")
231231
.logContains("[Pipeline] { (foo)",
232232
"-v /tmp:/tmp",
233-
"docker build -t 8343c0815beb7a50c3676f09d7175d903a57f11b --build-arg someArg=thisOtherArg",
233+
"docker build -t 02a5b681aa9d457d1a8ebf2d61f4af0061dad300 --build-arg someArg=thisOtherArg",
234234
"The answer is 42",
235235
"hi there, thisOtherArg",
236236
"[Pipeline] { (bar)",
237-
"docker build -t 4f8d74de557925eb9aacdfdf671b5e9de11b6086 --build-arg someArg=thisDifferentArg",
237+
"docker build -t 36193f504228c0f319bb867146b391dd8e04aec6 --build-arg someArg=thisDifferentArg",
238238
"The answer is 43",
239239
"hi there, thisDifferentArg")
240240
.logNotContains("hi there, thisArgHere")
@@ -246,7 +246,7 @@ public void additionalDockerBuildArgsImageHash() throws Exception {
246246
public void fromDockerfileInOtherDir() throws Exception {
247247
DockerTestUtil.assumeDocker();
248248

249-
sampleRepo.write("subdir/Dockerfile", "FROM ubuntu:14.04\n\nRUN echo 'HI THERE' > /hi-there\n\n");
249+
sampleRepo.write("subdir/Dockerfile", "FROM ubuntu:noble\n\nRUN echo 'HI THERE' > /hi-there\n\n");
250250
sampleRepo.git("init");
251251
sampleRepo.git("add", "subdir/Dockerfile");
252252
sampleRepo.git("commit", "--message=Dockerfile");
@@ -264,7 +264,7 @@ public void fromDockerfileInOtherDir() throws Exception {
264264
public void dirSepInDockerfileName() throws Exception {
265265
DockerTestUtil.assumeDocker();
266266

267-
sampleRepo.write("subdir/Dockerfile", "FROM ubuntu:14.04\n\nRUN echo 'HI THERE' > /hi-there\n\n");
267+
sampleRepo.write("subdir/Dockerfile", "FROM ubuntu:noble\n\nRUN echo 'HI THERE' > /hi-there\n\n");
268268
sampleRepo.git("init");
269269
sampleRepo.git("add", "subdir/Dockerfile");
270270
sampleRepo.git("commit", "--message=Dockerfile");
@@ -281,7 +281,7 @@ public void dirSepInDockerfileName() throws Exception {
281281
public void fromDockerfileNoArgs() throws Exception {
282282
DockerTestUtil.assumeDocker();
283283

284-
sampleRepo.write("Dockerfile", "FROM ubuntu:14.04\n\nRUN echo 'HI THERE' > /hi-there\n\n");
284+
sampleRepo.write("Dockerfile", "FROM ubuntu:noble\n\nRUN echo 'HI THERE' > /hi-there\n\n");
285285
sampleRepo.git("init");
286286
sampleRepo.git("add", "Dockerfile");
287287
sampleRepo.git("commit", "--message=Dockerfile");
@@ -296,7 +296,7 @@ public void fromDockerfileNoArgs() throws Exception {
296296
@Test
297297
public void fromAlternateDockerfile() throws Exception {
298298
DockerTestUtil.assumeDocker();
299-
sampleRepo.write("Dockerfile.alternate", "FROM ubuntu:14.04\n\nRUN echo 'HI THERE' > /hi-there\n\n");
299+
sampleRepo.write("Dockerfile.alternate", "FROM ubuntu:noble\n\nRUN echo 'HI THERE' > /hi-there\n\n");
300300
sampleRepo.git("init");
301301
sampleRepo.git("add", "Dockerfile.alternate");
302302
sampleRepo.git("commit", "--message=Dockerfile");
@@ -326,7 +326,7 @@ public void agentDockerGlobalThenLabel() throws Exception {
326326
public void dockerPullLocalImage() throws Exception {
327327
DockerTestUtil.assumeDocker();
328328

329-
sampleRepo.write("Dockerfile", "FROM ubuntu:14.04\n\nRUN echo 'HI THERE' > /hi-there\n\n");
329+
sampleRepo.write("Dockerfile", "FROM ubuntu:noble\n\nRUN echo 'HI THERE' > /hi-there\n\n");
330330
sampleRepo.git("init");
331331
sampleRepo.git("add", "Dockerfile");
332332
sampleRepo.git("commit", "--message=Dockerfile");

src/test/resources/org/jenkinsci/plugins/docker/workflow/declarative/agentDockerGlobalThenLabel.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
pipeline {
3030
agent {
3131
docker {
32-
image 'maven:3.5.0-jdk-8-alpine'
32+
image 'maven:3.9.9-eclipse-temurin-17-alpine'
3333
label 'docker'
3434
}
3535
}

src/test/resources/org/jenkinsci/plugins/docker/workflow/declarative/dockerPullLocalImage.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ pipeline {
2727
stages {
2828
stage("build image") {
2929
steps {
30-
sh 'docker build -t maven:3-jdk-8-slim .'
30+
sh 'docker build -t maven:3-eclipse-temurin-17-alpine .'
3131
}
3232
}
3333
stage("in built image") {
3434
agent {
3535
docker {
36-
image "maven:3-jdk-8-slim"
36+
image "maven:3-eclipse-temurin-17-alpine"
3737
args "-v /tmp:/tmp"
3838
reuseNode true
3939
}
@@ -46,7 +46,7 @@ pipeline {
4646
stage("in pulled image") {
4747
agent {
4848
docker {
49-
image "maven:3-jdk-8-slim"
49+
image "maven:3-eclipse-temurin-17-alpine"
5050
alwaysPull true
5151
}
5252
}

0 commit comments

Comments
 (0)