-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Only define Docker pkg tests if Docker is available #47640
Only define Docker pkg tests if Docker is available #47640
Conversation
This reverts commit b958467.
The Docker packaging tests were being defined irrespective of whether Docker was actually available in the current environment. Change this to check that Docker is available and vaguely functional before defining the test tasks. As part of this, define a seperate utility class for checking Docker, and call that instead of defining checks in-line in BuildPlugin.groovy
6dfab1c
to
d2dccce
Compare
Pinging @elastic/es-core-infra (:Core/Infra/Build) |
buildSrc/src/main/java/org/elasticsearch/gradle/DockerUtils.java
Outdated
Show resolved
Hide resolved
buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy
Outdated
Show resolved
Hide resolved
buildSrc/src/main/java/org/elasticsearch/gradle/DockerUtils.java
Outdated
Show resolved
Hide resolved
buildSrc/src/main/java/org/elasticsearch/gradle/DockerUtils.java
Outdated
Show resolved
Hide resolved
buildSrc/src/main/java/org/elasticsearch/gradle/DockerUtils.java
Outdated
Show resolved
Hide resolved
buildSrc/src/main/java/org/elasticsearch/gradle/DockerUtils.java
Outdated
Show resolved
Hide resolved
buildSrc/src/main/java/org/elasticsearch/gradle/DockerUtils.java
Outdated
Show resolved
Hide resolved
This approach is a bit fragile. On some platforms we always want to have docker and we always want to test for it. Unfortunately Jenkins doesn't make this easy for matrix jobs, but since we are in more control of the environment, I'm wondering if we should make this specific, like parsing There's a similar situation with the test fixtures plugin that skips tests if docker compose is not available but that's different in that those types of tests should be able to run anywhere ( part of ./gradlew check ) and we didn't want to make docker compose mandatory. I'we been meaning to add a flag that would force docker-compose to be available and use it in CI. My concern is that docker install might be skipped in the image and we'll never notice that we are not running these test.s |
@atorok Right now, the precense or absence of Docker within Vagrant depends on whether we installed Docker via the |
Actually, looking at how the last CI run failed, I think we do need a list of where Docker is and isn't supposed to be installed, because it looks like the CI worker has Docker and so Gradle happily declared the Docker tests tasks, which it then tried to run on |
I think we should assume docker by default, and have a list of the few platforms where it's ok to be missing. While at it, could you add a check that runs something like |
Introduce a VM exclude list, so that the docker packaging tests are run on all VMs other than those listed. Previously the code checked that whether Docker was installed, but that wasn't sufficient becasue the check would happen on the CI host, instead of in the VM.
The Version class is very strict about what suffices it allows after the patch number, which meant it rejected Docker versions such as `19.03.2-ce`. Introduce a "relaxed" parsing mode that allow any style of suffix.
@elasticmachine run elasticsearch-ci/bwc |
@elasticmachine update branch |
Separately to running packaging tests in Vagrant, we also run packaging tests through CI on a variety of operating systems. Change how the test tasks are generated so that the local Docker packaging tests are only defined if the host OS is supported.
@elasticmachine run elasticsearch-ci/packaging |
👍 |
@elasticmachine run elasticsearch-ci/2 since it experience a peculiar transient error. |
@elasticmachine run elasticsearch-ci/packaging-matrix as, yet again, the wrong commit was tested. |
I would really like us to remove |
@atorok I tried removing this and relying on detecting whether Gradle is running in a VM via |
@elasticmachine run elasticsearch-ci/packaging-matrix to pick up the right commit |
@elasticmachine run elasticsearch-ci/packaging-matrix to pick up the right commit |
@elasticmachine run elasticsearch-ci/packaging-matrix to pick up the right commit |
@elasticmachine run elasticsearch-ci/packaging-matrix to pick up the right commit |
@elasticmachine run elasticsearch-ci/2 |
It's green! Green I tell you! |
Closes elastic#47639, and unmutes tests that were muted in b958467. The Docker packaging tests were being defined irrespective of whether Docker was actually available in the current environment. Instead, implement exclude lists so that in environments where Docker is not available, no Docker packaging tests are defined. For CI hosts, the build checks `.ci/dockerOnLinuxExclusions`. The Vagrant VMs can defined the extension property `shouldTestDocker` property to opt-in to packaging tests. As part of this, define a seperate utility class for checking Docker, and call that instead of defining checks in-line in BuildPlugin.groovy
@pugnascotia I don't quite see why this is necessary. AFAIK, When running tests in a VM, we run the tasks in the sub-projects, and when running in the GCP the tasks are attached to the |
Backport of #46599 and #47640. Add packaging tests for Docker. * Introduce packaging tests for Docker (#46599) Closes #37617. Add packaging tests for our Docker images, similar to what we have for RPMs or Debian packages. This works by running a container and probing it e.g. via `docker exec`. Test can also be run in Vagrant, by exporting the Docker images to disk and loading them again in VMs. Docker is installed via `Vagrantfile` in a selection of boxes. * Only define Docker pkg tests if Docker is available (#47640) Closes #47639, and unmutes tests that were muted in b958467. The Docker packaging tests were being defined irrespective of whether Docker was actually available in the current environment. Instead, implement exclude lists so that in environments where Docker is not available, no Docker packaging tests are defined. For CI hosts, the build checks `.ci/dockerOnLinuxExclusions`. The Vagrant VMs can defined the extension property `shouldTestDocker` property to opt-in to packaging tests. As part of this, define a seperate utility class for checking Docker, and call that instead of defining checks in-line in BuildPlugin.groovy
Closes #47639, and unmutes tests that were muted in b958467.
The packaging tests are defined dynamically in
DistroTestPlugin
, which includes Docker image tests. The plugin didn't allow for the possibility that Docker isn't installed or is otherwise unavailable when defining the packaging tests, which caused failures when executing on e.g. CentOS 6 or Oracle Linux.This PR changes the plugin to check for Docker before defining the Docker packaging tests. As part of this, the Docker-checking code in
BuildPlugin
was extracted into aDocker
utility class, so that it can be called from more than one place.I'm not particularly proud of the
Docker.java
implementation, it feels a little clumsy, so I'd welcome any thoughts here.