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

chore: more type docs #69

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
8 changes: 5 additions & 3 deletions api/v1alpha1/commitstatus_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,18 @@ 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"`
}

// CommitStatusStatus defines the observed state of CommitStatus
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"`
Expand Down
26 changes: 26 additions & 0 deletions api/v1alpha1/promotionstrategy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,54 @@ 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"`
}

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
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/promoter.argoproj.io_commitstatuses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |-
Expand Down
31 changes: 31 additions & 0 deletions config/crd/bases/promoter.argoproj.io_promotionstrategies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
35 changes: 35 additions & 0 deletions dist/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |-
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
1 change: 0 additions & 1 deletion docs/example-resources/PromotionStrategy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
spec:
gitRepositoryRef:
name: example-git-repo
dryBranch: main
activeCommitStatuses:
- key: argocd-app-health
proposedCommitStatuses:
Expand Down
Loading