From 85f13ecf5dc09bbff04199169a0d3453ffd86371 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Mon, 25 Jul 2022 11:07:23 +0200 Subject: [PATCH 1/2] ci: add lab branch to publish workflow Signed-off-by: CrazyMax --- .github/workflows/publish.yml | 7 + _releaser/_website-config-docs-lab.json | 388 ++++++++++++++++++++++++ 2 files changed, 395 insertions(+) create mode 100644 _releaser/_website-config-docs-lab.json diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9d854f3e7273..96531d852232 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,6 +3,7 @@ name: publish on: push: branches: + - lab - master - published @@ -26,6 +27,10 @@ jobs: DOCS_S3_CONFIG="_website-config-docs.json" DOCS_LAMBDA_FUNCTION_CACHE="arn:aws:lambda:us-east-1:710015040892:function:docs-cache-invalidator" DOCS_SLACK_MSG="Successfully published docs. https://docs.docker.com/" + elif [ "${{ github.ref }}" = "refs/heads/lab" ]; then + DOCS_S3_BUCKET="" + DOCS_LAMBDA_FUNCTION_CACHE="" + DOCS_S3_CONFIG="_website-config-docs-lab.json" fi echo "JEKYLL_ENV=$JEKYLL_ENV" >> $GITHUB_ENV echo "DOCS_AWS_REGION=$DOCS_AWS_REGION" >> $GITHUB_ENV @@ -69,6 +74,7 @@ jobs: AWS_S3_CONFIG: ${{ env.DOCS_S3_CONFIG }} - name: Invalidate docs website cache + if: ${{ env.DOCS_LAMBDA_FUNCTION_CACHE != '' }} uses: docker/bake-action@v2 with: targets: aws-lambda-invoke @@ -81,5 +87,6 @@ jobs: AWS_LAMBDA_FUNCTION: ${{ env.DOCS_LAMBDA_FUNCTION_CACHE }} - name: Send Slack notification + if: ${{ env.DOCS_SLACK_MSG != '' }} run: | curl -X POST -H 'Content-type: application/json' --data '{"text":"${{ env.DOCS_SLACK_MSG }}"}' ${{ secrets.SLACK_WEBHOOK }} diff --git a/_releaser/_website-config-docs-lab.json b/_releaser/_website-config-docs-lab.json new file mode 100644 index 000000000000..85fc6e8f1df1 --- /dev/null +++ b/_releaser/_website-config-docs-lab.json @@ -0,0 +1,388 @@ +{ + "ErrorDocument": { + "Key": "404.html" + }, + "IndexDocument": { + "Suffix": "index.html" + }, + "RedirectAllRequestsTo": null, + "RoutingRules": [ + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v1.4/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": "", + "ReplaceKeyWith": null + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v1.5/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": "", + "ReplaceKeyWith": null + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v1.6/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": "", + "ReplaceKeyWith": null + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v1.7/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": "", + "ReplaceKeyWith": null + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v1.8/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": "", + "ReplaceKeyWith": null + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v1.9/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": "", + "ReplaceKeyWith": null + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v1.10/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": "", + "ReplaceKeyWith": null + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v1.11/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": "", + "ReplaceKeyWith": null + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v1.12/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": "", + "ReplaceKeyWith": null + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v1.13/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": "", + "ReplaceKeyWith": null + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v17.03/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": "", + "ReplaceKeyWith": null + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v17.09/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": "", + "ReplaceKeyWith": null + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v17.12/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": "", + "ReplaceKeyWith": null + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "ee/licensing/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": null, + "ReplaceKeyWith": "" + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "ee/get-support/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": null, + "ReplaceKeyWith": "" + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "ee/cluster/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": null, + "ReplaceKeyWith": "" + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "ee/supported-platforms/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": null, + "ReplaceKeyWith": "" + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "ee/ucp/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": null, + "ReplaceKeyWith": "" + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "ee/dtr/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": null, + "ReplaceKeyWith": "" + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "compliance/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": null, + "ReplaceKeyWith": "" + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "datacenter/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": null, + "ReplaceKeyWith": "" + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v18.09/ee/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": null, + "ReplaceKeyWith": "" + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v18.03/ee/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": null, + "ReplaceKeyWith": "" + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v17.06/enterprise/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": null, + "ReplaceKeyWith": "" + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "ee/docker-ee/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": null, + "ReplaceKeyWith": "" + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "ee/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": null, + "ReplaceKeyWith": "" + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v17.06/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": "", + "ReplaceKeyWith": null + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v18.03/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": "", + "ReplaceKeyWith": null + } + }, + { + "Condition": { + "HttpErrorCodeReturnedEquals": null, + "KeyPrefixEquals": "v18.09/" + }, + "Redirect": { + "HostName": "docs-lab.docker.com", + "HttpRedirectCode": null, + "Protocol": "https", + "ReplaceKeyPrefixWith": "", + "ReplaceKeyWith": null + } + } + ] +} From b836e2c5b6c08702be17ba558c632947e5baf74d Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Thu, 21 Jul 2022 13:58:02 +0200 Subject: [PATCH 2/2] ci: allow triggering publish workflow manually Signed-off-by: CrazyMax --- .github/workflows/publish.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 96531d852232..b68fedc3bc1d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,7 @@ name: publish on: + workflow_dispatch: push: branches: - lab @@ -31,6 +32,9 @@ jobs: DOCS_S3_BUCKET="" DOCS_LAMBDA_FUNCTION_CACHE="" DOCS_S3_CONFIG="_website-config-docs-lab.json" + else + echo >&2 "ERROR: unknown branch ${{ github.ref }}" + exit 1 fi echo "JEKYLL_ENV=$JEKYLL_ENV" >> $GITHUB_ENV echo "DOCS_AWS_REGION=$DOCS_AWS_REGION" >> $GITHUB_ENV