pulumi/.github/workflows/ci-test-docs-generation.yml

172 lines
6.0 KiB
YAML
Raw Permalink Normal View History

name: Test Docs Generation
on:
workflow_call:
inputs:
ref:
required: true
description: "GitHub ref to use"
type: string
pull_request_number:
required: true
description: "Pull request number"
type: string
pull_request_author:
required: true
description: "Pull request author, as a login name"
type: string
2020-10-09 16:35:12 +00:00
env:
GITHUB_TOKEN: ${{ secrets.PULUMI_BOT_TOKEN }}
DOTNET_ROLL_FORWARD: "Major"
2020-10-09 16:35:12 +00:00
permissions:
contents: read
jobs:
matrix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: build matrix
id: matrix
run: |
echo "::group::Version set variable"
VERSION_SET=$(./scripts/get-job-matrix.py \
generate-version-set \
--version-set current
)
echo "::endgroup::"
echo "::group::Version set"
echo "$VERSION_SET" | yq -P '.'
echo "::endgroup::"
echo "::group::Set outputs"
./.github/scripts/set-output version-set "${VERSION_SET}"
echo "::endgroup::"
outputs:
version-set: "${{ fromJson(steps.matrix.outputs.version-set) }}"
aws:
name: Resource Docs
needs: [matrix]
# Verify that the event is not triggered by a fork since forks cannot
# access secrets other than the default GITHUB_TOKEN. Specifically,
build resourcedocsgen from registry (#14157) resourcedocsgen has been remved from the pulumi/docs repo in https://github.com/pulumi/docs/pull/10009, so now the related CI build fails. Get it from the pulumi/registry repository instead, where it lives now. Note that this requires https://github.com/pulumi/docs/pull/10053 to be merged first to update the script to no longer try to build the tool. I'm not sure why the CI job didn't break earlier, the first time I noticed it being broken was in https://github.com/pulumi/pulumi/pull/14156. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [ ] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-02-08 13:28:49 +00:00
# this workflow relies on the secret PULUMI_BOT_TOKEN to create a
# draft PR in the docs repo.
env:
GOPATH: ${{ github.workspace }}
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ fromJson(needs.matrix.outputs.version-set).go }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ fromJson(needs.matrix.outputs.version-set).nodejs }}
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ fromJson(needs.matrix.outputs.version-set).python }}
- name: Set up DotNet
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ fromJson(needs.matrix.outputs.version-set).dotnet }}
dotnet-quality: ga
- name: Install Pulumi CLI
uses: pulumi/action-install-pulumi-cli@v1.0.1
- name: Check out source code
uses: actions/checkout@v4
with:
path: pulumi
ref: ${{ inputs.ref }}
build resourcedocsgen from registry (#14157) resourcedocsgen has been remved from the pulumi/docs repo in https://github.com/pulumi/docs/pull/10009, so now the related CI build fails. Get it from the pulumi/registry repository instead, where it lives now. Note that this requires https://github.com/pulumi/docs/pull/10053 to be merged first to update the script to no longer try to build the tool. I'm not sure why the CI job didn't break earlier, the first time I noticed it being broken was in https://github.com/pulumi/pulumi/pull/14156. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [ ] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-02-08 13:28:49 +00:00
token: ${{ secrets.PULUMI_BOT_TOKEN }}
- name: Check out pulumi-aws
uses: actions/checkout@v4
with:
repository: pulumi/pulumi-aws
path: pulumi-aws
build resourcedocsgen from registry (#14157) resourcedocsgen has been remved from the pulumi/docs repo in https://github.com/pulumi/docs/pull/10009, so now the related CI build fails. Get it from the pulumi/registry repository instead, where it lives now. Note that this requires https://github.com/pulumi/docs/pull/10053 to be merged first to update the script to no longer try to build the tool. I'm not sure why the CI job didn't break earlier, the first time I noticed it being broken was in https://github.com/pulumi/pulumi/pull/14156. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [ ] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-02-08 13:28:49 +00:00
token: ${{ secrets.PULUMI_BOT_TOKEN }}
- name: Check out pulumi-kubernetes
uses: actions/checkout@v4
with:
repository: pulumi/pulumi-kubernetes
path: pulumi-kubernetes
build resourcedocsgen from registry (#14157) resourcedocsgen has been remved from the pulumi/docs repo in https://github.com/pulumi/docs/pull/10009, so now the related CI build fails. Get it from the pulumi/registry repository instead, where it lives now. Note that this requires https://github.com/pulumi/docs/pull/10053 to be merged first to update the script to no longer try to build the tool. I'm not sure why the CI job didn't break earlier, the first time I noticed it being broken was in https://github.com/pulumi/pulumi/pull/14156. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [ ] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-02-08 13:28:49 +00:00
token: ${{ secrets.PULUMI_BOT_TOKEN }}
- name: Check out docs
uses: actions/checkout@v4
with:
# Use the PAT and not the default GITHUB_TOKEN since we want to create a branch
# in this workflow and push it to a remote that is NOT the current repo, i.e. pulumi/pulumi.
build resourcedocsgen from registry (#14157) resourcedocsgen has been remved from the pulumi/docs repo in https://github.com/pulumi/docs/pull/10009, so now the related CI build fails. Get it from the pulumi/registry repository instead, where it lives now. Note that this requires https://github.com/pulumi/docs/pull/10053 to be merged first to update the script to no longer try to build the tool. I'm not sure why the CI job didn't break earlier, the first time I noticed it being broken was in https://github.com/pulumi/pulumi/pull/14156. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [ ] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-02-08 13:28:49 +00:00
token: ${{ secrets.PULUMI_BOT_TOKEN }}
repository: pulumi/docs
path: docs
build resourcedocsgen from registry (#14157) resourcedocsgen has been remved from the pulumi/docs repo in https://github.com/pulumi/docs/pull/10009, so now the related CI build fails. Get it from the pulumi/registry repository instead, where it lives now. Note that this requires https://github.com/pulumi/docs/pull/10053 to be merged first to update the script to no longer try to build the tool. I'm not sure why the CI job didn't break earlier, the first time I noticed it being broken was in https://github.com/pulumi/pulumi/pull/14156. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [ ] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-02-08 13:28:49 +00:00
- name: Check out registry
uses: actions/checkout@v4
build resourcedocsgen from registry (#14157) resourcedocsgen has been remved from the pulumi/docs repo in https://github.com/pulumi/docs/pull/10009, so now the related CI build fails. Get it from the pulumi/registry repository instead, where it lives now. Note that this requires https://github.com/pulumi/docs/pull/10053 to be merged first to update the script to no longer try to build the tool. I'm not sure why the CI job didn't break earlier, the first time I noticed it being broken was in https://github.com/pulumi/pulumi/pull/14156. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [ ] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-02-08 13:28:49 +00:00
with:
repository: pulumi/registry
path: registry
- name: Regenerate resource docs
id: regenerate-resource-docs
run: |
PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
BRANCH_NAME="${GITHUB_ACTOR}/${PR_NUMBER}-test-generator-changes"
build resourcedocsgen from registry (#14157) resourcedocsgen has been remved from the pulumi/docs repo in https://github.com/pulumi/docs/pull/10009, so now the related CI build fails. Get it from the pulumi/registry repository instead, where it lives now. Note that this requires https://github.com/pulumi/docs/pull/10053 to be merged first to update the script to no longer try to build the tool. I'm not sure why the CI job didn't break earlier, the first time I noticed it being broken was in https://github.com/pulumi/pulumi/pull/14156. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [ ] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-02-08 13:28:49 +00:00
pushd registry/tools/resourcedocsgen
go mod edit -replace github.com/pulumi/pulumi/pkg/v3=../../../pulumi/pkg
go mod edit -replace github.com/pulumi/pulumi/sdk/v3=../../../pulumi/sdk
build resourcedocsgen from registry (#14157) resourcedocsgen has been remved from the pulumi/docs repo in https://github.com/pulumi/docs/pull/10009, so now the related CI build fails. Get it from the pulumi/registry repository instead, where it lives now. Note that this requires https://github.com/pulumi/docs/pull/10053 to be merged first to update the script to no longer try to build the tool. I'm not sure why the CI job didn't break earlier, the first time I noticed it being broken was in https://github.com/pulumi/pulumi/pull/14156. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [ ] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-02-08 13:28:49 +00:00
go mod tidy
if [ -z "${GOPATH:-}" ]; then
echo "GOPATH is empty. Defaulting to ${HOME}/go"
GOPATH="${HOME}/go"
fi
go build -o "${GOPATH}/bin/resourcedocsgen" .
export PATH="${GOPATH}/bin/":$PATH
popd
build resourcedocsgen from registry (#14157) resourcedocsgen has been remved from the pulumi/docs repo in https://github.com/pulumi/docs/pull/10009, so now the related CI build fails. Get it from the pulumi/registry repository instead, where it lives now. Note that this requires https://github.com/pulumi/docs/pull/10053 to be merged first to update the script to no longer try to build the tool. I'm not sure why the CI job didn't break earlier, the first time I noticed it being broken was in https://github.com/pulumi/pulumi/pull/14156. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [ ] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-02-08 13:28:49 +00:00
# If generating docs for more providers here, be sure to update
# the description of the draft PR that is opened in the next step.
pushd docs
./scripts/gen_resource_docs.sh aws true v5.42.0
./scripts/gen_resource_docs.sh kubernetes true
popd
echo "branchName=${BRANCH_NAME}" >> "${GITHUB_OUTPUT}"
echo "prNumber=${PR_NUMBER}" >> "${GITHUB_OUTPUT}"
- name: Create draft docs PR
uses: peter-evans/create-pull-request@v3
with:
draft: true
# We use a repo:public scoped PAT instead of the implicitly provided GITHUB_TOKEN secret here
# because we want the creation of the docs PR to trigger the `on: pull_request` workflow in the
# docs repo. Using a fork repo to raise the PR would also cause the `on: pull_request` workflow
# to trigger, but currently Pulumify in the docs repo does not run for forks, but we want it to
# generate the preview link.
build resourcedocsgen from registry (#14157) resourcedocsgen has been remved from the pulumi/docs repo in https://github.com/pulumi/docs/pull/10009, so now the related CI build fails. Get it from the pulumi/registry repository instead, where it lives now. Note that this requires https://github.com/pulumi/docs/pull/10053 to be merged first to update the script to no longer try to build the tool. I'm not sure why the CI job didn't break earlier, the first time I noticed it being broken was in https://github.com/pulumi/pulumi/pull/14156. ## Checklist - [ ] I have run `make tidy` to update any new dependencies - [ ] I have run `make lint` to verify my code passes the lint check - [ ] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [ ] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @Pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
2024-02-08 13:28:49 +00:00
token: ${{ secrets.PULUMI_BOT_TOKEN }}
path: docs
committer: Pulumi Bot <bot@pulumi.com>
author: Pulumi Bot <bot@pulumi.com>
commit-message: Regenerate resource docs
title: Preview resource docs changes for pulumi/pulumi#${{ steps.regenerate-resource-docs.outputs.prNumber }}
body: |
This PR was auto-generated from pulumi/pulumi#${{ steps.regenerate-resource-docs.outputs.prNumber }}.
By default, this PR contains regenerated docs for AWS and Kubernetes only.
After review, this PR should be manually closed.
# Assign the draft PR to the author of the current PR.
assignees: ${{ inputs.pull_request_author }}
branch: ${{ steps.regenerate-resource-docs.outputs.branchName }}