diff --git a/api/v1alpha1/commitstatus_types.go b/api/v1alpha1/commitstatus_types.go index f870b27..71e5872 100644 --- a/api/v1alpha1/commitstatus_types.go +++ b/api/v1alpha1/commitstatus_types.go @@ -47,6 +47,7 @@ type CommitStatusSpec struct { // (Gitlab: pending, running, success, failed, canceled) // (Bitbucket: INPROGRESS, STOPPED, SUCCESSFUL, FAILED) + // Url is a URL that the user can follow to see more details about the status Url string `json:"url"` } @@ -54,9 +55,10 @@ type CommitStatusSpec struct { type CommitStatusStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster // Important: Run "make" to regenerate code after modifying this file - ObservedGeneration int64 `json:"observedGeneration"` - Id string `json:"id"` - Sha string `json:"sha"` + ObservedGeneration int64 `json:"observedGeneration"` + // Id is the unique identifier of the commit status, set by the SCM + Id string `json:"id"` + Sha string `json:"sha"` // +kubebuilder:default:=pending // +kubebuilder:validation:Enum:=pending;success;failure Phase CommitStatusPhase `json:"phase"` diff --git a/api/v1alpha1/promotionstrategy_types.go b/api/v1alpha1/promotionstrategy_types.go index 790c9c2..d5640f4 100644 --- a/api/v1alpha1/promotionstrategy_types.go +++ b/api/v1alpha1/promotionstrategy_types.go @@ -31,12 +31,24 @@ type PromotionStrategySpec struct { // +kubebuilder:validation:Required RepositoryReference ObjectReference `json:"gitRepositoryRef"` + // ActiveCommitStatuses are commit statuses describing an actively running dry commit. If an active commit status + // is failing for an environment, subsequent environments will not deploy the failing commit. + // + // The commit statuses specified in this field apply to all environments in the promotion sequence. You can also + // specify commit statuses for individual environments in the `environments` field. // +kubebuilder:validation:Optional ActiveCommitStatuses []CommitStatusSelector `json:"activeCommitStatuses"` + // ProposedCommitStatuses are commit statuses describing a proposed dry commit, i.e. one that is not yet running + // in a live environment. If a proposed commit status is failing for a given environment, the dry commit will not + // be promoted to that environment. + // + // The commit statuses specified in this field apply to all environments in the promotion sequence. You can also + // specify commit statuses for individual environments in the `environments` field. // +kubebuilder:validation:Optional ProposedCommitStatuses []CommitStatusSelector `json:"proposedCommitStatuses"` + // Environments is the sequence of environments that a dry commit will be promoted through. // +kubebuilder:validation:MinItems:=1 Environments []Environment `json:"environments"` } @@ -44,15 +56,29 @@ type PromotionStrategySpec struct { type Environment struct { // +kubebuilder:validation:Required Branch string `json:"branch"` + // AutoMerge determines whether the dry commit should be automatically merged into the next branch in the sequence. + // If false, the dry commit will be proposed but not merged. // +kubebuilder:validation:Optional // +kubebuilder:default:=true AutoMerge *bool `json:"autoMerge,omitempty"` + // ActiveCommitStatuses are commit statuses describing an actively running dry commit. If an active commit status + // is failing for an environment, subsequent environments will not deploy the failing commit. + // + // The commit statuses specified in this field apply to this environment only. You can also specify commit statuses + // for all environments in the `spec.activeCommitStatuses` field. // +kubebuilder:validation:Optional ActiveCommitStatuses []CommitStatusSelector `json:"activeCommitStatuses"` + // ProposedCommitStatuses are commit statuses describing a proposed dry commit, i.e. one that is not yet running + // in a live environment. If a proposed commit status is failing for a given environment, the dry commit will not + // be promoted to that environment. + // + // The commit statuses specified in this field apply to this environment only. You can also specify commit statuses + // for all environments in the `spec.proposedCommitStatuses` field. // +kubebuilder:validation:Optional ProposedCommitStatuses []CommitStatusSelector `json:"proposedCommitStatuses"` } +// GetAutoMerge returns the value of the AutoMerge field, defaulting to true if the field is nil. func (e *Environment) GetAutoMerge() bool { if e.AutoMerge == nil { return true diff --git a/config/crd/bases/promoter.argoproj.io_commitstatuses.yaml b/config/crd/bases/promoter.argoproj.io_commitstatuses.yaml index 9db43b5..e5b02ea 100644 --- a/config/crd/bases/promoter.argoproj.io_commitstatuses.yaml +++ b/config/crd/bases/promoter.argoproj.io_commitstatuses.yaml @@ -67,6 +67,8 @@ spec: sha: type: string url: + description: Url is a URL that the user can follow to see more details + about the status type: string required: - description @@ -80,6 +82,8 @@ spec: description: CommitStatusStatus defines the observed state of CommitStatus properties: id: + description: Id is the unique identifier of the commit status, set + by the SCM type: string observedGeneration: description: |- diff --git a/config/crd/bases/promoter.argoproj.io_promotionstrategies.yaml b/config/crd/bases/promoter.argoproj.io_promotionstrategies.yaml index 4eb16b7..1b2c648 100644 --- a/config/crd/bases/promoter.argoproj.io_promotionstrategies.yaml +++ b/config/crd/bases/promoter.argoproj.io_promotionstrategies.yaml @@ -47,6 +47,12 @@ spec: description: PromotionStrategySpec defines the desired state of PromotionStrategy properties: activeCommitStatuses: + description: |- + ActiveCommitStatuses are commit statuses describing an actively running dry commit. If an active commit status + is failing for an environment, subsequent environments will not deploy the failing commit. + + The commit statuses specified in this field apply to all environments in the promotion sequence. You can also + specify commit statuses for individual environments in the `environments` field. items: properties: key: @@ -57,9 +63,17 @@ spec: type: object type: array environments: + description: Environments is the sequence of environments that a dry + commit will be promoted through. items: properties: activeCommitStatuses: + description: |- + ActiveCommitStatuses are commit statuses describing an actively running dry commit. If an active commit status + is failing for an environment, subsequent environments will not deploy the failing commit. + + The commit statuses specified in this field apply to this environment only. You can also specify commit statuses + for all environments in the `spec.activeCommitStatuses` field. items: properties: key: @@ -71,10 +85,20 @@ spec: type: array autoMerge: default: true + description: |- + AutoMerge determines whether the dry commit should be automatically merged into the next branch in the sequence. + If false, the dry commit will be proposed but not merged. type: boolean branch: type: string proposedCommitStatuses: + description: |- + ProposedCommitStatuses are commit statuses describing a proposed dry commit, i.e. one that is not yet running + in a live environment. If a proposed commit status is failing for a given environment, the dry commit will not + be promoted to that environment. + + The commit statuses specified in this field apply to this environment only. You can also specify commit statuses + for all environments in the `spec.proposedCommitStatuses` field. items: properties: key: @@ -97,6 +121,13 @@ spec: - name type: object proposedCommitStatuses: + description: |- + ProposedCommitStatuses are commit statuses describing a proposed dry commit, i.e. one that is not yet running + in a live environment. If a proposed commit status is failing for a given environment, the dry commit will not + be promoted to that environment. + + The commit statuses specified in this field apply to all environments in the promotion sequence. You can also + specify commit statuses for individual environments in the `environments` field. items: properties: key: diff --git a/dist/install.yaml b/dist/install.yaml index 04d5cba..c9b64b4 100644 --- a/dist/install.yaml +++ b/dist/install.yaml @@ -258,6 +258,8 @@ spec: sha: type: string url: + description: Url is a URL that the user can follow to see more details + about the status type: string required: - description @@ -271,6 +273,8 @@ spec: description: CommitStatusStatus defines the observed state of CommitStatus properties: id: + description: Id is the unique identifier of the commit status, set + by the SCM type: string observedGeneration: description: |- @@ -412,6 +416,12 @@ spec: description: PromotionStrategySpec defines the desired state of PromotionStrategy properties: activeCommitStatuses: + description: |- + ActiveCommitStatuses are commit statuses describing an actively running dry commit. If an active commit status + is failing for an environment, subsequent environments will not deploy the failing commit. + + The commit statuses specified in this field apply to all environments in the promotion sequence. You can also + specify commit statuses for individual environments in the `environments` field. items: properties: key: @@ -422,9 +432,17 @@ spec: type: object type: array environments: + description: Environments is the sequence of environments that a dry + commit will be promoted through. items: properties: activeCommitStatuses: + description: |- + ActiveCommitStatuses are commit statuses describing an actively running dry commit. If an active commit status + is failing for an environment, subsequent environments will not deploy the failing commit. + + The commit statuses specified in this field apply to this environment only. You can also specify commit statuses + for all environments in the `spec.activeCommitStatuses` field. items: properties: key: @@ -436,10 +454,20 @@ spec: type: array autoMerge: default: true + description: |- + AutoMerge determines whether the dry commit should be automatically merged into the next branch in the sequence. + If false, the dry commit will be proposed but not merged. type: boolean branch: type: string proposedCommitStatuses: + description: |- + ProposedCommitStatuses are commit statuses describing a proposed dry commit, i.e. one that is not yet running + in a live environment. If a proposed commit status is failing for a given environment, the dry commit will not + be promoted to that environment. + + The commit statuses specified in this field apply to this environment only. You can also specify commit statuses + for all environments in the `spec.proposedCommitStatuses` field. items: properties: key: @@ -462,6 +490,13 @@ spec: - name type: object proposedCommitStatuses: + description: |- + ProposedCommitStatuses are commit statuses describing a proposed dry commit, i.e. one that is not yet running + in a live environment. If a proposed commit status is failing for a given environment, the dry commit will not + be promoted to that environment. + + The commit statuses specified in this field apply to all environments in the promotion sequence. You can also + specify commit statuses for individual environments in the `environments` field. items: properties: key: diff --git a/docs/example-resources/PromotionStrategy.yaml b/docs/example-resources/PromotionStrategy.yaml index 4bbb82b..4379917 100644 --- a/docs/example-resources/PromotionStrategy.yaml +++ b/docs/example-resources/PromotionStrategy.yaml @@ -5,7 +5,6 @@ metadata: spec: gitRepositoryRef: name: example-git-repo - dryBranch: main activeCommitStatuses: - key: argocd-app-health proposedCommitStatuses: