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

ci: dump context when job ends #47685

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/actions/dump-context/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
name: 'Dump context'
description: 'GitHub Action composite to dump context'

runs:
using: "composite"
steps:
-
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');

await core.group(`Env vars`, async () => {
const envs = Object.keys(process.env).sort().reduce(
(obj, key) => {
obj[key] = process.env[key];
return obj;
}, {}
);
core.info(JSON.stringify(Object.fromEntries(Object.entries(envs).filter(([key]) => !key.startsWith('GHACTION_DCTX_') && !key.startsWith('INPUT_'))), null, 2));
});

await core.group(`GitHub context`, async () => {
core.info(JSON.stringify(JSON.parse(`${process.env.GHACTION_DCTX_GITHUB_CONTEXT}`), null, 2));
});
await core.group(`Job context`, async () => {
core.info(JSON.stringify(JSON.parse(`${process.env.GHACTION_DCTX_JOB_CONTEXT}`), null, 2));
});
await core.group(`Steps context`, async () => {
core.info(JSON.stringify(JSON.parse(`${process.env.GHACTION_DCTX_STEPS_CONTEXT}`), null, 2));
});
await core.group(`Runner context`, async () => {
core.info(JSON.stringify(JSON.parse(`${process.env.GHACTION_DCTX_RUNNER_CONTEXT}`), null, 2));
});
await core.group(`Strategy context`, async () => {
core.info(JSON.stringify(JSON.parse(`${process.env.GHACTION_DCTX_STRATEGY_CONTEXT}`), null, 2));
});
await core.group(`Matrix context`, async () => {
core.info(JSON.stringify(JSON.parse(`${process.env.GHACTION_DCTX_MATRIX_CONTEXT}`), null, 2));
});

if (`${process.env.RUNNER_OS}` == 'Linux') {
await core.group(`Print cpuinfo`, async () => {
await exec.exec('cat /proc/cpuinfo');
});
await core.group(`Print cpuid`, async () => {
const cpuid = await exec.getExecOutput('which cpuid', [], {silent: true, ignoreReturnCode: true})
if (cpuid.stdout != "") {
await exec.exec('cpuid');
} else {
core.info('cpuid not found')
}
});
await core.group(`File system`, async () => {
await exec.exec('df -ah');
});
await core.group(`Mounts`, async () => {
await exec.exec('mount');
});
await core.group(`Docker daemon conf`, async () => {
if ((fs.statSync('/etc/docker', {throwIfNoEntry: false}) != undefined) &&
(fs.statSync('/etc/docker/daemon.json', {throwIfNoEntry: false}) != undefined)) {
core.info(JSON.stringify(JSON.parse(fs.readFileSync('/etc/docker/daemon.json', {encoding: 'utf-8'}).trim()), null, 2));
} else {
core.info('/etc/docker/daemon.json not present')
}
});
}
env:
GHACTION_DCTX_GITHUB_CONTEXT: ${{ toJson(github) }}
GHACTION_DCTX_JOB_CONTEXT: ${{ toJson(job) }}
GHACTION_DCTX_STEPS_CONTEXT: ${{ toJson(steps) }}
GHACTION_DCTX_RUNNER_CONTEXT: ${{ toJson(runner) }}
GHACTION_DCTX_STRATEGY_CONTEXT: ${{ toJson(strategy) }}
GHACTION_DCTX_MATRIX_CONTEXT: ${{ toJson(matrix) }}
26 changes: 26 additions & 0 deletions .github/workflows/.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Build dev image
uses: docker/bake-action@v4
Expand Down Expand Up @@ -71,6 +73,10 @@ jobs:
name: test-reports-unit-${{ inputs.storage }}
path: /tmp/reports/*
retention-days: 1
-
name: Dump context
if: always()
uses: ./.github/actions/dump-context

unit-report:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -117,6 +123,8 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Build dev image
uses: docker/bake-action@v4
Expand Down Expand Up @@ -152,6 +160,10 @@ jobs:
name: test-reports-docker-py-${{ inputs.storage }}
path: /tmp/reports/*
retention-days: 1
-
name: Dump context
if: always()
uses: ./.github/actions/dump-context

integration-flaky:
runs-on: ubuntu-20.04
Expand All @@ -167,6 +179,8 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Build dev image
uses: docker/bake-action@v4
Expand Down Expand Up @@ -221,6 +235,8 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Build dev image
uses: docker/bake-action@v4
Expand Down Expand Up @@ -274,6 +290,10 @@ jobs:
name: test-reports-integration-${{ inputs.storage }}-${{ env.TESTREPORTS_NAME }}
path: /tmp/reports/*
retention-days: 1
-
name: Dump context
if: always()
uses: ./.github/actions/dump-context

integration-report:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -362,6 +382,8 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Build dev image
uses: docker/bake-action@v4
Expand Down Expand Up @@ -414,6 +436,10 @@ jobs:
name: test-reports-integration-cli-${{ inputs.storage }}-${{ env.TESTREPORTS_NAME }}
path: /tmp/reports/*
retention-days: 1
-
name: Dump context
if: always()
uses: ./.github/actions/dump-context

integration-cli-report:
runs-on: ubuntu-20.04
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/.windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ jobs:
path: ${{ env.BIN_OUT }}/*
if-no-files-found: error
retention-days: 2
-
name: Dump context
if: always()
uses: ./.github/actions/dump-context

unit-test:
runs-on: ${{ inputs.os }}
Expand Down Expand Up @@ -191,6 +195,10 @@ jobs:
name: ${{ inputs.os }}-${{ inputs.storage }}-unit-reports
path: ${{ env.GOPATH }}\src\github.com\docker\docker\bundles\*
retention-days: 1
-
name: Dump context
if: always()
uses: ./.github/actions/dump-context

unit-test-report:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -510,6 +518,10 @@ jobs:
name: ${{ inputs.os }}-${{ inputs.storage }}-integration-reports-${{ matrix.runtime }}-${{ env.TESTREPORTS_NAME }}
path: ${{ env.GOPATH }}\src\github.com\docker\docker\bundles\*
retention-days: 1
-
name: Dump context
if: always()
uses: ./.github/actions/dump-context

integration-test-report:
runs-on: ubuntu-latest
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/bin-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ jobs:
id: platforms
run: |
echo "matrix=$(docker buildx bake bin-image-cross --print | jq -cr '.target."bin-image-cross".platforms')" >>${GITHUB_OUTPUT}
-
name: Dump context
if: always()
uses: ./.github/actions/dump-context

build:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -112,6 +116,8 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Login to Docker Hub
if: github.event_name != 'pull_request' && github.repository == 'moby/moby'
Expand Down Expand Up @@ -148,6 +154,10 @@ jobs:
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
-
name: Dump context
if: always()
uses: ./.github/actions/dump-context

merge:
runs-on: ubuntu-20.04
Expand All @@ -171,6 +181,8 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Login to Docker Hub
uses: docker/login-action@v3
Expand All @@ -189,3 +201,7 @@ jobs:
run: |
set -x
docker buildx imagetools inspect ${{ env.MOBYBIN_REPO_SLUG }}:$(jq -cr '.target."docker-metadata-action".args.DOCKER_META_VERSION' /tmp/bake-meta.json)
-
name: Dump context
if: always()
uses: ./.github/actions/dump-context
8 changes: 8 additions & 0 deletions .github/workflows/buildkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Build
uses: docker/bake-action@v4
Expand Down Expand Up @@ -105,6 +107,8 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Download binary artifacts
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -137,3 +141,7 @@ jobs:
TESTPKGS: "./${{ matrix.pkg }}"
TESTFLAGS: "-v --parallel=1 --timeout=30m --run=//worker=${{ matrix.worker }}$"
working-directory: buildkit
-
name: Dump context
if: always()
uses: ./.github/actions/dump-context
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Build
uses: docker/bake-action@v4
Expand All @@ -51,6 +53,10 @@ jobs:
name: Check artifacts
run: |
find ${{ env.DESTDIR }} -type f -exec file -e ascii -- {} +
-
name: Dump context
if: always()
uses: ./.github/actions/dump-context

prepare-cross:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -96,6 +102,8 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Build
uses: docker/bake-action@v4
Expand All @@ -111,3 +119,7 @@ jobs:
name: Check artifacts
run: |
find ${{ env.DESTDIR }} -type f -exec file -e ascii -- {} +
-
name: Dump context
if: always()
uses: ./.github/actions/dump-context
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Build dev image
uses: docker/bake-action@v4
Expand All @@ -53,6 +55,10 @@ jobs:
*.cache-from=type=gha,scope=dev${{ matrix.mode }}
*.cache-to=type=gha,scope=dev${{ matrix.mode }},mode=max
*.output=type=cacheonly
-
name: Dump context
if: always()
uses: ./.github/actions/dump-context

test:
needs:
Expand Down Expand Up @@ -112,6 +118,8 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Build dev image
uses: docker/bake-action@v4
Expand All @@ -123,6 +131,10 @@ jobs:
name: Validate
run: |
make -o build validate-${{ matrix.script }}
-
name: Dump context
if: always()
uses: ./.github/actions/dump-context

smoke-prepare:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -168,10 +180,16 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Test
uses: docker/bake-action@v4
with:
targets: binary-smoketest
set: |
*.platform=${{ matrix.platform }}
-
name: Dump context
if: always()
uses: ./.github/actions/dump-context