Skip to content

ci: Add conditional CI for the containerd backed image store#138

Closed
rumpl wants to merge 293 commits intomasterfrom
ci-snapshotter-test
Closed

ci: Add conditional CI for the containerd backed image store#138
rumpl wants to merge 293 commits intomasterfrom
ci-snapshotter-test

Conversation

@rumpl
Copy link
Owner

@rumpl rumpl commented Sep 5, 2023

Any PR that has the label containerd-integration will also run tests with the snapshotters

- What I did

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

thaJeztah and others added 22 commits September 8, 2023 01:36
Reduce some of the boiler-plating, and by combining the tests, we skip
the testenv.Clean() in between each of the tests. Performance gain isn't
really measurable, but every bit should help :)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Images built by classic builder will have an additional label (in the
containerd image object, not image config) pointing to a parent of that
image.

This allows to differentiate intermediate images (dangling
images created as a result of a each Dockerfile instruction) from the
final images.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
To avoid collision with TestBuildMultiStageArg.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
In some cases, when the daemon launched by a test panics and quits, the
cleanup code would end with an error when trying to kill it by its pid.
In those cases the whole suite will end up waiting for the daemon that
we start in .integration-daemon-start to finish and we end up waiting 2
hours for the CI to cancel after a timeout.

Using process substitution makes the integration tests quit.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
- The `Version` field was not used for any purpose, other than a debug log
- The `X-Docker-Registry-Version` header was part of the registry v1 spec,
  however, as we're not using the `Version` field, we don't need the
  header for anything.
- The `X-Docker-Registry-Config` header was only set by the mock registry;
  there's no code consuming it, so we don't need to mock it (even if an
  actual v1 registry / search API would return it).

It's also worth noting that we never call the `_ping` endpoint when using
Docker Hub's search API, and Docker Hub does not even implement the `_ping`
endpoint;

    curl -fsSL https://index.docker.io/_ping | head -n 4
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title>Docker</title>

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
With containerd image store the images don't depend on each other even
if they share the same content and it's totally fine to delete the
"parent" image.

The skip is necessary because deleting the "parent" image does not
produce an error with the c8d image store and deleting the `busybox`
image breaks other tests.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
We don't really want the daemon to panic for this so let's log a warning
about max downloads and uploads

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
…lone

This function was making a request to the `_ping` endpoint, which (if
implemented) would return a JSON response, which we unmarshal (the only
field we use from the response is the `Standalone` field).

However, if the response had a `X-Docker-Registry-Standalone`, that header
took precedence, and would overwrite the earlier `Standalone` value we
obtained from the JSON response.

This patch adds a fast-path for situations where the header is present,
in which case we can skip handling the JSON response altogether.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
We have the response available, which is an io.Reader, so we don't have
to read the entire response into memory before decoding.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Also remove log from `validateEndpoint`, because we don't actually
ping the default (Docker Hub).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Add env variable that allows to run integration-cli tests with cgroup v2 enabled.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Fixes TestInspectByPrefix when running with c8d snapshotters enabled.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
validateEndpoint uses `v1Endpoint.ping` to verify if the search API can
use a secure connection, and to fall back to basic auth. For Docker Hub,
we don't allow insecure connections, and `v1Endpoint.ping` will not connect
to Docker Hub (Docker Hub also does not implement the `_ping` endpoint,
so doing so would always fail).

Let's make it more clear that we don't do any validation, and return
early.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
c8d: Remove the panic from UpdateConfig
Use process substitution to redirect to tee
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
c8d/image: Allow truncated id to have sha256: prefix
Removes uses of the github.com/opencontainers/runc/libcontainer/devices
package.

full diff: cncf-tags/container-device-interface@v0.6.0...v0.6.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Without these compile flags, Delve is unable to report the value of some
variables and it's not possible to jump into inlined code.

As the contributing docs already mention that `DOCKER_DEBUG` should
disable "build optimizations", the env var is reused here instead of
introducing a new one.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
integration-cli: Skip TestRmiParentImageFail when using c8d snapshotters
thaJeztah and others added 10 commits September 27, 2023 12:08
…vars

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This utility was setting the content-type header after WriteHeader was
called, and the header was not sent because of that.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The test was depending on the client constructing an error based on the
http-status code, and the client not reading the response body if the
response was not a JSON response.

This fix;

- adds the correct content-type headers in the response
- includes error-messages in the response
- adds additional tests to cover both the plain (non-JSON) and JSON
  error responses, as well as an empty response.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
remove some intermediate vars, and small refactor for error-handling
internal: Add compatcontext.WithoutCancel
Related discussion in docker-library/golang#472

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This required changes to the download-URL, as downloads are now provided
using the full version (including the `.0` patch version);

    curl -sI https://go.dev/dl/go1.21.windows-amd64.zip | grep 'location'
    location: https://dl.google.com/go/go1.21.windows-amd64.zip

    curl -sI https://dl.google.com/go/go1.21.windows-amd64.zip
    HTTP/2 404
    # ...

    curl -sI https://dl.google.com/go/go1.21.0.windows-amd64.zip
    HTTP/2 200
    # ...

Unfortunately this also means that the GO_VERSION can no longer be set to
versions lower than 1.21.0 (without additional changes), because older
versions do NOT provide the `.0` version, and Go 1.21.0 and up, no longer
provides URLs _without_ the `.0` version.

Co-authored-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@rumpl rumpl force-pushed the ci-snapshotter-test branch from aede51d to 88a3a00 Compare September 28, 2023 14:34
vvoland and others added 7 commits September 28, 2023 17:13
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
update to go1.21.1, default to GOTOOLCHAIN=local
@rumpl rumpl force-pushed the ci-snapshotter-test branch 8 times, most recently from 20126b0 to 24cf1a6 Compare September 29, 2023 16:03
Moving these jobs to reusable workflows to declutter the test.yaml
workflow, this will also help reuse these workflows to run tests with
the container-snapshotter feature enabled

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
This workflow will run all the tests (unit, integration and
integration-cli) with the containerd-snapshotter feature enalbed.

We only run these tests for pull requests that have the
"containerd-integration" label and also on any other branch/tag.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
@rumpl rumpl force-pushed the ci-snapshotter-test branch from 24cf1a6 to 1952344 Compare September 29, 2023 16:12
@rumpl rumpl closed this Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.