Skip to content

Commit 1d7f91b

Browse files
authored
Merge pull request #484 from jmtd/OPENJDK-2824-binary-rsync-ubi8
[OPENJDK-2824] assemble: binary: Don't set times on directories (UBI8)
2 parents 682cb1e + 347382c commit 1d7f91b

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

modules/s2i/bash/artifacts/opt/jboss/container/java/s2i/maven-s2i-overrides

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ function maven_s2i_custom_binary_build() {
2828
binary_dir="${S2I_SOURCE_DIR}"
2929
fi
3030
log_info "Copying binaries from ${binary_dir} to ${S2I_TARGET_DEPLOYMENTS_DIR} ..."
31-
rsync --archive --out-format='%n' "${binary_dir}"/ "${S2I_TARGET_DEPLOYMENTS_DIR}"
31+
32+
( # OPENJDK-2850: use glob (dotglob to match hidden files) to stop rsync altering
33+
# timestamps of S2I_TARGET_DEPLOYMENTS_DIR. Don't alter parent shell's dotglob.
34+
shopt -s dotglob
35+
rsync --archive --out-format='%n' "${binary_dir}"/* "${S2I_TARGET_DEPLOYMENTS_DIR}"
36+
)
3237
}
3338

3439
function maven_s2i_deploy_artifacts_override() {

modules/s2i/core/api/tests/features/s2i-core.feature

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,14 @@ Feature: Openshift S2I tests
77
Scenario: run an s2i build and check that /tmp/src has been removed afterwards
88
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple
99
Then run stat /tmp/src in container and immediately check its output does not contain File:
10+
11+
# OPENJDK-2824 - ensure binary-only s2i doesn't try to change timestamps of
12+
# S2I_TARGET_DEPLOYMENTS_DIR. Use /var/tmp as a directory where attempting to
13+
# will fail. This simulates the s2i process running as a random UID, which can't
14+
# change timestamps on the default directory, /deployments.
15+
Scenario: Ensure binary-only build doesn't fail trying to set timestamp of S2I_TARGET_DEPLOYMENTS_DIR (OPENJDK-2850)
16+
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from OPENJDK-2408-bin-custom-s2i-assemble with env
17+
| variable | value |
18+
| S2I_TARGET_DEPLOYMENTS_DIR | /var/tmp |
19+
Then s2i build log should not contain rsync: [generator] failed to set permissions on "/var/tmp/.": Operation not permitted
20+
And run stat /var/tmp/spring-boot-sample-simple-1.5.0.BUILD-SNAPSHOT.jar in container and check its output for Access:

0 commit comments

Comments
 (0)