Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 50 additions & 68 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,65 +11,48 @@ on:
- main
pull_request:

env:
# Use edge release of buildx (latest RC, fallback to latest stable)
SETUP_BUILDX_VERSION: edge
SETUP_BUILDKIT_IMAGE: "moby/buildkit:latest"

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
releaser:
runs-on: ubuntu-24.04
steps:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ env.SETUP_BUILDX_VERSION }}
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }}
-
name: Build
uses: docker/bake-action@v6
with:
files: |
docker-bake.hcl
targets: releaser-build
uses: docker/github-builder-experimental/.github/workflows/bake.yml@main
permissions:
contents: read
packages: write
id-token: write
with:
output: local
target: releaser-build

build:
runs-on: ubuntu-24.04
needs:
- releaser
steps:
-
name: Checkout
uses: actions/checkout@v5
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build
uses: docker/bake-action@v6
with:
source: .
files: |
docker-bake.hcl
targets: release
-
name: Check Cloudfront config
uses: docker/bake-action@v6
with:
source: .
targets: aws-cloudfront-update
env:
DRY_RUN: true
AWS_REGION: us-east-1
AWS_CLOUDFRONT_ID: 0123456789ABCD
AWS_LAMBDA_FUNCTION: DockerDocsRedirectFunction-dummy
uses: docker/github-builder-experimental/.github/workflows/bake.yml@main
permissions:
contents: read
packages: write
id-token: write
with:
output: local
target: release

check-cloudfront:
uses: docker/github-builder-experimental/.github/workflows/bake.yml@main
permissions:
contents: read
packages: write
id-token: write
with:
output: local
target: aws-cloudfront-update
envs: |
DRY_RUN: true
AWS_REGION: us-east-1
AWS_CLOUDFRONT_ID: 0123456789ABCD
AWS_LAMBDA_FUNCTION: DockerDocsRedirectFunction-dummy

validate:
runs-on: ubuntu-24.04
uses: docker/github-builder-experimental/.github/workflows/bake.yml@main
permissions:
contents: read
packages: write
id-token: write
strategy:
fail-fast: false
matrix:
Expand All @@ -82,29 +65,28 @@ jobs:
- dockerfile-lint
- path-warnings
- validate-vendor
with:
output: local
target: ${{ matrix.target }}
artifact-name: ${{ matrix.target }}

reviewdog:
runs-on: ubuntu-24.04
needs: validate
if: ${{ github.event_name == 'pull_request' }}
steps:
-
name: Checkout
uses: actions/checkout@v5
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Validate
uses: docker/bake-action@v6
name: Download vale output
uses: actions/download-artifact@v4
with:
source: .
files: |
docker-bake.hcl
targets: ${{ matrix.target }}
name: vale
path: ./vale-output
-
name: Install reviewdog
if: ${{ matrix.target == 'vale' && github.event_name == 'pull_request' }}
uses: reviewdog/action-setup@d8a7baabd7f3e8544ee4dbde3ee41d0011c3a93f # v1.5.0
-
name: Run reviewdog for vale
if: ${{ matrix.target == 'vale' && github.event_name == 'pull_request' }}
run: |
cat ./tmp/vale.out | reviewdog -f=rdjsonl -name=vale -reporter=github-pr-annotations -fail-on-error=false -filter-mode=added -level=info -fail-level=warning
cat ./vale-output/vale.out | reviewdog -f=rdjsonl -name=vale -reporter=github-pr-annotations -fail-on-error=false -filter-mode=added -level=info -fail-level=warning
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 7 additions & 1 deletion docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ target "release" {
args = {
HUGO_ENV = HUGO_ENV
DOCS_URL = DOCS_URL
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
}
target = "release"
output = [DOCS_SITE_DIR]
Expand All @@ -44,6 +45,7 @@ group "validate" {
}

target "test" {
args = { BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1 }
target = "test"
output = ["type=cacheonly"]
provenance = false
Expand Down Expand Up @@ -71,16 +73,19 @@ target "unused-media" {
}

target "test-go-redirects" {
args = { BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1 }
target = "test-go-redirects"
output = ["type=cacheonly"]
provenance = false
}

target "dockerfile-lint" {
args = { BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1 }
call = "check"
}

target "path-warnings" {
args = { BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1 }
target = "path-warnings"
output = ["type=cacheonly"]
}
Expand Down Expand Up @@ -143,7 +148,7 @@ target "aws-cloudfront-update" {
context = "hack/releaser"
target = "aws-cloudfront-update"
contexts = {
sitedir = DOCS_SITE_DIR
sitedir = "target:release"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crazy-max ptal at this. Not sure if this is something we should support.

The aws-cloudfront-update target was preceded by a release build:

https://github.com/docker/docs/pull/23745/files#diff-5c3fa597431eda03ac3339ae6bf7f05e1a50d6fc7333679ec38e21b337cb6721L45-L69

The sitedir arg was used to bind mount the public directory into the build, from the local context:

https://github.com/dvdksn/docs/blob/13e9e4e4dd7a0ed54d53ba0996100809b0ce5c90/hack/releaser/Dockerfile#L40

So I changed the sitedir per above, to bind mount the build results from the release stage directly. But that doesn't work with the reusable workflow since we only allow building a single target at once:

https://github.com/docker/docs/actions/runs/19897113629/job/57030322616?pr=23745#step:4:184

}
no-cache-filter = ["aws-cloudfront-update"]
output = ["type=cacheonly"]
Expand All @@ -163,6 +168,7 @@ target "vendor" {
}

target "validate-vendor" {
args = { BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1 }
target = "validate-vendor"
output = ["type=cacheonly"]
}
Expand Down
Loading