pulumi / ci-mgmt

Configuration for all things CI
Apache License 2.0
11 stars 4 forks source link

Run build_registry_docs as part of SDK build #1152

Open guineveresaenger opened 4 days ago

guineveresaenger commented 4 days ago

https://github.com/pulumi/pulumi-snowflake/issues/752 revealed that we weren't running registry docs build on pull requests. This addresses that issue. Index docs will now be built on pull requests in CI.

iwahbe commented 3 days ago

I would implement this via the Makefile:

-build_sdks: build_nodejs build_python build_dotnet build_go build_java build_registry_docs
+-build_sdks: build_nodejs build_python build_dotnet build_go build_java
-tfgen: install_plugins upstream tfgen_no_deps
+tfgen: install_plugins upstream tfgen_no_deps build_registry_docs\

It feels like generating docs is more in the make tfgen category (with the schema) then as an SDK artifact.

guineveresaenger commented 3 days ago

Unfortunately @iwahbe's suggestion won't work - make registry_docs depends on make tfgen (having the provider binary, with edit rules).

It doesn't look like we're doing anything with the result of the build That's right, it's a plain "is this still valid" check

If we're just trying to assert that the files are up to date Not quite - my approach was perhaps a bit simplistic - I want to run this as a separate check that would fail if there were docs changes incompatible with docs replaces that have a hard fail baked into them.

It sounds like two things should happen here:

  1. Perhaps run this as part of prerequisites so we don't run it four times 😅
  2. show the dependency on make tfgen in the Makefile.
iwahbe commented 23 hours ago

Unfortunately @iwahbe's suggestion won't work - make registry_docs depends on make tfgen (having the provider binary, with edit rules).

This works for me (tested in random from a cleaned repo):

 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 455c4723..225d1d7a 100644
--- a/Makefile
+++ b/Makefile
@@ -31,7 +31,7 @@ development: install_plugins provider build_sdks install_sdks

 build: install_plugins provider build_sdks install_sdks

-build_sdks: build_nodejs build_python build_dotnet build_go build_java build_registry_docs
+build_sdks: build_nodejs build_python build_dotnet build_go build_java

 install_go_sdk:

@@ -99,7 +99,7 @@ build_python: upstream
        ../venv/bin/python -m build .

 # Run the bridge's registry-docs command to generated the content of the installation docs/ folder at provider repo root
-build_registry_docs:
+build_registry_docs: upstream tfgen_build_only
    $(WORKING_DIR)/bin/$(TFGEN) registry-docs --out $(WORKING_DIR)/docs

 clean:
@@ -155,7 +155,7 @@ test_provider:
    @echo ""
    cd provider && go test -v -short ./... -parallel $(TESTPARALLELISM)

-tfgen: install_plugins upstream tfgen_no_deps
+tfgen: install_plugins upstream tfgen_no_deps build_registry_docs

 tfgen_no_deps: export PULUMI_HOME := $(WORKING_DIR)/.pulumi
 tfgen_no_deps: export PATH := $(WORKING_DIR)/.pulumi/bin:$(PATH)

It incurs minimal overhead of make tfgen (only the actual docs generation is a new target) and builds correctly from a clean repo.