jangrewe / gitlab-ci-android

GitLab CI image for building Android apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH

sw-dev1 opened this issue · comments

Sorry if this is trivial. Job output with the .gitlab-ci.yml here and a runner in a docker container, shell executor:

Running with gitlab-ci-multi-runner 9.2.0 (adfc387)
  on Shell Runner (c34bfe71)
Using Shell executor...
Running on gitlab-runner-1...
Fetching changes...
HEAD is now at 8007b66 Add .gitlab-ci.yml file
Checking out 8007b663 as TestGitlabCI-jangrewe...
Skipping Git submodules setup
Checking cache for 1...
Successfully extracted cache
$ export GRADLE_USER_HOME=$(pwd)/.gradle
$ chmod +x ./gradlew
$ ./gradlew assembleDebug

ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

ERROR: Job failed: exit status 1

Any ideas? Thanks.

It looks like it isn't actually running in the docker executor.

I tried with docker executor, then getting the error
Running with gitlab-ci-multi-runner 9.3.0 (3df822b) on Docker Runner (ad5bbeb5) Using Docker executor with image openjdk:8-jdk ... ERROR: Preparation failed: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

You probably need to install Docker, and make sure that it's able to run containers.

The gitlab runner is in a docker container, that in a way suggests that docker is installed and is able to run containers. There seems to be a specific requirement for configuring the docker environment, gitlab (container 1) and gitlab runner (container 2) for this image to be able to apparently create container 3. Would you be willing to help?

@jangrewe Could you please elaborate why you think this issue should be closed? Do you believe that installing docker is the solution to the problem described?

Uhm, this is a Docker image, so... yeah, unless you found a way to run Docker images without Docker, i'm pretty sure you do need Docker! 😁

Well, fun aside, docker is running. As I wrote above, I have gitlab in one container and trying to run another as the runner for gitlab ci by using your image. It seems that the solution lies in the correct registration of the runner. Should it be declared as a Shell or Docker exectutor or something else? I haven't seen any description about it for this image. How do you register the runner to gitlab with this image? What are the entries for step 8 and 9 for this instruction: http://docs.gitlab.com/runner/register/?