mirror of https://github.com/docker/docs.git
Merge pull request #18433 from dvdksn/fix-validate-upstream
ci: fix validate-upstream workflow
This commit is contained in:
commit
16483586b4
|
|
@ -1,5 +1,5 @@
|
||||||
# reusable workflow to validate docs from upstream repository for which pages are remotely fetched
|
# reusable workflow to validate docs from upstream repository for which pages are remotely fetched
|
||||||
# - repo: upstream repository (e.g., https://github.com/docker/buildx)
|
# - module-name: the name of the module, without github.com prefix (e.g., docker/buildx)
|
||||||
# - data-files-id: id of the artifact (using actions/upload-artifact) containing the YAML data files to validate (optional)
|
# - data-files-id: id of the artifact (using actions/upload-artifact) containing the YAML data files to validate (optional)
|
||||||
# - data-files-folder: folder in _data containing the files to download and copy to (e.g., buildx)
|
# - data-files-folder: folder in _data containing the files to download and copy to (e.g., buildx)
|
||||||
name: validate-upstream
|
name: validate-upstream
|
||||||
|
|
@ -7,6 +7,9 @@ name: validate-upstream
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
|
module-name:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
data-files-id:
|
data-files-id:
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
|
|
@ -69,16 +72,18 @@ jobs:
|
||||||
}
|
}
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v3
|
||||||
-
|
-
|
||||||
name: Validate
|
name: Validate
|
||||||
uses: docker/bake-action@v3
|
uses: docker/bake-action@v4
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
docker-bake.hcl
|
docker-bake.hcl
|
||||||
targets: validate
|
targets: validate-upstream
|
||||||
set: |
|
set: |
|
||||||
*.args.REPO="github.com/${{ github.repository }}"
|
|
||||||
*.args.HUGO_MODULE_REPLACEMENTS="github.com/${{ github.repository }} -> github.com/${{ github.repository}} ${{ github.ref }}"
|
|
||||||
*.cache-from=type=gha,scope=docs-upstream
|
*.cache-from=type=gha,scope=docs-upstream
|
||||||
*.cache-to=type=gha,scope=docs-upstream,mode=max
|
*.cache-to=type=gha,scope=docs-upstream,mode=max
|
||||||
|
env:
|
||||||
|
UPSTREAM_MODULE_NAME: ${{ inputs.module-name }}
|
||||||
|
UPSTREAM_REPO: ${{ github.repository }}
|
||||||
|
UPSTREAM_COMMIT: ${{ github.sha }}
|
||||||
|
|
|
||||||
21
Dockerfile
21
Dockerfile
|
|
@ -1,6 +1,7 @@
|
||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
ARG GO_VERSION=1.21
|
ARG GO_VERSION=1.21
|
||||||
|
ARG HTMLTEST_VERSION=0.17.0
|
||||||
|
|
||||||
FROM golang:${GO_VERSION}-alpine as base
|
FROM golang:${GO_VERSION}-alpine as base
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
@ -19,14 +20,13 @@ RUN go install github.com/gohugoio/hugo@v${HUGO_VERSION}
|
||||||
FROM base as build-base
|
FROM base as build-base
|
||||||
COPY --from=hugo $GOPATH/bin/hugo /bin/hugo
|
COPY --from=hugo $GOPATH/bin/hugo /bin/hugo
|
||||||
COPY --from=node /src/node_modules /src/node_modules
|
COPY --from=node /src/node_modules /src/node_modules
|
||||||
|
COPY . .
|
||||||
|
|
||||||
FROM build-base as dev
|
FROM build-base as dev
|
||||||
COPY . .
|
|
||||||
|
|
||||||
FROM build-base as build
|
FROM build-base as build
|
||||||
ARG HUGO_ENV
|
ARG HUGO_ENV
|
||||||
ARG DOCS_URL
|
ARG DOCS_URL
|
||||||
COPY . .
|
|
||||||
RUN hugo --gc --minify -d /out -e $HUGO_ENV -b $DOCS_URL
|
RUN hugo --gc --minify -d /out -e $HUGO_ENV -b $DOCS_URL
|
||||||
|
|
||||||
FROM scratch as release
|
FROM scratch as release
|
||||||
|
|
@ -37,7 +37,7 @@ USER root
|
||||||
RUN --mount=type=bind,target=. \
|
RUN --mount=type=bind,target=. \
|
||||||
/usr/local/bin/markdownlint-cli2 content/**/*.md
|
/usr/local/bin/markdownlint-cli2 content/**/*.md
|
||||||
|
|
||||||
FROM wjdp/htmltest:v0.17.0 as test
|
FROM wjdp/htmltest:v${HTMLTEST_VERSION} as test
|
||||||
WORKDIR /test
|
WORKDIR /test
|
||||||
COPY --from=build /out ./public
|
COPY --from=build /out ./public
|
||||||
ADD .htmltest.yml .htmltest.yml
|
ADD .htmltest.yml .htmltest.yml
|
||||||
|
|
@ -53,3 +53,18 @@ RUN hugo mod vendor
|
||||||
FROM scratch as vendor
|
FROM scratch as vendor
|
||||||
COPY --from=update-modules /src/_vendor /_vendor
|
COPY --from=update-modules /src/_vendor /_vendor
|
||||||
COPY --from=update-modules /src/go.* /
|
COPY --from=update-modules /src/go.* /
|
||||||
|
|
||||||
|
FROM build-base as build-upstream
|
||||||
|
ARG UPSTREAM_MODULE_NAME
|
||||||
|
ARG UPSTREAM_REPO
|
||||||
|
ARG UPSTREAM_COMMIT
|
||||||
|
ENV HUGO_MODULE_REPLACEMENTS="github.com/${UPSTREAM_MODULE_NAME} -> github.com/${UPSTREAM_REPO} ${UPSTREAM_COMMIT}"
|
||||||
|
RUN hugo --ignoreVendorPaths "github.com/${UPSTREAM_MODULE_NAME}" -d /out
|
||||||
|
|
||||||
|
FROM wjdp/htmltest:v${HTMLTEST_VERSION} as validate-upstream
|
||||||
|
WORKDIR /test
|
||||||
|
COPY --from=build-upstream /out ./public
|
||||||
|
ADD .htmltest.yml .htmltest.yml
|
||||||
|
RUN htmltest
|
||||||
|
|
||||||
|
FROM dev
|
||||||
|
|
|
||||||
|
|
@ -148,3 +148,23 @@ target "vendor" {
|
||||||
}
|
}
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "UPSTREAM_MODULE_NAME" {
|
||||||
|
default = null
|
||||||
|
}
|
||||||
|
variable "UPSTREAM_REPO" {
|
||||||
|
default = null
|
||||||
|
}
|
||||||
|
variable "UPSTREAM_MODULE_NAME" {
|
||||||
|
default = null
|
||||||
|
}
|
||||||
|
|
||||||
|
target "validate-upstream" {
|
||||||
|
args {
|
||||||
|
UPSTREAM_MODULE_NAME = UPSTREAM_MODULE_NAME
|
||||||
|
UPSTREAM_REPO = UPSTREAM_REPO
|
||||||
|
UPSTREAM_COMMIT = UPSTREAM_COMMIT
|
||||||
|
}
|
||||||
|
target = "validate-upstream"
|
||||||
|
output = ["type=cacheonly"]
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
title: Docker Docs
|
title: Docker Docs
|
||||||
baseURL: https://docs.docker.com
|
baseURL: https://docs.docker.com
|
||||||
refLinksErrorLevel: WARNING
|
refLinksErrorLevel: ERROR
|
||||||
enableGitInfo: true
|
enableGitInfo: true
|
||||||
disablePathToLower: true
|
disablePathToLower: true
|
||||||
enableInlineShortcodes: true
|
enableInlineShortcodes: true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue