-
Notifications
You must be signed in to change notification settings - Fork 56
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
Add Inline YAML Program Functionality #336
Conversation
Test cases:
|
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.
Please take my comments as suggestions, in general. This is "request changes" because I would like to see comments on the new API fields, so that there are descriptions in the documentation.
This commit implements the handling of Stacks that refer to Programs, by adding a case for .spec.programRef, a func to setup the workspace, and a special case for rescheduling.
7999e10
to
9127fd0
Compare
NB: the codegen (via `crdoc`) fails to escape angle braces in the enum values, so docs/programs.md is not quite correct. Ideally we can fix the upstream bug at some point. Signed-off-by: Michael Bridgen <mbridgen@pulumi.com> Co-authored-by: Roo Thorp <roo@pulumi.com>
9127fd0
to
c0f70d1
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.
Looks good; there's a couple of cosmetic things that could be changed, but neither is a one way door. Nice work! 🍎
reqLogger.Info("New commit hash found", "Current commit", currentCommit, | ||
"Last commit", instance.Status.LastUpdate.LastSuccessfulCommit) | ||
} | ||
} |
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.
Note to self: we've kept this repeated section deliberately, for now, to keep the pattern of if-then-else with the various sources. We should revisit the control flow of the whole method, at some point.
@@ -868,6 +905,70 @@ func (sess *reconcileStackSession) SetupWorkdirFromGitSource(ctx context.Context | |||
return revision, sess.setupWorkspace(ctx, w) | |||
} | |||
|
|||
// ProjectFile adds required Pulumi 'project' fields to the Program spec, making it valid to be given to 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.
👍
pkg/apis/pulumi/v1/program_types.go
Outdated
} | ||
|
||
// +kubebuilder:validation:Enum={"String", "Number", "List<Number>", "List<String>"} | ||
type ConfigTypes string |
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.
type ConfigTypes string | |
type ConfigType string |
It would be conventional for the type name to be singular here: ConfigType. The name doesn't form part of the public API (except in so far as it's exported from this package), though.
pkg/apis/pulumi/v1/program_types.go
Outdated
type Configuration struct { | ||
// type is the (required) data type for the parameter. | ||
// +optional | ||
Type ConfigTypes `json:"type,omitempty"` |
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.
Type ConfigTypes `json:"type,omitempty"` | |
Type ConfigType `json:"type,omitempty"` |
test/program_test.go
Outdated
if strings.HasPrefix(tmpDir, os.TempDir()) { | ||
os.RemoveAll(tmpDir) | ||
} | ||
err := k8sClient.Delete(context.TODO(), &stack) |
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.
err := k8sClient.Delete(context.TODO(), &stack) | |
Expect(k8sClient.Delete(context.TODO(), &stack)).To(Succeed()) |
Expect(stack.Status.LastUpdate.State).To(Equal(shared.FailedStackStateMessage)) | ||
stalledCondition := apimeta.FindStatusCondition(stack.Status.Conditions, pulumiv1.StalledCondition) | ||
Expect(stalledCondition).ToNot(BeNil(), "stalled condition is present") | ||
Expect(stalledCondition.Reason).To(Equal(pulumiv1.StalledSourceUnavailableReason)) |
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.
👍
test/program_test.go
Outdated
waitForStackFailure(&stack) | ||
|
||
Expect(stack.Status.LastUpdate.State).To(Equal(shared.FailedStackStateMessage)) | ||
// TODO: Condition for invalid program? |
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.
Generally all we'll know is that the automation API failed to run it to completion; a failed
state might be as good as we can do for now.
NB on failing tests: the failures already fail on default branch. We'll try to roll default branch forward to fix them. |
Fixes #312