Skip to content

Commit 780fe85

Browse files
authored
Merge pull request #208 from jmtd/cloud-3977-delete-source
[CLOUD-3977] Deleting src dir after s2i breaks WildFly image with ODO
2 parents 7721744 + f104317 commit 780fe85

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

modules/s2i/core/api/module.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,15 @@ envs:
9595

9696
- name: S2I_ENABLE_INCREMENTAL_BUILDS
9797
description: ^
98-
Do not remove source and intermediate build files so they can be saved for
98+
Do not remove intermediate build files so they can be saved for
9999
use with future builds. Defaults to true.
100100
example: "true"
101101

102+
- name: S2I_DELETE_SOURCE
103+
description: ^
104+
Delete source files at the end of build. Defaults to true.
105+
example: "false"
106+
102107
# deprecated
103108
- name: APP_DATADIR
104109
description: Deprecated by **S2I_SOURCE_DATA_DIR**.

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ function s2i_core_env_init() {
3232
S2I_TARGET_DATA_DIR="${S2I_TARGET_DATA_DIR:-${JAVA_DATA_DIR:-${DATA_DIR:-${S2I_TARGET_DEPLOYMENTS_DIR}}}}"
3333
S2I_IMAGE_SOURCE_MOUNTS="${S2I_IMAGE_SOURCE_MOUNTS:-${CUSTOM_INSTALL_DIRECTORIES}}"
3434
S2I_ENABLE_INCREMENTAL_BUILDS="${S2I_ENABLE_INCREMENTAL_BUILDS:-true}"
35+
S2I_DELETE_SOURCE="${S2I_DELETE_SOURCE:-true}"
3536

3637
s2i_core_env_backward_compatibility
3738
}
@@ -145,9 +146,11 @@ function s2i_core_process_image_mounts() {
145146
}
146147

147148
function s2i_core_cleanup() {
148-
if [ -n "$(find ${S2I_SOURCE_DIR} -maxdepth 0 -type d ! -empty 2> /dev/null)" ]; then
149-
log_info "Cleaning up source directory (${S2I_SOURCE_DIR})"
150-
rm -rf ${S2I_SOURCE_DIR}
149+
if [ "${S2I_DELETE_SOURCE,,}" == "true" ]; then
150+
if [ -n "$(find ${S2I_SOURCE_DIR} -maxdepth 0 -type d ! -empty 2> /dev/null)" ]; then
151+
log_info "Cleaning up source directory (${S2I_SOURCE_DIR})"
152+
rm -rf ${S2I_SOURCE_DIR}
153+
fi
151154
fi
152155
if [ "${S2I_ENABLE_INCREMENTAL_BUILDS,,}" == "true" ]; then
153156
return 0

0 commit comments

Comments
 (0)