From 3a458acd46a0459555628ef0324c718bac5bab56 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Thu, 16 Feb 2023 05:25:02 +0100 Subject: [PATCH] ci: rename unclear env vars Signed-off-by: CrazyMax --- .github/workflows/.test.yml | 14 +++++----- .github/workflows/buildkit.yml | 26 +++++++++---------- .github/workflows/buildx-image.yml | 4 +-- .github/workflows/dockerd.yml | 41 +++++++++++++----------------- .github/workflows/frontend.yml | 14 +++++----- .github/workflows/validate.yml | 8 +++--- 6 files changed, 50 insertions(+), 57 deletions(-) diff --git a/.github/workflows/.test.yml b/.github/workflows/.test.yml index b9201a0d8eda7..d8920955889d9 100644 --- a/.github/workflows/.test.yml +++ b/.github/workflows/.test.yml @@ -27,10 +27,10 @@ on: type: string env: - REPO_SLUG_ORIGIN: "moby/buildkit:latest" - TESTFLAGS: "-v --parallel=6 --timeout=30m" - BUILDX_VERSION: "latest" # leave empty to use the one available on GitHub virtual environment GO_VERSION: "1.19" + SETUP_BUILDX_VERSION: "latest" + SETUP_BUILDKIT_IMAGE: "moby/buildkit:latest" + TESTFLAGS: "-v --parallel=6 --timeout=30m" jobs: prepare: @@ -54,8 +54,8 @@ jobs: name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 with: - version: ${{ env.BUILDX_VERSION }} - driver-opts: image=${{ env.REPO_SLUG_ORIGIN }} + version: ${{ env.SETUP_BUILDX_VERSION }} + driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} buildkitd-flags: --debug - name: Deps @@ -135,8 +135,8 @@ jobs: name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 with: - version: ${{ env.BUILDX_VERSION }} - driver-opts: image=${{ env.REPO_SLUG_ORIGIN }} + version: ${{ env.SETUP_BUILDX_VERSION }} + driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} buildkitd-flags: --debug - name: Test diff --git a/.github/workflows/buildkit.yml b/.github/workflows/buildkit.yml index 2ea8babd3eee3..ddfe8ca98443e 100644 --- a/.github/workflows/buildkit.yml +++ b/.github/workflows/buildkit.yml @@ -20,13 +20,13 @@ on: - 'frontend/dockerfile/docs/**' env: - REPO_SLUG_ORIGIN: "moby/buildkit:latest" - REPO_SLUG_TARGET: "moby/buildkit" + GO_VERSION: "1.19" + SETUP_BUILDX_VERSION: "latest" + SETUP_BUILDKIT_IMAGE: "moby/buildkit:latest" + IMAGE_NAME: "moby/buildkit" PLATFORMS: "linux/amd64,linux/arm/v7,linux/arm64,linux/s390x,linux/ppc64le,linux/riscv64" CACHE_GHA_SCOPE_BINARIES: "binaries" CACHE_GHA_SCOPE_CROSS: "cross" - BUILDX_VERSION: "latest" # leave empty to use the one available on GitHub virtual environment - GO_VERSION: "1.19" jobs: base: @@ -45,8 +45,8 @@ jobs: name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 with: - version: ${{ env.BUILDX_VERSION }} - driver-opts: image=${{ env.REPO_SLUG_ORIGIN }} + version: ${{ env.SETUP_BUILDX_VERSION }} + driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} buildkitd-flags: --debug - name: Build ${{ env.CACHE_GHA_SCOPE_BINARIES }} @@ -96,8 +96,8 @@ jobs: name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 with: - version: ${{ env.BUILDX_VERSION }} - driver-opts: image=${{ env.REPO_SLUG_ORIGIN }} + version: ${{ env.SETUP_BUILDX_VERSION }} + driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} buildkitd-flags: --debug - name: Cross @@ -159,8 +159,8 @@ jobs: name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 with: - version: ${{ env.BUILDX_VERSION }} - driver-opts: image=${{ env.REPO_SLUG_ORIGIN }} + version: ${{ env.SETUP_BUILDX_VERSION }} + driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} buildkitd-flags: --debug - name: Login to DockerHub @@ -172,7 +172,7 @@ jobs: - name: Build ${{ needs.release-base.outputs.tag }} run: | - ./hack/images "${{ needs.release-base.outputs.tag }}" "$REPO_SLUG_TARGET" "${{ needs.release-base.outputs.push }}" + ./hack/images "${{ needs.release-base.outputs.tag }}" "$IMAGE_NAME" "${{ needs.release-base.outputs.push }}" env: RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') }} TARGET: ${{ matrix.target-stage }} @@ -199,8 +199,8 @@ jobs: name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 with: - version: ${{ env.BUILDX_VERSION }} - driver-opts: image=${{ env.REPO_SLUG_ORIGIN }} + version: ${{ env.SETUP_BUILDX_VERSION }} + driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} buildkitd-flags: --debug - name: Build ${{ needs.release-base.outputs.tag }} diff --git a/.github/workflows/buildx-image.yml b/.github/workflows/buildx-image.yml index 5cd9a573bb6a6..3af7f2e6259e3 100644 --- a/.github/workflows/buildx-image.yml +++ b/.github/workflows/buildx-image.yml @@ -30,8 +30,8 @@ on: default: 'true' env: + SETUP_BUILDX_VERSION: "latest" REPO_SLUG_TARGET: "moby/buildkit" - BUILDX_VERSION: "latest" # leave empty to use the one available on GitHub virtual environment jobs: create: @@ -47,7 +47,7 @@ jobs: name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 with: - version: ${{ env.BUILDX_VERSION }} + version: ${{ env.SETUP_BUILDX_VERSION }} buildkitd-flags: --debug - name: Login to DockerHub diff --git a/.github/workflows/dockerd.yml b/.github/workflows/dockerd.yml index 7a16945089142..ac3058da64c98 100644 --- a/.github/workflows/dockerd.yml +++ b/.github/workflows/dockerd.yml @@ -7,50 +7,43 @@ on: version: description: 'Docker version' required: true - default: '20.10.19' + default: '23.0.1' env: - REPO_SLUG_ORIGIN: "moby/buildkit:latest" + SETUP_BUILDX_VERSION: "latest" + SETUP_BUILDKIT_IMAGE: "moby/buildkit:latest" CACHE_GHA_SCOPE_IT: "integration-tests" CACHE_GHA_SCOPE_BINARIES: "binaries" TESTFLAGS: "-v --parallel=1 --timeout=30m" - BUILDX_VERSION: "latest" # leave empty to use the one available on GitHub virtual environment jobs: prepare: runs-on: ubuntu-20.04 steps: - - name: Check version - run: | - version=${{ github.event.inputs.version }} - if [ -z "$version" ]; then - version=20.10.19 - fi - echo "DOCKER_VERSION=$version" >> $GITHUB_ENV - - - name: Check build + name: Prepare uses: actions/github-script@v6 - id: build with: - result-encoding: string script: | + const version = `${{ inputs.version }}` || '23.0.1'; + let build = 'true'; try { - new URL("${{ env.DOCKER_VERSION }}"); + new URL(version); } catch (e) { - return false; + build = 'false'; } - return true; + core.exportVariable('DOCKER_VERSION', version); + core.exportVariable('DOCKER_BUILD', build); - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 with: - version: ${{ env.BUILDX_VERSION }} - driver-opts: image=${{ env.REPO_SLUG_ORIGIN }} + version: ${{ env.SETUP_BUILDX_VERSION }} + driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} buildkitd-flags: --debug - name: Build - if: steps.build.outputs.result == 'true' + if: ${{ env.DOCKER_BUILD == 'true' }} uses: docker/build-push-action@v3 with: context: ${{ env.DOCKER_VERSION }} @@ -58,14 +51,14 @@ jobs: outputs: /tmp/moby - name: Rename binary - if: steps.build.outputs.result == 'true' + if: ${{ env.DOCKER_BUILD == 'true' }} run: | if [ -L "/tmp/moby/binary-daemon/dockerd" ]; then mv -f $(readlink /tmp/moby/binary-daemon/dockerd) /tmp/moby/dockerd fi - name: Download - if: steps.build.outputs.result != 'true' + if: ${{ env.DOCKER_BUILD != 'true' }} run: | mkdir -p /tmp/moby cd /tmp/moby @@ -113,8 +106,8 @@ jobs: name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 with: - version: ${{ env.BUILDX_VERSION }} - driver-opts: image=${{ env.REPO_SLUG_ORIGIN }} + version: ${{ env.SETUP_BUILDX_VERSION }} + driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} buildkitd-flags: --debug - name: Download dockerd diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 6368bcc92fc11..336d651d2cb34 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -18,11 +18,11 @@ on: - 'frontend/dockerfile/docs/**' env: - REPO_SLUG_ORIGIN: "moby/buildkit:latest" - REPO_SLUG_TARGET: "docker/dockerfile-upstream" - PLATFORMS: "linux/386,linux/amd64,linux/arm/v7,linux/arm64,linux/mips,linux/mipsle,linux/mips64,linux/mips64le,linux/s390x,linux/ppc64le,linux/riscv64" - BUILDX_VERSION: "latest" # leave empty to use the one available on GitHub virtual environment GO_VERSION: "1.19" + SETUP_BUILDX_VERSION: "latest" + SETUP_BUILDKIT_TAG: "moby/buildkit:latest" + IMAGE_NAME: "docker/dockerfile-upstream" + PLATFORMS: "linux/386,linux/amd64,linux/arm/v7,linux/arm64,linux/mips,linux/mipsle,linux/mips64,linux/mips64le,linux/s390x,linux/ppc64le,linux/riscv64" jobs: test: @@ -96,8 +96,8 @@ jobs: name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 with: - version: ${{ env.BUILDX_VERSION }} - driver-opts: image=${{ env.REPO_SLUG_ORIGIN }} + version: ${{ env.SETUP_BUILDX_VERSION }} + driver-opts: image=${{ env.SETUP_BUILDKIT_TAG }} buildkitd-flags: --debug - name: Login to DockerHub @@ -109,7 +109,7 @@ jobs: - name: Build run: | - ./frontend/dockerfile/cmd/dockerfile-frontend/hack/release "${{ needs.prepare.outputs.typ }}" "${{ matrix.tag }}" "$REPO_SLUG_TARGET" "${{ needs.prepare.outputs.push }}" + ./frontend/dockerfile/cmd/dockerfile-frontend/hack/release "${{ needs.prepare.outputs.typ }}" "${{ matrix.tag }}" "$IMAGE_NAME" "${{ needs.prepare.outputs.push }}" env: RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') }} CACHE_FROM: type=gha,scope=${{ env.CACHE_SCOPE }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index d0fc08398fac5..2bfdc263eecc8 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -15,8 +15,8 @@ on: pull_request: env: - REPO_SLUG_ORIGIN: "moby/buildkit:latest" - BUILDX_VERSION: "latest" # leave empty to use the one available on GitHub virtual environment + SETUP_BUILDX_VERSION: "latest" + SETUP_BUILDKIT_IMAGE: "moby/buildkit:latest" jobs: validate: @@ -37,8 +37,8 @@ jobs: name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 with: - version: ${{ env.BUILDX_VERSION }} - driver-opts: image=${{ env.REPO_SLUG_ORIGIN }} + version: ${{ env.SETUP_BUILDX_VERSION }} + driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} buildkitd-flags: --debug - name: Run