-
Notifications
You must be signed in to change notification settings - Fork 637
Create buildx integration tests #1770
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| name: test | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - 'master' | ||
| - 'v[0-9]*' | ||
| tags: | ||
| - 'v*' | ||
| pull_request: | ||
| paths-ignore: | ||
| - '.github/releases.json' | ||
| - 'README.md' | ||
| - 'docs/**' | ||
|
|
||
| env: | ||
| SETUP_BUILDX_VERSION: "latest" | ||
| SETUP_BUILDKIT_IMAGE: "moby/buildkit:latest" | ||
| TESTFLAGS: "-v --parallel=6 --timeout=30m" | ||
| TESTFLAGS_DOCKER: "-v --parallel=1 --timeout=30m" | ||
| GOTESTSUM_FORMAT: "standard-verbose" | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-20.04 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| worker: | ||
| - docker | ||
| - docker-container | ||
| - remote | ||
| pkg: | ||
| - ./tests | ||
| typ: | ||
| - integration | ||
| # already run as part of build.yml | ||
| # include: | ||
| # - pkg: ./... | ||
| # skip-integration-tests: 1 | ||
| steps: | ||
| - | ||
| name: Checkout | ||
| uses: actions/checkout@v3 | ||
| - | ||
| name: Expose GitHub Runtime | ||
| uses: crazy-max/ghaction-github-runtime@v2 | ||
| - | ||
| name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v2 | ||
| - | ||
| name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v2 | ||
| with: | ||
| version: ${{ env.SETUP_BUILDX_VERSION }} | ||
| driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} | ||
| buildkitd-flags: --debug | ||
| - | ||
| name: Test | ||
| run: | | ||
| export TEST_REPORT_SUFFIX=-${{ github.job }}-$(echo "${{ matrix.pkg }}-${{ matrix.skip-integration-tests }}-${{ matrix.worker }}" | tr -dc '[:alnum:]-\n\r' | tr '[:upper:]' '[:lower:]') | ||
| ./hack/test ${{ matrix.typ }} | ||
| env: | ||
| TEST_DOCKERD: "${{ (matrix.worker == 'docker' || matrix.worker == 'docker-container') && '1' || '0' }}" | ||
| TESTFLAGS: "${{ (matrix.worker == 'docker' || matrix.worker == 'docker-container') && env.TESTFLAGS_DOCKER || env.TESTFLAGS }} --run=//worker=${{ matrix.worker }}$" | ||
| TESTPKGS: "${{ matrix.pkg }}" | ||
| SKIP_INTEGRATION_TESTS: "${{ matrix.skip-integration-tests }}" | ||
| - | ||
| name: Generate annotations | ||
| if: always() | ||
| uses: crazy-max/.github/.github/actions/gotest-annotations@1a64ea6d01db9a48aa61954cb20e265782c167d9 | ||
| with: | ||
| directory: ./bin/testreports | ||
| - | ||
| name: Upload test reports | ||
| if: always() | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: test-reports | ||
| path: ./bin/testreports |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,9 @@ | |
| ARG GO_VERSION=1.20 | ||
| ARG XX_VERSION=1.1.2 | ||
| ARG DOCKERD_VERSION=20.10.14 | ||
| ARG GOTESTSUM_VERSION=v1.9.0 | ||
| ARG REGISTRY_VERSION=2.8.0 | ||
| ARG BUILDKIT_VERSION=v0.11.6 | ||
|
|
||
| FROM docker:$DOCKERD_VERSION AS dockerd-release | ||
|
|
||
|
|
@@ -18,6 +21,17 @@ ENV GOFLAGS=-mod=vendor | |
| ENV CGO_ENABLED=0 | ||
| WORKDIR /src | ||
|
|
||
| FROM registry:$REGISTRY_VERSION AS registry | ||
|
|
||
| FROM moby/buildkit:$BUILDKIT_VERSION AS buildkit | ||
|
|
||
| FROM gobase AS gotestsum | ||
| ARG GOTESTSUM_VERSION | ||
| ENV GOFLAGS= | ||
| RUN --mount=target=/root/.cache,type=cache \ | ||
| GOBIN=/out/ go install "gotest.tools/gotestsum@${GOTESTSUM_VERSION}" && \ | ||
| /out/gotestsum --version | ||
|
|
||
| FROM gobase AS buildx-version | ||
| RUN --mount=type=bind,target=. <<EOT | ||
| set -e | ||
|
|
@@ -39,6 +53,7 @@ RUN --mount=type=bind,target=. \ | |
| EOT | ||
|
|
||
| FROM gobase AS test | ||
| ENV SKIP_INTEGRATION_TESTS=1 | ||
| RUN --mount=type=bind,target=. \ | ||
| --mount=type=cache,target=/root/.cache \ | ||
| --mount=type=cache,target=/go/pkg/mod \ | ||
|
|
@@ -61,6 +76,17 @@ FROM binaries-$TARGETOS AS binaries | |
| # enable scanning for this stage | ||
| ARG BUILDKIT_SBOM_SCAN_STAGE=true | ||
|
|
||
| FROM gobase AS integration-test-base | ||
| RUN apk add --no-cache docker runc containerd | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed we should provide custom versions in our matrix when running integration tests. e.g., containerd 1.6/1.7 and moby 23/24. Pretty much like we do in BuildKit: https://github.com/moby/buildkit/blob/81d19ad945cdbf921d182c50fc91169b1375b44d/Dockerfile#L4-L6 Can be done in follow-up
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @crazy-max any chance you could take a look at this one 🙏 🙏
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure happy to look at it!
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do this in a follow-up instead, there are more changes than I expected. Some in BuildKit moby/buildkit@master...crazy-max:buildkit:itg-dockerd to set extra envs (basically prepend path with right location like we do with containerd) and path to the alt binary. |
||
| COPY --link --from=gotestsum /out/gotestsum /usr/bin/ | ||
| COPY --link --from=registry /bin/registry /usr/bin/ | ||
| COPY --link --from=buildkit /usr/bin/buildkitd /usr/bin/ | ||
| COPY --link --from=buildkit /usr/bin/buildctl /usr/bin/ | ||
| COPY --link --from=binaries /buildx /usr/bin/ | ||
|
|
||
| FROM integration-test-base AS integration-test | ||
| COPY . . | ||
|
|
||
| # Release | ||
| FROM --platform=$BUILDPLATFORM alpine AS releaser | ||
| WORKDIR /work | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was pulled in from moby/buildkit#3727, but I wasn't actually using it. I've now enabled test failure annotations as in buildkit, see https://github.com/docker/buildx/actions/runs/5012653318.