-
Notifications
You must be signed in to change notification settings - Fork 0
manage status updates for previerw deployments #76
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
Conversation
| "github.com/google/go-cmp/cmp" | ||
| ) | ||
|
|
||
| func Test_Cache_Object_Drift(t *testing.T) { |
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 moved the Drift method as property of the release artifact / cache object to have it reusable. Those tests here just moved package. We had them already in a different place.
| package logging | ||
|
|
||
| // Active defines this worker handler to always be executed. | ||
| func (l *Logging) Active() bool { | ||
| return true | ||
| } |
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 created a dedicated operator function for logging some information. That code separation makes everything cleaner and easier to work with.
| package status | ||
|
|
||
| // Active defines this worker handler to always be executed. | ||
| // Active defines this worker handler to only be executed within the testing | ||
| // environment, because we do not allow preview deployments to be injected in | ||
| // e.g. staging nor production. | ||
| func (s *Status) Active() bool { | ||
| return true | ||
| return s.env.Environment == "testing" | ||
| } |
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.
This new operator function for the preview status only runs in the testing environment, which is the same behaviour like the preview operator function.
| // deployment status. | ||
| // | ||
| {o.infrastructure, o.status}, | ||
| {o.infrastructure, o.logging, o.status}, |
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.
Here we wire up the operator chain.
|
|
||
| { | ||
| pre.Labels.Hash = hash.New(bra) | ||
| pre.Labels.Pull = pul |
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.
Here we get the pull request number for later use. The internal labels struct is our way of communicating state across the reconciliation loop.
| if y.RolloutState == types.DeploymentRolloutStateCompleted { | ||
| return aws.ToString(y.TaskDefinition) | ||
| } |
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.
Here we fix the current state lookup in the sense that we now only acknowledge the new current state if it comes from a successful deployment.
The result is that we keep the Updating state in the status updates until the new deployment finishes. And so the issue comments in our pull requests will more accurately reflect the status of the preview deployments.
| marker = "<!-- kayron:preview:status -->" | ||
| ) | ||
|
|
||
| func (s *Status) preview() error { |
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.
Here is where most of the status update reconciliation is happening.
Towards https://linear.app/splits/issue/PE-4789/enable-deployment-status-updates-for-preview-deployments.
We can see this working in 0xSplits/splits-lite#44.