Skip to content

Commit 9b9d2d2

Browse files
authored
Merge pull request #411 from jmtd/OPENJDK-2408-rsync-preserve
[OPENJDK-2408] s2i: use --archive flag for rsync
2 parents f76f097 + 37a2530 commit 9b9d2d2

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function maven_s2i_custom_binary_build() {
2929
binary_dir="${S2I_SOURCE_DIR}"
3030
fi
3131
log_info "Copying binaries from ${binary_dir} to ${S2I_TARGET_DEPLOYMENTS_DIR} ..."
32-
rsync -rl --out-format='%n' "${binary_dir}"/ "${S2I_TARGET_DEPLOYMENTS_DIR}"
32+
rsync --archive --out-format='%n' "${binary_dir}"/ "${S2I_TARGET_DEPLOYMENTS_DIR}"
3333
}
3434

3535
function maven_s2i_deploy_artifacts_override() {

modules/s2i/core/artifacts/opt/jboss/container/s2i/core/s2i-core

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function s2i_core_copy_configuration() {
5353
mkdir -pm 775 "${S2I_TARGET_CONFIGURATION_DIR}"
5454
fi
5555
log_info "Copying configuration from $(realpath --relative-to ${S2I_SOURCE_DIR} ${1}/${S2I_SOURCE_CONFIGURATION_DIR}) to ${S2I_TARGET_CONFIGURATION_DIR}..."
56-
rsync -rl --out-format='%n' "${1}/${S2I_SOURCE_CONFIGURATION_DIR}"/ "${S2I_TARGET_CONFIGURATION_DIR}"
56+
rsync --archive --out-format='%n' "${1}/${S2I_SOURCE_CONFIGURATION_DIR}"/ "${S2I_TARGET_CONFIGURATION_DIR}"
5757
fi
5858
fi
5959
}
@@ -70,7 +70,7 @@ function s2i_core_copy_data() {
7070
mkdir -pm 775 "${S2I_TARGET_DATA_DIR}"
7171
fi
7272
log_info "Copying app data from $(realpath --relative-to ${S2I_SOURCE_DIR} ${1}/${S2I_SOURCE_DATA_DIR}) to ${S2I_TARGET_DATA_DIR}..."
73-
rsync -rl --out-format='%n' "${1}/${S2I_SOURCE_DATA_DIR}"/ "${S2I_TARGET_DATA_DIR}"
73+
rsync --archive --out-format='%n' "${1}/${S2I_SOURCE_DATA_DIR}"/ "${S2I_TARGET_DATA_DIR}"
7474
# s2i used to be more forgiving, but the build will fail if this call
7575
# fails. emit a warning and allow the build to succeed
7676
chmod -R g+rwX "${S2I_TARGET_DATA_DIR}" || log_warning "Errors occurred while adding read/write permissions to S2I_TARGET_DATA_DIR ($S2I_TARGET_DATA_DIR)."

tests/features/java/java_s2i.feature

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,9 @@ Feature: Openshift OpenJDK S2I tests
179179
| S2I_SOURCE_DATA_DIR | ./ |
180180
| S2I_TARGET_DATA_DIR | /deployments |
181181
Then container log should contain INFO exec -a "someUniqueString" java
182+
183+
Scenario: Ensure mtime is preserved for build artifacts (OPENJDK-2408)
184+
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from OPENJDK-2408-bin-custom-s2i-assemble with env
185+
| variable | value |
186+
| S2I_DELETE_SOURCE | false |
187+
Then run find /deployments/spring-boot-sample-simple-1.5.0.BUILD-SNAPSHOT.jar ! -newer /tmp/src/spring-boot-sample-simple-1.5.0.BUILD-SNAPSHOT.jar in container and check its output for spring-boot-sample-simple-1.5.0.BUILD-SNAPSHOT.jar

0 commit comments

Comments
 (0)