sherlock

package
v1.1.38 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChartReleaseStatusUpdater added in v1.1.6

type ChartReleaseStatusUpdater interface {
	// UpdateChartReleaseStatuses sends the given chart release statuses to Sherlock.
	// This function does nothing if the GHA OIDC token provider isn't happy
	// (since Sherlock wouldn't have a chance of correlating our request to a CiRun).
	UpdateChartReleaseStatuses(chartReleaseStatuses map[string]string) error
}

type ChartVersionUpdater added in v0.0.74

type ChartVersionUpdater interface {
	// ReportNewChartVersion reports a new chart version to Sherlock
	ReportNewChartVersion(chartName string, newVersion string, lastVersion string, description string) error

	// UpdateForNewChartVersion does three things in sequence, all directly with Sherlock's API.
	//
	// 1. Report new chart version to Sherlock (meaning there's a new latest chart version)
	// 2. Update given chart releases (via chartReleaseSelectors) to point at the latest chart version and refresh to get the new latest version
	//    - 9 times out of 10 this means `dev/${chartSelector}` based on how .autorelease.yaml file gets defaulted
	// 3. Refresh **template** chart releases that either:
	//    - already follow latest chart version (so step 1 means they'd have an update if we didn't catch them in step 2)
	//    - follow a chart release we just updated in step 2 (so step 2 means they'd have an update)
	UpdateForNewChartVersion(chartSelector string, newVersion string, lastVersion string, description string, chartReleaseSelectors []string) error
}

type Client

Client is an interface representing the ability to both read and create/update thelma's internal state using a sherlock client. We have this interface largely so we can generate a mock for it.

func NewClient added in v1.0.103

func NewClient(options ...Option) (Client, error)

NewClient creates a Sherlock client, but you probably don't want to call it. You want to hit clients.Clients.Sherlock() instead, which still accepts options but fills the all-important authentication ones for you. Calling this directly is still useful for testing, though.

type Cluster

type Cluster struct {
	*models.SherlockClusterV3
}

type Clusters

type Clusters []Cluster

type Environment

type Environment struct {
	*models.SherlockEnvironmentV3
}

type Environments

type Environments []Environment

type Option added in v1.0.103

type Option func(*Options)

type Options added in v1.0.103

type Options struct {
	Addr                 string
	ConfigSource         config.Config
	IapTokenProvider     credentials.TokenProvider
	GhaOidcTokenProvider credentials.TokenProvider
}

type Release

type Release struct {
	*models.SherlockChartReleaseV3
}

type Releases

type Releases []Release

type StateLoader

type StateLoader interface {
	Environments() (Environments, error)
	Clusters() (Clusters, error)
	Releases() (Releases, error)
}

type StateWriter added in v0.0.71

type StateWriter interface {
	terra.StateWriter

	// CreateEnvironmentFromTemplate has the same *effect* as WriteEnvironments for the narrow case of creating a
	// BEE from a template, but it relies entirely on Sherlock for the template-default logic.
	// All the desired fields can be left blank to let Sherlock's defaulting behavior take over.
	// The name of the new environment is returned.
	// Of note here is that calling this function doesn't touch Thelma's in-memory state, only Sherlock's state.
	// Thelma's in-memory state will need to be reloaded to work with the newly-created environment.
	CreateEnvironmentFromTemplate(templateName string, options terra.CreateOptions) (string, error)

	// PinEnvironmentVersions adapts Thelma's pin-override pattern to Sherlock's changeset pattern to apply specific
	// versions to chart releases in an environment.
	PinEnvironmentVersions(environmentName string, versions map[string]terra.VersionOverride) error

	// SetTerraHelmfileRefForEntireEnvironment sets it both for the environment itself and for every chart release it
	// contains. This generally matches the semantics of Thelma's old state bucket, where the environment's value
	// would be used for chart releases if they didn't have their own override. Sherlock enforces that every chart
	// release always contain its own version information, so the closest we can get is just set that value to what
	// we're given here.
	SetTerraHelmfileRefForEntireEnvironment(environment terra.Environment, terraHelmfileRef string) error

	// ResetEnvironmentAndPinToDev is a temporary-ish hack implementation of what Thelma could do with state bucket
	// overrides. Because overrides were stored separately, Thelma could drop them, leading to really nice pin-and-
	// unpin semantics. Sherlock doesn't have this notion, at least not right now. Versions just are, and while this
	// allows cool things like following a specific branch, Sherlock doesn't currently have a mechanism to go back to
	// some default set of versions. The closest we can get is effectively re-pinning the environment to dev. We can
	// think about adding this to Sherlock in the future, because it does have some default-version mechanisms, they're
	// just not exposed in the API like how unpinning would expect.
	ResetEnvironmentAndPinToDev(environment terra.Environment) error

	// SetEnvironmentOffline controls the "offline" flag on a given environment.
	// Of note here is that calling this function doesn't touch Thelma's in-memory state, only Sherlock's state.
	// Thelma's in-memory state will need to be reloaded to work with the mutated environment.
	SetEnvironmentOffline(environmentName string, offline bool) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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