Skip to content

Commit

Permalink
Merge pull request #2777 from crazy-max/v0.10-dockerd-tests
Browse files Browse the repository at this point in the history
[v0.10] cherry-picks to fix dockerd tests
  • Loading branch information
tonistiigi authored Apr 6, 2022
2 parents 614b91a + c5e923e commit 75ba987
Show file tree
Hide file tree
Showing 96 changed files with 454 additions and 9,441 deletions.
139 changes: 139 additions & 0 deletions .github/workflows/dockerd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: dockerd

on:
# TODO: add event to build on command in PR (e.g., /test-dockerd)
workflow_dispatch:
inputs:
version:
description: 'Docker version'
required: true
default: '20.10.13'

env:
REPO_SLUG_ORIGIN: "moby/buildkit:latest"
CACHE_GHA_SCOPE_IT: "integration-tests"
CACHE_GHA_SCOPE_BINARIES: "binaries"

jobs:
prepare:
runs-on: ubuntu-latest
steps:
-
name: Check version
run: |
version=${{ github.event.inputs.version }}
if [ -z "$version" ]; then
version=20.10.13
fi
echo "DOCKER_VERSION=$version" >> $GITHUB_ENV
-
name: Check build
uses: actions/github-script@v6
id: build
with:
result-encoding: string
script: |
try {
new URL("${{ env.DOCKER_VERSION }}");
} catch (e) {
return false;
}
return true;
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: image=${{ env.REPO_SLUG_ORIGIN }}
buildkitd-flags: --debug
-
name: Build
if: steps.build.outputs.result == 'true'
uses: docker/build-push-action@v2
with:
context: ${{ env.DOCKER_VERSION }}
target: binary
outputs: /tmp/moby
-
# FIXME: remove symlink and rename bin. should be fixed upstream on moby.
name: Rename binary
if: steps.build.outputs.result == 'true'
run: |
rm /tmp/moby/binary-daemon/dockerd
mv /tmp/moby/binary-daemon/dockerd-dev /tmp/moby/binary-daemon/dockerd
-
name: Download
if: steps.build.outputs.result != 'true'
run: |
mkdir -p /tmp/moby/binary-daemon
cd /tmp/moby/binary-daemon
wget -qO- "https://download.docker.com/linux/static/stable/x86_64/docker-${{ env.DOCKER_VERSION }}.tgz" | tar xvz --strip 1
-
name: Upload dockerd
uses: actions/upload-artifact@v2
with:
name: dockerd
path: /tmp/moby/binary-daemon/dockerd
if-no-files-found: error

test:
runs-on: ubuntu-latest
needs:
- prepare
strategy:
fail-fast: false
matrix:
pkg:
- ./client
- ./cmd/buildctl
- ./solver
- ./frontend
- ./frontend/dockerfile
typ:
- integration
include:
- pkg: ./...
skip-integration-tests: 1
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v1
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: image=${{ env.REPO_SLUG_ORIGIN }}
buildkitd-flags: --debug
-
name: Download dockerd
uses: actions/download-artifact@v2
with:
name: dockerd
path: ./build/
-
name: Fix dockerd perms
run: |
chmod +x ./build/dockerd
-
name: Update daemon.json
run: |
sudo rm /etc/docker/daemon.json
sudo service docker restart
docker version
docker info
-
name: Test
run: |
./hack/test ${{ matrix.typ }}
env:
TEST_DOCKERD: "1"
TEST_DOCKERD_BINARY: "./build/dockerd"
TESTPKGS: "${{ matrix.pkg }}"
TESTFLAGS: "-v --parallel=1 --timeout=30m --run=//worker=dockerd$"
SKIP_INTEGRATION_TESTS: "${{ matrix.skip-integration-tests }}"
CACHE_FROM: "type=gha,scope=${{ env.CACHE_GHA_SCOPE_IT }} type=gha,scope=${{ env.CACHE_GHA_SCOPE_BINARIES }}"
2 changes: 1 addition & 1 deletion client/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1650,7 +1650,7 @@ func testClientGatewayContainerSecurityMode(t *testing.T, sb integration.Sandbox
}
allowedEntitlements = []entitlements.Entitlement{}
} else {
skipDockerd(t, sb)
integration.SkipIfDockerd(t, sb)
assertCaps = func(caps uint64) {
/*
$ capsh --decode=0000003fffffffff
Expand Down
Loading

0 comments on commit 75ba987

Please sign in to comment.