[
https://issues.apache.org/jira/browse/YETUS-913?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16930575#comment-16930575
]
Sean Busbey commented on YETUS-913:
-----------------------------------
yeah the problem here was that when I expressly make sure that JAVA_HOME isn't
set yetus was still setting it to empty in the instance.
> Docker mode pre-commit can't use JAVA_HOME defined in dockerfile
> ----------------------------------------------------------------
>
> Key: YETUS-913
> URL: https://issues.apache.org/jira/browse/YETUS-913
> Project: Yetus
> Issue Type: Bug
> Components: Precommit
> Affects Versions: 0.9.0, 0.10.0, 0.11.0
> Reporter: Sean Busbey
> Priority: Major
>
> Over in HBase we use different JDKs depending on the branch, due to our
> compatibility promises in major release lines. For test-patch runs, this
> changes the set of JDKs we install in each branch's Dockerfile.
> While recently trying to chase down why we were getting JDK8 used to test a
> branch that's JDK7+, I realized that the docker bootstrapping _always_
> overwrites the JAVA_HOME in the image with JAVA_HOME on the host. This
> includes when the host doesn't define a JAVA_HOME, effectively preventing a
> JAVA_HOME set by the image (either via ENV or by installing some package that
> sets it).
> Workaround:
> You can prevent this by replacing the {{docker_do_env_adds}} function in your
> personality. e.g. this version will only set JAVA_HOME in the docker instance
> if the host defines it. We then make sure all of our uses of test-patch unset
> JAVA_HOME before invocation.
> {code}
> # work around yetus overwriting JAVA_HOME from our docker image
> function docker_do_env_adds
> {
> declare k
> for k in "${DOCKER_EXTRAENVS[@]}"; do
> if [[ "JAVA_HOME" == "${k}" ]]; then
> if [ -n "${JAVA_HOME}" ]; then
> DOCKER_EXTRAARGS+=("--env=JAVA_HOME=${JAVA_HOME}")
> fi
> else
> DOCKER_EXTRAARGS+=("--env=${k}=${!k}")
> fi
> done
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.2#803003)