Skip to content

Commit

Permalink
[DL3059] Multiple consecutive RUN instructions (#1390)
Browse files Browse the repository at this point in the history
* [DL3059] Multiple consecutive `RUN` instructions

* Fix tests on Windows

Co-authored-by: Mark Waite <[email protected]>
  • Loading branch information
basil and MarkEWaite authored Jun 25, 2022
1 parent 8ca2691 commit a9de6b9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
1 change: 0 additions & 1 deletion .hadolint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 2 additions & 2 deletions 17/alpine/hotspot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
15 changes: 6 additions & 9 deletions tests/plugins-cli/custom-war/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions tests/plugins-cli/custom-war/Dockerfile-windows
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions tests/plugins-cli/no-war/Dockerfile-windows
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a9de6b9

Please sign in to comment.