Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write _index.md to local docs dir on Any TF Provider #2717

Merged
merged 11 commits into from
Dec 18, 2024

Conversation

guineveresaenger
Copy link
Contributor

@guineveresaenger guineveresaenger commented Dec 11, 2024

Update: Rebased against #2742 which adds Cobra. Blocked until that merges.

This pull request adds a registryDocs Generator to the initialSetup call for a dynamic provider.

Adjustments to accommodate this change:

  • Because the generation instructions will necessarily include the string terraform, the section needs to be added after the edit rules are applied.
  • The logic to determine which installation instruction to generate is hinged on info.Repository, which is the source repo of the provider. If it doesn't contain "pulumi" then we're dealing with an Any TF provider.
  • _index.md is written to a user-specified (via flag) --indexDocOutDir. This allows us to write to any location in a file system. Leaving this blank prompts the file to only get written to the virtual filesystem in the bridge.
  • An integration test is added that verifies generation and translation of the _index.md file` from hashicorp/random.

@guineveresaenger guineveresaenger self-assigned this Dec 11, 2024
@guineveresaenger guineveresaenger marked this pull request as ready for review December 12, 2024 01:40
@guineveresaenger guineveresaenger requested a review from a team December 12, 2024 01:40
dynamic/main.go Outdated Show resolved Hide resolved
dynamic/main.go Outdated Show resolved Hide resolved
dynamic/parameterize/args.go Outdated Show resolved Hide resolved
pkg/tfgen/installation_docs.go Outdated Show resolved Hide resolved
pkg/tfgen/installation_docs.go Outdated Show resolved Hide resolved
@guineveresaenger guineveresaenger force-pushed the guin/add-index-md-dynamic branch 3 times, most recently from dfce611 to d78582a Compare December 13, 2024 02:16
@guineveresaenger guineveresaenger force-pushed the guin/add-index-md-dynamic branch from d78582a to 5975878 Compare December 14, 2024 01:32
@guineveresaenger guineveresaenger added the blocked The issue cannot be resolved without 3rd party action. label Dec 14, 2024
Copy link

codecov bot commented Dec 14, 2024

Codecov Report

Attention: Patch coverage is 91.30435% with 6 lines in your changes missing coverage. Please review.

Project coverage is 68.67%. Comparing base (b337517) to head (b270e1a).
Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
dynamic/main.go 76.00% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2717      +/-   ##
==========================================
+ Coverage   68.60%   68.67%   +0.06%     
==========================================
  Files         322      322              
  Lines       41223    41279      +56     
==========================================
+ Hits        28282    28349      +67     
+ Misses      11348    11333      -15     
- Partials     1593     1597       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@iwahbe iwahbe removed the blocked The issue cannot be resolved without 3rd party action. label Dec 16, 2024
guineveresaenger added a commit that referenced this pull request Dec 16, 2024
Simplify args parsing by using cobra.

My hope is that this will make the implementation of
#2717 much easier.
iwahbe and others added 9 commits December 17, 2024 11:01
This allows modules outside of the bridge to test code that uses
`tfbridge.GetLogger`. This will be used by `dynamic`. It may also be used by AWS, which
currently has test code which uses the now moved-to-internal logging.InitContext.
This gets us out of the business of writing flag parsing. This does change the format of
options. Before, they looked like:

```console
$ pulumi package get-schema registry.opentofu.org/owner/provider version fullDocs=true
```

They now look like:

```console
$ pulumi package get-schema -- registry.opentofu.org/owner/provider version --fullDocs
```
clean up installation instructions
@guineveresaenger guineveresaenger force-pushed the guin/add-index-md-dynamic branch from 5975878 to a282973 Compare December 17, 2024 19:25
Copy link
Member

@iwahbe iwahbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 nits, but otherwise LGTM.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be removed. In favor of unstable/testutils.

Comment on lines 103 to 114
// ****
//
// Installation
// The Foo provider is available as a package in all Pulumi languages:
//
// JavaScript/TypeScript: @pulumi/foo
// Python: pulumi-foo
// Go: github.com/pulumi/pulumi-foo/sdk/v3/go/foo
// .NET: Pulumi.foo
// Java: com.pulumi/foo
//
// ****
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// ****
//
// Installation
// The Foo provider is available as a package in all Pulumi languages:
//
// JavaScript/TypeScript: @pulumi/foo
// Python: pulumi-foo
// Go: github.com/pulumi/pulumi-foo/sdk/v3/go/foo
// .NET: Pulumi.foo
// Java: com.pulumi/foo
//
// ****
//
// Installation
// The Foo provider is available as a package in all Pulumi languages:
//
// JavaScript/TypeScript: @pulumi/foo
// Python: pulumi-foo
// Go: github.com/pulumi/pulumi-foo/sdk/v3/go/foo
// .NET: Pulumi.foo
// Java: com.pulumi/foo
//

@guineveresaenger guineveresaenger enabled auto-merge (squash) December 18, 2024 18:42
@guineveresaenger guineveresaenger merged commit 5c9f559 into master Dec 18, 2024
17 checks passed
@guineveresaenger guineveresaenger deleted the guin/add-index-md-dynamic branch December 18, 2024 19:44
@pulumi-bot
Copy link
Contributor

This PR has been shipped in release v3.99.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants