From a9de6b9fb3a0601e51321bc0ea8c7638db2bf88f Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Sat, 25 Jun 2022 14:48:31 -0700 Subject: [PATCH] [DL3059] Multiple consecutive `RUN` instructions (#1390) * [DL3059] Multiple consecutive `RUN` instructions * Fix tests on Windows Co-authored-by: Mark Waite --- .hadolint.yml | 1 - 17/alpine/hotspot/Dockerfile | 4 ++-- tests/plugins-cli/custom-war/Dockerfile | 15 ++++++--------- tests/plugins-cli/custom-war/Dockerfile-windows | 2 ++ tests/plugins-cli/no-war/Dockerfile-windows | 1 + 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.hadolint.yml b/.hadolint.yml index 7d328ce424..eaaf3ab40b 100644 --- a/.hadolint.yml +++ b/.hadolint.yml @@ -18,4 +18,3 @@ ignored: # - If it is not a false positive, fix the bug, then remove the exclusion from # this section. - DL3006 # Always tag the version of an image explicitly - - DL3059 # Multiple consecutive `RUN` instructions. Consider consolidation. diff --git a/17/alpine/hotspot/Dockerfile b/17/alpine/hotspot/Dockerfile index 2cbca3fa6d..8272070c9f 100644 --- a/17/alpine/hotspot/Dockerfile +++ b/17/alpine/hotspot/Dockerfile @@ -3,8 +3,8 @@ FROM eclipse-temurin:17.0.3_7-jdk-alpine AS jre-build # Generate smaller java runtime without unneeded files # for now we include the full module path to maintain compatibility # while still saving space (approx 200mb from the full distribution) -RUN apk add --no-cache binutils -RUN jlink \ +RUN apk add --no-cache binutils \ + && jlink \ --add-modules ALL-MODULE-PATH \ --strip-debug \ --no-man-pages \ diff --git a/tests/plugins-cli/custom-war/Dockerfile b/tests/plugins-cli/custom-war/Dockerfile index f52026c4f9..a35e06d3f3 100644 --- a/tests/plugins-cli/custom-war/Dockerfile +++ b/tests/plugins-cli/custom-war/Dockerfile @@ -10,12 +10,9 @@ USER root RUN chown jenkins:jenkins /test-custom-dockerfile USER jenkins -# Copy the original jenkins.war to the custom location -RUN cp /usr/share/jenkins/jenkins.war $JENKINS_WAR && \ - chown jenkins:jenkins $JENKINS_WAR - -# Add the weird plugin to the new custom war -RUN jar -uf my-custom-jenkins.war WEB-INF/* - -# Run the jenkins-plugin-cli script -RUN jenkins-plugin-cli --war $JENKINS_WAR --plugins junit:1.6 +# Copy the original jenkins.war to the custom location, add the weird plugin to +# the new custom WAR, and run the jenkins-plugin-cli script. +RUN cp /usr/share/jenkins/jenkins.war $JENKINS_WAR \ + && chown jenkins:jenkins $JENKINS_WAR \ + && jar -uf my-custom-jenkins.war WEB-INF/* \ + && jenkins-plugin-cli --war $JENKINS_WAR --plugins junit:1.6 diff --git a/tests/plugins-cli/custom-war/Dockerfile-windows b/tests/plugins-cli/custom-war/Dockerfile-windows index d42ac47e71..f7c34d3fc9 100644 --- a/tests/plugins-cli/custom-war/Dockerfile-windows +++ b/tests/plugins-cli/custom-war/Dockerfile-windows @@ -11,7 +11,9 @@ COPY WEB-INF/ WEB-INF/ RUN Copy-Item C:/ProgramData/Jenkins/jenkins.war $env:JENKINS_WAR # Add the weird plugin to the new custom war +# hadolint ignore=DL3059 RUN jar -uf my-custom-jenkins.war WEB-INF/* # Run the jenkins-plugin-cli script +# hadolint ignore=DL3059 RUN C:/ProgramData/Jenkins/jenkins-plugin-cli.ps1 --war $env:JENKINS_WAR --plugins junit:1.6 diff --git a/tests/plugins-cli/no-war/Dockerfile-windows b/tests/plugins-cli/no-war/Dockerfile-windows index 413e446aaa..50faeb3ed5 100644 --- a/tests/plugins-cli/no-war/Dockerfile-windows +++ b/tests/plugins-cli/no-war/Dockerfile-windows @@ -3,4 +3,5 @@ FROM bats-jenkins COPY plugins.txt C:/ProgramData/Jenkins/Reference/plugins.txt RUN Remove-Item -Force C:/ProgramData/Jenkins/jenkins.war +# hadolint ignore=DL3059 RUN C:/ProgramData/Jenkins/jenkins-plugin-cli.ps1 -f C:/ProgramData/Jenkins/Reference/plugins.txt