-
Notifications
You must be signed in to change notification settings - Fork 71
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
Support install-only workflow. #834
Conversation
src/__tests__/run.test.ts
Outdated
@@ -1,7 +1,53 @@ | |||
import * as pulumiCli from "../libs/pulumi-cli"; | |||
import { login } from '../login'; | |||
// import * as loginModule from '../login'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead code
@Frassle I still need to rebase but otherwise I'm ready for another review. This commit message explains how I embraced your suggestion and the design constraints on this changeset. |
Hi 👋 Thank you for this contribution! |
28bed6a
to
ea6cbc9
Compare
If the tests use the pulumi installed on the GitHub workers, then they can potentially mask bugs in the action's install step, which is what happened in #834.
b6a5df2
to
49674db
Compare
Current dependencies on/for this PR: This comment was auto-generated by Graphite. |
Updates:
|
If the tests use the pulumi installed on the GitHub workers, then they can potentially mask bugs in the action's install step, which is what happened in #834.
This commit adds support for an install-only workflow. If command is not specified, this will halt execution after the CLI is installed. This attempts to replicate the @pulumi/setup-pulumi action. To test this, most logic in main() was moved to a separate file which can be imported in a test context, unlike main.ts, which executes main() during resolution.
Adds a test to verify that the action can run in install-only mode.
Makes reviewing this PR easier by undoing the refactor.
The job was broken because in adding support for install-only we neglected to run the install in the run case.
Marks `command` and `stack-name` as optional. Updates guidance in README about install-only mode.
There's something smelly about using the ValidationError to decide whether we should run in install-only or action mode. Switch to a plain value returned by runtimes.validate (it has a success: bool field) and use that to decide if we're in install-only or full mode. This gets rid of the extraneous `else throw` as well, because the install-only mode will never throw an exception.
974ad32
to
bb28bd2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with writing actions or this codebase, but I read over the change and it generally LGTM, aside from some minor questions.
CHANGELOG.md
Outdated
- feat: Add support for an `install` command, similar to | ||
[setup-pulumi](https://github.com/marketplace/actions/setup-pulumi) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this listed under 3.2.1 and not HEAD?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, probably because there was a release since this change was made and git merge decided to put it in the old position. Good catch.
CHANGELOG.md
Outdated
- feat: Add support for an `install` command, similar to | ||
[setup-pulumi](https://github.com/marketplace/actions/setup-pulumi) | ||
|
||
-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's with this trailing --
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this was added. Will fix.
(Somehow I didn't look over the changelog thoroughly.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Figured out where the --
came from.
The --
separates the unreleased section from the rest. (https://github.com/pulumi/actions/blob/master/CONTRIBUTING.md)
However, because the original changelog entry was added below a then-unreleased entry,
when git merged these changes with master, it placed this entry under the original unreleased entry.
src/__tests__/run.test.ts
Outdated
@@ -3,6 +3,53 @@ import { login } from '../login'; | |||
|
|||
const spy = jest.spyOn(pulumiCli, 'run'); | |||
|
|||
const installConfig: Record<string, string> = { | |||
command: undefined, | |||
pulumiVersion: "^4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this ^4
vs. ^3
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likely because the test wanted to verify with a non-default value.
However, I also see that this test doesn't actually verify the result at all.
I'm going to use something older (^2
?) here and update the test to verify that the non-default value is picked up.
The test only verifies the truthiness of the value. Change it to verify the actual result. This also caught a bug in the test: It was using `pulumiVersion`, not `pulumi-version`, which is the name of the actual input.
This commit adds an
install
command option which halts execution after the Pulumi CLI is installed. This attempts to replicate the@pulumi/setup-pulumi
action. To test this, most logic in main() was moved to a separate file that can be imported in a test context, unlikemain.ts
, which executesmain()
during resolution.Fixes #686