Uploaded image for project: 'Yetus'
  1. Yetus
  2. YETUS-913

Docker mode pre-commit can't use JAVA_HOME defined in dockerfile

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.9.0, 0.10.0, 0.11.0
    • None
    • Precommit
    • None

    Description

      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.

      
      # 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
      }
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              busbey Sean Busbey
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: