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

Refactor convert command to add entrypoint for pulumi convert debugging #10879

Merged
merged 1 commit into from Oct 5, 2022

Conversation

AaronFriel
Copy link
Member

This moves the bulk of the convert logic into a function that can be run in a unit test, along with a trivial unit test entry point.

This codifies the approach I've used (writing micro programs after modifying convert.go) to debug panics in Pulumi YAML.

@pulumi-bot
Copy link
Contributor

pulumi-bot commented Sep 28, 2022

Changelog

[uncommitted] (2022-10-04)

@AaronFriel AaronFriel added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label Sep 29, 2022
@AaronFriel
Copy link
Member Author

bors merge

bors bot added a commit that referenced this pull request Oct 4, 2022
10879: Refactor convert command to add entrypoint for pulumi convert debugging r=AaronFriel a=AaronFriel

This moves the bulk of the convert logic into a function that can be run in a unit test, along with a trivial unit test entry point.

This codifies the approach I've used (writing micro programs after modifying `convert.go`) to debug panics in Pulumi YAML.

Co-authored-by: Aaron Friel <mayreply@aaronfriel.com>
@bors
Copy link
Contributor

bors bot commented Oct 4, 2022

Build failed:

@AaronFriel
Copy link
Member Author

bors retry

bors bot added a commit that referenced this pull request Oct 4, 2022
10879: Refactor convert command to add entrypoint for pulumi convert debugging r=AaronFriel a=AaronFriel

This moves the bulk of the convert logic into a function that can be run in a unit test, along with a trivial unit test entry point.

This codifies the approach I've used (writing micro programs after modifying `convert.go`) to debug panics in Pulumi YAML.

Co-authored-by: Aaron Friel <mayreply@aaronfriel.com>
@bors
Copy link
Contributor

bors bot commented Oct 4, 2022

Build failed:

@AaronFriel
Copy link
Member Author

bors retry

bors bot added a commit that referenced this pull request Oct 5, 2022
10879: Refactor convert command to add entrypoint for pulumi convert debugging r=AaronFriel a=AaronFriel

This moves the bulk of the convert logic into a function that can be run in a unit test, along with a trivial unit test entry point.

This codifies the approach I've used (writing micro programs after modifying `convert.go`) to debug panics in Pulumi YAML.

10921: ci: Unblock local ProgramTest usage r=AaronFriel a=AaronFriel

The first commit removes a redundant check to skip the test in `prepareProgram`, given the check in `newProgramTester`:

https://github.com/pulumi/pulumi/blob/2b1b4fb0b4d6d2c32cd1303957babc2942703eb4/pkg/testing/integration/program.go#L761-L769

The second refactors the two functions, given that both are private to the test package and `prepareProgram` is called if and only if it's immediately followed by `newProgramTest`. The former is now a side-effecting function that mutates its options, the latter is a pure constructor.

10928: chore: Update go modules via go mod tidy r=Frassle a=kpitzen

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

Fixes # (issue)

## Checklist

<!--- 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 Service,
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 Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


10930: ci: Enable gh cli in every step of job r=AaronFriel a=AaronFriel

Fixes the issue where the `gh` CLI reported that no token was present: https://github.com/pulumi/pulumi/actions/runs/3145787399/jobs/5113494314

Co-authored-by: Aaron Friel <mayreply@aaronfriel.com>
Co-authored-by: Kyle Pitzen <kyle.pitzen@gmail.com>
@bors
Copy link
Contributor

bors bot commented Oct 5, 2022

Build failed (retrying...):

bors bot added a commit that referenced this pull request Oct 5, 2022
10879: Refactor convert command to add entrypoint for pulumi convert debugging r=AaronFriel a=AaronFriel

This moves the bulk of the convert logic into a function that can be run in a unit test, along with a trivial unit test entry point.

This codifies the approach I've used (writing micro programs after modifying `convert.go`) to debug panics in Pulumi YAML.

10921: ci: Unblock local ProgramTest usage r=AaronFriel a=AaronFriel

The first commit removes a redundant check to skip the test in `prepareProgram`, given the check in `newProgramTester`:

https://github.com/pulumi/pulumi/blob/2b1b4fb0b4d6d2c32cd1303957babc2942703eb4/pkg/testing/integration/program.go#L761-L769

The second refactors the two functions, given that both are private to the test package and `prepareProgram` is called if and only if it's immediately followed by `newProgramTest`. The former is now a side-effecting function that mutates its options, the latter is a pure constructor.

Co-authored-by: Aaron Friel <mayreply@aaronfriel.com>
@bors
Copy link
Contributor

bors bot commented Oct 5, 2022

Build failed (retrying...):

bors bot added a commit that referenced this pull request Oct 5, 2022
10879: Refactor convert command to add entrypoint for pulumi convert debugging r=AaronFriel a=AaronFriel

This moves the bulk of the convert logic into a function that can be run in a unit test, along with a trivial unit test entry point.

This codifies the approach I've used (writing micro programs after modifying `convert.go`) to debug panics in Pulumi YAML.

10932: sdk/go: Move unsafe API to internals package r=AaronFriel a=AaronFriel

Following internal discussion, expose this function on a separate package: `sdk/v3/go/pulumi/internals`.

Co-authored-by: Aaron Friel <mayreply@aaronfriel.com>
bors bot added a commit that referenced this pull request Oct 5, 2022
10879: Refactor convert command to add entrypoint for pulumi convert debugging r=AaronFriel a=AaronFriel

This moves the bulk of the convert logic into a function that can be run in a unit test, along with a trivial unit test entry point.

This codifies the approach I've used (writing micro programs after modifying `convert.go`) to debug panics in Pulumi YAML.

10932: sdk/go: Move unsafe API to internals package r=AaronFriel a=AaronFriel

Following internal discussion, expose this function on a separate package: `sdk/v3/go/pulumi/internals`.

Co-authored-by: Aaron Friel <mayreply@aaronfriel.com>
@bors
Copy link
Contributor

bors bot commented Oct 5, 2022

Build failed (retrying...):

@bors
Copy link
Contributor

bors bot commented Oct 5, 2022

Build succeeded:

@bors bors bot merged commit 0cbd78a into master Oct 5, 2022
@bors bors bot deleted the friel/easy-convert-debug branch October 5, 2022 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/no-changelog-required This issue doesn't require a CHANGELOG update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants