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

non-deterministic behavior in examples docs generation #939

Closed
jazzyfresh opened this issue Mar 30, 2023 · 5 comments
Closed

non-deterministic behavior in examples docs generation #939

jazzyfresh opened this issue Mar 30, 2023 · 5 comments
Assignees
Labels
area/docsgen Issues with docs capture or example rendering, historically part of pkg/tfgen kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed size/L Estimated effort to complete (up to 10 days).

Comments

@jazzyfresh
Copy link
Contributor

What happened?

Running make tfgen on the pulumi-gitlab provider non-deterministically removes & adds an example from the docs generation in the schema

The example for the gitlab.UserGpgKey resource is added/removed from various languages (typescript, python, dotnet, go, yaml, java) on every run.
Screen Shot 2023-03-30 at 8 49 33 AM

csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing GitLab = Pulumi.GitLab;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var exampleUser = GitLab.GetUser.Invoke(new()\n {\n Username = "example-user",\n });\n\n // Manages a GPG key for the specified user. An admin token is required if user_id is specified.\n var exampleUserGpgKey = new GitLab.UserGpgKey("exampleUserGpgKey", new()\n {\n UserId = exampleUser.Apply(getUserResult =\sult.Id),\n Key = @"-----BEGIN PGP PUBLIC KEY BLOCK-----\n...\n-----END PGP PUBLIC KEY BLOCK-----",\n });\n\ a GPG key for the current user\n var exampleUserUserGpgKey = new GitLab.UserGpgKey("exampleUserUserGpgKey", new()\ Key = @"-----BEGIN PGP PUBLIC KEY BLOCK-----\n...\n-----END PGP PUBLIC KEY BLOCK-----",\n });\n\n});\n\n

Expected Behavior

make tfgen should be consistent every time!

Steps to reproduce

This behavior was discovered on a branch that added auto-token mapping to the gitlab provider, it may have to do with that.

git clone git@github.com:pulumi/pulumi-gitlab.git
cd pulumi-gitlab
git fetch
git checkout jazzyfresh/auto-token-map
make tfgen    # may need to repeat make tfgen a few times to see the schema change
git status    # you will see the schema.json change
git diff      # you will see only the examples for the UserGpgKey resource being modified

Output of pulumi about

from the pulumi-gitlab/examples directory
Screen Shot 2023-03-30 at 8 59 45 AM

Additional context

No response

Contributing

No response

@jazzyfresh jazzyfresh added needs-triage Needs attention from the triage team kind/bug Some behavior is incorrect or out of spec labels Mar 30, 2023
@jazzyfresh jazzyfresh self-assigned this Mar 30, 2023
@jazzyfresh jazzyfresh removed the needs-triage Needs attention from the triage team label Mar 30, 2023
@jazzyfresh
Copy link
Contributor Author

jazzyfresh commented Mar 30, 2023

More debugging notes:

@jazzyfresh
Copy link
Contributor Author

a similar prior bug #521

@jazzyfresh
Copy link
Contributor Author

possibly unrelated, but this warning does show up in the output.

warning: unable to convert HCL example for Pulumi entity '#/functions/gitlab:index/getUser:getUser': 6 errors occurred:
	* failed to convert HCL for #/functions/gitlab:index/getUser:getUser to typescript: #-functions-gitlab:index-getUser:getUser.pp:3,37-42: unknown function 'toset'; 
	* failed to convert HCL for #/functions/gitlab:index/getUser:getUser to python: #-functions-gitlab:index-getUser:getUser.pp:3,37-42: unknown function 'toset'; 
	* failed to convert HCL for #/functions/gitlab:index/getUser:getUser to csharp: #-functions-gitlab:index-getUser:getUser.pp:3,37-42: unknown function 'toset'; 
	* failed to convert HCL for #/functions/gitlab:index/getUser:getUser to go: #-functions-gitlab:index-getUser:getUser.pp:3,37-42: unknown function 'toset'; 
	* failed to convert HCL for #/functions/gitlab:index/getUser:getUser to yaml: #-functions-gitlab:index-getUser:getUser.pp:3,37-42: unknown function 'toset'; 
	* failed to convert HCL for #/functions/gitlab:index/getUser:getUser to java: #-functions-gitlab:index-getUser:getUser.pp:3,37-42: unknown function 'toset';

no warnings are logged for userGpgKey however

@jazzyfresh
Copy link
Contributor Author

looking more closely at the rendered string above in and comparing it to the original hcl example

  • data "gitlab_user" "example" =>
    exampleIndex/getUserUser = invoke("gitlab:index/getUser:getUser",
  • resource "gitlab_user_gpgkey" "example" =>
    resource exampleUserGpgKey "gitlab:index/userGpgKey:UserGpgKey"
  • data.gitlab_user.example.id => exampleIndex/getUserUser.id
  • resource "gitlab_user_gpgkey" "example_user" =>
    resource exampleUser "gitlab:index/userGpgKey:UserGpgKey"

everything else is rendered correctly

@t0yv0 t0yv0 added area/docsgen Issues with docs capture or example rendering, historically part of pkg/tfgen size/L Estimated effort to complete (up to 10 days). labels Apr 5, 2023
@iwahbe iwahbe added the resolution/fixed This issue was fixed label May 5, 2023
@iwahbe
Copy link
Member

iwahbe commented May 5, 2023

This was closed by #1041.

@iwahbe iwahbe closed this as completed May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docsgen Issues with docs capture or example rendering, historically part of pkg/tfgen kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed size/L Estimated effort to complete (up to 10 days).
Projects
None yet
Development

No branches or pull requests

3 participants