Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build does not take into account system property for missing docker #45034

Closed
costin opened this issue Jul 31, 2019 · 8 comments
Closed

Build does not take into account system property for missing docker #45034

costin opened this issue Jul 31, 2019 · 8 comments
Assignees
Labels
:Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team

Comments

@costin
Copy link
Member

costin commented Jul 31, 2019

Running the build on an OS (in my case Windows) without docker leads to failure even if the -Dbuild.docker=false property is specified.

> gradlew -Dbuild.docker=false --parallel assemble
...
=======================================
Elasticsearch Build Hamster says Hello!
  Gradle Version        : 5.5.1
  OS Info               : Windows 10 10.0 (amd64)
  JDK Version           : 12 (Oracle Corporation 12.0.2 [Java HotSpot(TM) 64-Bit Server VM 12.0.2+10])
  JAVA_HOME             : E:\jvm\jdk12
  Random Testing Seed   : 23E86B20BFD71C05
=======================================
...
* What went wrong:
Docker (checked [/usr/bin/docker,/usr/local/bin/docker]) is required to run the following tasks:
  :distribution:docker:buildDockerImage
  :distribution:docker:buildOssDockerImage
you can address this by attending to the reported issue, removing the offending tasks from being executed, or by passing -Dbuild.docker=false

The only work-around I found is to exclude the tasks manually:

 -x  :distribution:docker:buildDockerImage -x :distribution:docker:buildOssDockerImage

The issue seems similar to : #43417

@costin costin added the :Delivery/Build Build or test infrastructure label Jul 31, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@alpar-t
Copy link
Contributor

alpar-t commented Jul 31, 2019

This is an oversight in that we made docker mandatory for building artifacts and optional for running tests only, so if you run assemble it will fail that it's required but running check will skip the docker based tests and thus will also avoid building the distribution so it will run to completion.

The recommendation is to build only a specific distribution of interest.

@fayak
Copy link

fayak commented Aug 4, 2019

The recommendation is to build only a specific distribution of interest.

What is the best approach to do so ?

@alpar-t
Copy link
Contributor

alpar-t commented Aug 5, 2019

@fayak for example:

./gradlew -p  distribution/archives/no-jdk-linux-tar assemble

@fayak
Copy link

fayak commented Aug 5, 2019

Thanks ! Is there a list of (or a documentation somewhere) of all possible build options/attributes ? I've found few things around, but nothing really clear unfortunately :/

@williamrandolph
Copy link
Contributor

@fayak I have found ./gradlew tasks and ./gradlew tasks --all to be helpful in finding the names of Gradle tasks. The second one has a lot of output, so you may want to grep for "distribution" or "assemble" to find just the possible distributions you can build.

@fayak
Copy link

fayak commented Aug 5, 2019

Thanks !
I don't know how helpful it can be, but here's the Dockerfile and entrypoint.sh I use to build a custom version of elasticsearch:
Dockerfile:

FROM openjdk:12-jdk-alpine

RUN apk update && apk add git tree docker py-pip python-dev libffi-dev openssl-dev gcc libc-dev make && rm -rf /var/cache/apk/*

RUN pip install docker-compose

COPY resources/<modified files> /srv
COPY resources/entrypoint.sh /srv

CMD /srv/entrypoint.sh
#!/bin/sh

if [ -z ${ES_VERSION+x} ]; then
    ES_VERSION="v7.3.0"
    echo "Variable ES_VERSION is unset. Setting is to ${ES_VERSION}"
else
    echo "Version to compile: ${ES_VERSION}"
fi

cd /srv || exit 1

git clone https://github.com/elastic/elasticsearch || exit 1
cd elasticsearch || exit 1
git checkout $ES_VERSION

for <custom resources>
find <path> -name <custom resource> -exec cp /srv/<custom> {} \;
done

./gradlew :distribution:docker:assemble --parallel || exit 1

@mark-vieira
Copy link
Contributor

This issue is no longer applicable after the Docker support logic refactor. This property has been removed, and we no longer display it in the error message. Attempting to run the Docker build tasks will continue to fail if Docker is not available on the system. The recommended approach, as mentioned above, is to run the task specific to the distribution you require. This also has the benefit of being much faster than running ./gradlew assemble which builds all flavors of all distributions which is almost never what a user actually desires.

@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants