Skip to content

Commit

Permalink
Merge pull request #484 from jmtd/OPENJDK-2824-binary-rsync-ubi8
Browse files Browse the repository at this point in the history
[OPENJDK-2824] assemble: binary: Don't set times on directories (UBI8)
  • Loading branch information
jmtd authored Apr 15, 2024
2 parents 682cb1e + 347382c commit 1d7f91b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ function maven_s2i_custom_binary_build() {
binary_dir="${S2I_SOURCE_DIR}"
fi
log_info "Copying binaries from ${binary_dir} to ${S2I_TARGET_DEPLOYMENTS_DIR} ..."
rsync --archive --out-format='%n' "${binary_dir}"/ "${S2I_TARGET_DEPLOYMENTS_DIR}"

( # OPENJDK-2850: use glob (dotglob to match hidden files) to stop rsync altering
# timestamps of S2I_TARGET_DEPLOYMENTS_DIR. Don't alter parent shell's dotglob.
shopt -s dotglob
rsync --archive --out-format='%n' "${binary_dir}"/* "${S2I_TARGET_DEPLOYMENTS_DIR}"
)
}

function maven_s2i_deploy_artifacts_override() {
Expand Down
11 changes: 11 additions & 0 deletions modules/s2i/core/api/tests/features/s2i-core.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,14 @@ Feature: Openshift S2I tests
Scenario: run an s2i build and check that /tmp/src has been removed afterwards
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple
Then run stat /tmp/src in container and immediately check its output does not contain File:

# OPENJDK-2824 - ensure binary-only s2i doesn't try to change timestamps of
# S2I_TARGET_DEPLOYMENTS_DIR. Use /var/tmp as a directory where attempting to
# will fail. This simulates the s2i process running as a random UID, which can't
# change timestamps on the default directory, /deployments.
Scenario: Ensure binary-only build doesn't fail trying to set timestamp of S2I_TARGET_DEPLOYMENTS_DIR (OPENJDK-2850)
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from OPENJDK-2408-bin-custom-s2i-assemble with env
| variable | value |
| S2I_TARGET_DEPLOYMENTS_DIR | /var/tmp |
Then s2i build log should not contain rsync: [generator] failed to set permissions on "/var/tmp/.": Operation not permitted
And run stat /var/tmp/spring-boot-sample-simple-1.5.0.BUILD-SNAPSHOT.jar in container and check its output for Access:

0 comments on commit 1d7f91b

Please sign in to comment.