deployevent

package
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package deployevent contains data structures for the event messages that our CI generates for Helm deployments (i.e. "helm install" and "helm upgrade") and Terraform runs (e.g. "terragrunt apply").

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveDirectoryDeployment added in v1.7.0

type ActiveDirectoryDeployment struct {
	Landscape string  `json:"landscape"` //e.g. "dev" or "prod"
	Hostname  string  `json:"host"`
	Outcome   Outcome `json:"outcome"`

	//StartedAt is not set for OutcomeNotDeployed.
	StartedAt *time.Time `json:"started-at"`
	//FinishedAt is not set for OutcomeNotDeployed and OutcomeADDeploymentFailed.
	FinishedAt      *time.Time `json:"finished-at,omitempty"`
	DurationSeconds *uint64    `json:"duration,omitempty"`
}

ActiveDirectory appears in type Event. It describes a deployment of Active Directory to one of our Windows servers.

type Event

type Event struct {
	//NOTE: "recorded_at" should be "recorded-at", and "helm-release" should be
	//"helm-releases". The inconsistent naming needs to stay like this now for
	//backwards compatibility.
	Region     string             `json:"region"`
	RecordedAt *time.Time         `json:"recorded_at"`
	GitRepos   map[string]GitRepo `json:"git"`
	Pipeline   Pipeline           `json:"pipeline"`
	// Exactly one of the following fields must be filled.
	HelmReleases  []*HelmRelease             `json:"helm-release,omitempty"`
	TerraformRuns []*TerraformRun            `json:"terraform-runs,omitempty"`
	ADDeployment  *ActiveDirectoryDeployment `json:"active-directory-deployment,omitempty"`
}

Event describes a deployment (i.e. install or upgrade) of one or more Helm releases.

func (Event) CombinedOutcome

func (event Event) CombinedOutcome() Outcome

CombinedOutcome merges the Outcome values of all HelmReleases in this Event into a single summary value.

func (Event) CombinedStartDate

func (event Event) CombinedStartDate() *time.Time

CombinedStartDate merges the StartedAt values of all HelmReleases in this Event and returns the earliest start date.

type GitRepo

type GitRepo struct {
	AuthoredAt  *time.Time `json:"authored-at"`
	Branch      string     `json:"branch"`
	CommittedAt *time.Time `json:"committed-at"`
	CommitID    string     `json:"commit-id"`
	RemoteURL   string     `json:"remote-url"`
}

GitRepo appears in type Event. It describes the state of a Git repository that was checked out for a specific deployment.

type HelmRelease

type HelmRelease struct {
	Name    string  `json:"name"`
	Outcome Outcome `json:"outcome"`

	//ChartID contains "${name}-${version}" for charts pulled from Chartmuseum.
	//ChartPath contains the path to that chart inside helm-charts.git for charts
	//coming from helm-charts.git directly. Exactly one of those must be set.
	ChartID   string `json:"chart-id"`
	ChartPath string `json:"chart-path"`
	Cluster   string `json:"cluster"`
	//ImageVersion is only set for releases that take an image version produced by an earlier pipeline job.
	ImageVersion string `json:"image-version,omitempty"`
	Namespace    string `json:"kubernetes-namespace"`
	//DeployedImages is a list of all Docker image references that were found in the deployed Helm manifest.
	DeployedImages []string `json:"deployed-images"`

	//StartedAt is not set for OutcomeNotDeployed.
	StartedAt *time.Time `json:"started-at"`
	//FinishedAt is not set for OutcomeNotDeployed and OutcomeHelmUpgradeFailed.
	FinishedAt      *time.Time `json:"finished-at,omitempty"`
	DurationSeconds *uint64    `json:"duration,omitempty"`
}

HelmRelease appears in type Event. It describes a Helm release that was installed or upgraded as part of a specific deployment.

type Outcome

type Outcome string

Outcome appears in type HelmRelease and TerraformRun. It describes the final state of a release.

const (
	//OutcomeNotDeployed describes a Helm release that was not deployed because
	//of an unexpected error before `helm upgrade`.
	OutcomeNotDeployed Outcome = "not-deployed"
	//OutcomeSucceeded describes a Helm release that succeeded.
	OutcomeSucceeded Outcome = "succeeded"
	//OutcomeTerraformRunFailed describes a terraform run that failed
	OutcomeTerraformRunFailed Outcome = "terraform-run-failed"
	//OutcomeHelmUpgradeFailed describes a Helm release that failed during
	//`helm upgrade` or because some deployed pods did not come up correctly.
	OutcomeHelmUpgradeFailed Outcome = "helm-upgrade-failed"
	//OutcomeADDeploymentFailed describes an Active Directory deployment that
	//failed or did not run all the way through.
	OutcomeADDeploymentFailed Outcome = "active-directory-deployment-failed"
	//OutcomeE2ETestFailed describes a Helm release that was deployed, but a
	//subsequent end-to-end test failed.
	OutcomeE2ETestFailed Outcome = "e2e-test-failed"
	//OutcomePartiallyDeployed is returned by Event.CombinedOutcome() when the event
	//in question contains some releases that are "succeeded" and some that are
	//"not-deployed". This value is not acceptable for an individual Helm release.
	OutcomePartiallyDeployed Outcome = "partially-deployed"
)

func (Outcome) IsKnownInputValue

func (o Outcome) IsKnownInputValue() bool

IsKnownInputValue returns whether this value is acceptable for an individual Helm release.

type Pipeline

type Pipeline struct {
	BuildNumber  string `json:"build-number"`
	BuildURL     string `json:"build-url"`
	JobName      string `json:"job"`
	PipelineName string `json:"name"`
	TeamName     string `json:"team"`
	CreatedBy    string `json:"created-by"`
}

Pipeline appears in type Event. It describes the Concourse pipeline in which the given deployment was performed.

type TerraformChangeSummary

type TerraformChangeSummary struct {
	Added     int    `json:"added"`
	Changed   int    `json:"changed"`
	Removed   int    `json:"removed"`
	Operation string `json:"operation"`
}

TerraformChangeSummary appears in TerraformRun. It describes how many resources were added, destroyed or changed by a Terraform run.

type TerraformRun

type TerraformRun struct {
	Outcome Outcome `json:"outcome"`

	//StartedAt is not set for OutcomeNotDeployed.
	StartedAt *time.Time `json:"started-at"`
	//FinishedAt is not set for OutcomeNotDeployed and OutcomeHelmUpgradeFailed.
	FinishedAt      *time.Time `json:"finished-at,omitempty"`
	DurationSeconds *uint64    `json:"duration,omitempty"`

	TerraformVersion string                  `json:"terraform-version"`
	ChangeSummary    *TerraformChangeSummary `json:"change-summary,omitempty"`
	ErrorMessage     string                  `json:"error-message,omitempty"`
}

TerraformRun appears in type Event. It describes a Terraform run that was executed and its outcome.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL