Skip to content

Commit

Permalink
Update resourcedocsgen to pull in pulumi/pulumi updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cnunciato committed Aug 10, 2023
1 parent 9380b93 commit cb9a8d2
Show file tree
Hide file tree
Showing 3 changed files with 1,148 additions and 209 deletions.
29 changes: 27 additions & 2 deletions tools/resourcedocsgen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,39 @@ and for the nav tree it is `static/registry/packages/navs/<package name>.json`.
This tool depends on the `pulumi/pulumi` repo, namely the `pkg/codegen/docs` generator.
The docs generator uses Go-based [templates](https://github.com/pulumi/pulumi/tree/master/pkg/codegen/docs/templates) to render the markdown files in-memory which this tool then writes to the filesystem.

To make changes to the templates, make sure you have `pulumi/pulumi` cloned locally and override the `github.com/pulumi/pulumi/pkg/v3` dependency to point to
your local repo for testing out the changes to the templates. Once done, you must submit a PR to the `pulumi/pulumi` repo.
To make changes to the templates, make sure you have `pulumi/pulumi` cloned locally and override the `github.com/pulumi/pulumi/pkg/v3` dependency to point to your local repo for testing out the changes to the templates. To do that, add the following lines to the `go.mod` file in this folder:

```go
replace github.com/pulumi/pulumi/pkg/v3 => ../../../pulumi/pkg
replace github.com/pulumi/pulumi/sdk/v3 => ../../../pulumi/sdk
```

Then, build and run `resourcedocsgen`:

```bash
go mod tidy
go build -o "${GOPATH}/bin/resourcedocsgen" .
```

```bash
resourcedocsgen docs \
--docsOutDir "../../../pulumi-hugo/themes/default/content/registry/packages/aws/api-docs" \
--schemaFile "../../../pulumi-aws/provider/cmd/pulumi-resource-aws/schema.json" \
--version "v5.42.0" \
--packageTreeJSONOutDir "../../../pulumi-hugo/themes/default/static/registry/packages/navs" \
--logtostderr
```

Remember to rebuild `resourcedocsgen` after any making any changes to `pulumi/pulumi`.

Once done, you must submit a PR to the `pulumi/pulumi` repo.

Once your `pulumi/pulumi` PR is merged, you should update the pseudo-version that this tool uses by running:

```
go get -u github.com/pulumi/pulumi/pkg/v3@<commit hash>
go get -u github.com/pulumi/pulumi/sdk/v3@<commit hash>
go mod tidy
```

To update to latest pulumi/pulumi use
Expand Down
17 changes: 11 additions & 6 deletions tools/resourcedocsgen/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ go 1.16

require (
github.com/ghodss/yaml v1.0.0
github.com/golang/glog v1.0.0
github.com/hashicorp/hcl/v2 v2.15.0
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/glog v1.1.1
github.com/hashicorp/hcl/v2 v2.17.0
github.com/pkg/errors v0.9.1
github.com/pulumi/pulumi/pkg/v3 v3.54.0
github.com/pulumi/pulumi/sdk/v3 v3.54.0
github.com/spf13/cobra v1.6.1
gocloud.dev/secrets/hashivault v0.28.0 // indirect
github.com/pulumi/pulumi/pkg/v3 v3.78.1-0.20230810211340-2a883b106f01
github.com/pulumi/pulumi/sdk/v3 v3.78.1-0.20230810211340-2a883b106f01
github.com/spf13/cobra v1.7.0
gocloud.dev/secrets/hashivault v0.33.0 // indirect
)

// I'll remove these lines and update go.mod/sum appropriately before merging.
// replace github.com/pulumi/pulumi/pkg/v3 => ../../../pulumi/pkg
// replace github.com/pulumi/pulumi/sdk/v3 => ../../../pulumi/sdk
Loading

0 comments on commit cb9a8d2

Please sign in to comment.