Merged in jvm-support-args-precedence (pull request #66)

SCALE-18: Fix precedence of JVM_SUPPORT_RECOMMENDED_ARGS

Approved-by: Ben Partridge <bpartridge@atlassian.com>
Approved-by: Lauretha Rura <lrura@atlassian.com>
This commit is contained in:
Dave Chevell 2020-06-01 03:57:34 +00:00
commit 4b22953bb7
3 changed files with 20 additions and 4 deletions

View File

@ -43,8 +43,9 @@ RUN groupadd --gid ${RUN_GID} ${RUN_GROUP} \
&& chown -R ${RUN_USER}:${RUN_GROUP} ${CONFLUENCE_INSTALL_DIR}/work \
&& chown -R ${RUN_USER}:${RUN_GROUP} ${CONFLUENCE_HOME} \
\
&& sed -i -e 's/-Xms\([0-9]\+[kmg]\) -Xmx\([0-9]\+[kmg]\)/-Xms\${JVM_MINIMUM_MEMORY:=\1} -Xmx\${JVM_MAXIMUM_MEMORY:=\2} \${JVM_SUPPORT_RECOMMENDED_ARGS} -Dconfluence.home=\${CONFLUENCE_HOME}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \
&& sed -i -e 's/-XX:ReservedCodeCacheSize=\([0-9]\+[kmg]\)/-XX:ReservedCodeCacheSize=${JVM_RESERVED_CODE_CACHE_SIZE:=\1}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh
&& sed -i -e 's/-Xms\([0-9]\+[kmg]\) -Xmx\([0-9]\+[kmg]\)/-Xms\${JVM_MINIMUM_MEMORY:=\1} -Xmx\${JVM_MAXIMUM_MEMORY:=\2} -Dconfluence.home=\${CONFLUENCE_HOME}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \
&& sed -i -e 's/-XX:ReservedCodeCacheSize=\([0-9]\+[kmg]\)/-XX:ReservedCodeCacheSize=${JVM_RESERVED_CODE_CACHE_SIZE:=\1}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \
&& sed -i -e 's/export CATALINA_OPTS/CATALINA_OPTS="\${CATALINA_OPTS} \${JVM_SUPPORT_RECOMMENDED_ARGS}"\n\nexport CATALINA_OPTS/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh
VOLUME ["${CONFLUENCE_HOME}"] # Must be declared after setting perms

View File

@ -42,8 +42,9 @@ RUN addgroup -g ${RUN_GID} ${RUN_GROUP} \
&& chown -R ${RUN_USER}:${RUN_GROUP} ${CONFLUENCE_INSTALL_DIR}/work \
&& chown -R ${RUN_USER}:${RUN_GROUP} ${CONFLUENCE_HOME} \
\
&& sed -i -e 's/-Xms\([0-9]\+[kmg]\) -Xmx\([0-9]\+[kmg]\)/-Xms\${JVM_MINIMUM_MEMORY:=\1} -Xmx\${JVM_MAXIMUM_MEMORY:=\2} \${JVM_SUPPORT_RECOMMENDED_ARGS} -Dconfluence.home=\${CONFLUENCE_HOME}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \
&& sed -i -e 's/-XX:ReservedCodeCacheSize=\([0-9]\+[kmg]\)/-XX:ReservedCodeCacheSize=${JVM_RESERVED_CODE_CACHE_SIZE:=\1}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh
&& sed -i -e 's/-Xms\([0-9]\+[kmg]\) -Xmx\([0-9]\+[kmg]\)/-Xms\${JVM_MINIMUM_MEMORY:=\1} -Xmx\${JVM_MAXIMUM_MEMORY:=\2} -Dconfluence.home=\${CONFLUENCE_HOME}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \
&& sed -i -e 's/-XX:ReservedCodeCacheSize=\([0-9]\+[kmg]\)/-XX:ReservedCodeCacheSize=${JVM_RESERVED_CODE_CACHE_SIZE:=\1}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \
&& sed -i -e 's/export CATALINA_OPTS/CATALINA_OPTS="\${CATALINA_OPTS} \${JVM_SUPPORT_RECOMMENDED_ARGS}"\n\nexport CATALINA_OPTS/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh
VOLUME ["${CONFLUENCE_HOME}"] # Must be declared after setting perms

View File

@ -308,3 +308,17 @@ def test_non_root_user(docker_cli, image):
RUN_GID = 2002
container = run_image(docker_cli, image, user=f'{RUN_UID}:{RUN_GID}')
_jvm = wait_for_proc(container, get_bootstrap_proc(container))
def test_jvm_support_recommended_args_order(docker_cli, image):
ENABLE_PRINTGCDETAILS = '-XX:+PrintGCDetails'
DISABLE_PRINTGCDETAILS = '-XX:-PrintGCDetails'
environment = {
'JVM_SUPPORT_RECOMMENDED_ARGS': ENABLE_PRINTGCDETAILS,
}
container = run_image(docker_cli, image, environment=environment)
_jvm = wait_for_proc(container, get_bootstrap_proc(container))
procs_list = get_procs(container)
jvm = [proc for proc in procs_list if get_bootstrap_proc(container) in proc][0]
assert jvm.index(ENABLE_PRINTGCDETAILS) > jvm.index(DISABLE_PRINTGCDETAILS)