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

Phase Status Conditions #44

Open
GeorgeMac opened this issue Nov 20, 2024 · 0 comments
Open

Phase Status Conditions #44

GeorgeMac opened this issue Nov 20, 2024 · 0 comments

Comments

@GeorgeMac
Copy link
Member

GeorgeMac commented Nov 20, 2024

Introduce concept of phases having status conditions.

All examples are for illustration purposes only. The final API is open for debate.

The goal of status conditions (inspired by k8s) is to provide both:

  1. Further insights into a phases current state

Surfacing conditions on phases in the UI can allow for integrators to add more information regarding the state of a resource in a given phase. This can be helpful for understanding if your change has

For example, developers could implement service condition functions to:

  • query their deployed service to ensure it is reachable / healthy / performant
  • query their deployment platform to understand whether or not the desired version matches current deployed version

Additionally, phases could automatically supplement their own source specific status conditions on their responses.
This is where we could surface the state of asynchronous actions made during promotion, for example:

  • (source: git) The status and location of open PRs associated with the last promotion attempt

There are many ways we could represent these statuses. They could be hung on the phase:

phases.New(glu.Name("staging"), pipeline, source,
	core.PromotesFrom(staging,
		core.WithStatusFunc("health", func(pipeline, phase glu.Metadata, resource *MyResource) (core.Status, error) {
			// query some external source based on the metadata provided
		},
	))

Or we can do what we have done with the other integrations and support hanging a method of the resource:

func (r *MyResource) GetStatuses(pipeline, phase glu.Metadata) ([]core.Status, error) {
  // query 0 or more external systems for statuses
  // adjust behaviour based on the phase in context
}
  1. Integration point for conditional promotion rules

Once status conditions are available, it would be a useful integration point for hanging promotion gating conditions on.

You could imagine something like the following:

phases.New(glu.Name("production"), pipeline, source,
	core.PromotesFrom(staging, core.PromoteIf(condition.Status("health"), condition.Eq, "ok")))

Or perhaps the most flexible thing to do is take a func(pipe, phase glu.Metadata, r *MyResource, statuses []core.Status) bool {} for PromoteIf and let the caller use all the power of Go to decide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant