Documentation
¶
Index ¶
- Constants
- func CELPrerequisiteExpression(prerequisite string) (string, bool)
- func EvaluateCELPrerequisite(expression string, space *goclientnew.Space, ...) (bool, error)
- func ValidateCELPrerequisite(expression string) error
- type ChangeWorkflow
- type ChangeWorkflowFinalStage
- type ChangeWorkflowPrerequisite
- type ChangeWorkflowSpec
- type ChangeWorkflowStage
Constants ¶
const ( APIVersion = "confighub.com/v1" Kind = "ChangeWorkflow" )
const CELPrerequisitePrefix = "cel:"
CELPrerequisitePrefix marks a prerequisite as an expression its author wrote rather than one of the gates the system knows how to compute. A prerequisite is one or the other, and everything past the prefix is the expression.
Variables ¶
This section is empty.
Functions ¶
func CELPrerequisiteExpression ¶ added in v0.4.12
CELPrerequisiteExpression returns the expression a prerequisite carries and whether it carries one, so a caller can tell a name it does not recognize from an expression it should evaluate.
func EvaluateCELPrerequisite ¶ added in v0.4.12
func EvaluateCELPrerequisite(expression string, space *goclientnew.Space, changeOrder *goclientnew.ChangeOrder, release *goclientnew.Release) (bool, error)
EvaluateCELPrerequisite reports whether space satisfies expression.
The entities are bound as the JSON the API returns rather than as Go values, which is what puts Annotations within reach: an expression reads whatever has been written there, so anything outside ConfigHub that can annotate a Space or a Release can gate a promotion without the named vocabulary growing a case for it.
A nil release is one there is none of -- the Space has published no Release of the change being gated -- and binds as null, so an expression that reads it fails rather than answering from some other Release. One that does not read it is unaffected.
An expression that does not produce a bool is an error rather than a false: a gate that could not answer must not read as a gate that answered no.
func ValidateCELPrerequisite ¶ added in v0.4.12
ValidateCELPrerequisite reports whether an expression can run at all. Authoring asks before storing a definition, so an expression that could never answer is refused while it is a line being typed rather than a gate holding a rollout.
Types ¶
type ChangeWorkflow ¶
type ChangeWorkflow struct {
yaml.ResourceMeta `json:",inline" yaml:",inline"`
Spec ChangeWorkflowSpec `json:"spec" yaml:"spec"`
}
ChangeWorkflow is a KRM object, so it takes its apiVersion, kind and metadata from kyaml's ResourceMeta rather than restating them. The embedded fields are promoted, which is what flattens them back to the top level of the document: encoding/json, which sigs.k8s.io/yaml decodes through, promotes anonymous struct fields that carry no name of their own. The ",inline" tag is how kyaml spells that intent, but it is gopkg.in/yaml.v3's option, not one encoding/json reads.
type ChangeWorkflowFinalStage ¶ added in v0.4.4
type ChangeWorkflowFinalStage struct {
Prerequisites []string `json:"prerequisites,omitempty" yaml:"prerequisites,omitempty"`
}
type ChangeWorkflowPrerequisite ¶ added in v0.4.12
type ChangeWorkflowSpec ¶
type ChangeWorkflowSpec struct {
CustomPrerequisites []ChangeWorkflowPrerequisite `json:"custom-prerequisites" yaml:"custom-prerequisites"`
Stages []ChangeWorkflowStage `json:"stages" yaml:"stages"`
Final ChangeWorkflowFinalStage `json:"final" yaml:"final"`
}