contracts

package module
v0.0.272 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 7 Imported by: 22

README

Estafette CI

The estafette-ci-contracts library is part of the Estafette CI system documented at https://estafette.io.

Please file any issues related to Estafette CI at https://github.com/estafette/estafette-ci-central/issues

Estafette-ci-contracts

This library has contracts for requests / responses between various components of the Estafette CI system.

Development

To start development run

git clone git@github.com:estafette/estafette-ci-contracts.git
cd estafette-ci-contracts

Before committing your changes run

go test ./...
go mod tidy

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCredentialsForTrustedImage

func GetCredentialsForTrustedImage(credentials []*CredentialConfig, trustedImage TrustedImageConfig) map[string][]*CredentialConfig

GetCredentialsForTrustedImage returns all credentials of a certain type

func HasCanceledStatus added in v0.0.167

func HasCanceledStatus(steps []*BuildLogStep) bool

HasCanceledStatus returns true if aggregated status is canceled

func HasFailedStatus added in v0.0.175

func HasFailedStatus(steps []*BuildLogStep) bool

HasFailedStatus returns true if aggregated status is failed

func HasSucceededStatus added in v0.0.165

func HasSucceededStatus(steps []*BuildLogStep) bool

HasSucceededStatus returns true if aggregated status is succeeded

func HasUnknownStatus added in v0.0.175

func HasUnknownStatus(steps []*BuildLogStep) bool

HasUnknownStatus returns true if aggregated status is unknown

func IsAllowedBranchForCredential added in v0.0.228

func IsAllowedBranchForCredential(credential CredentialConfig, branch string) bool

IsAllowedBranchForCredential returns true if AllowedBranches is empty or matches the build/release job branch

func IsAllowedPipelineForCredential added in v0.0.219

func IsAllowedPipelineForCredential(credential CredentialConfig, fullRepositoryPath string) bool

IsAllowedPipelineForCredential returns true if AllowedPipelines is empty or matches the pipelines full path

func IsAllowedPipelineForTrustedImage added in v0.0.219

func IsAllowedPipelineForTrustedImage(trustedImage TrustedImageConfig, fullRepositoryPath string) bool

IsAllowedPipelineForTrustedImage returns true if AllowedPipelines is empty or matches the pipelines full path

func IsAllowedTrustedImageForCredential added in v0.0.219

func IsAllowedTrustedImageForCredential(credential CredentialConfig, trustedImage TrustedImageConfig) bool

IsAllowedTrustedImageForCredential returns true if AllowedTrustedImages is empty or matches the trusted image Path property

Types

type Bot added in v0.0.248

type Bot struct {
	Name            string                    `json:"name"`
	ID              string                    `json:"id,omitempty"`
	RepoSource      string                    `json:"repoSource,omitempty"`
	RepoOwner       string                    `json:"repoOwner,omitempty"`
	RepoName        string                    `json:"repoName,omitempty"`
	BotStatus       Status                    `json:"botStatus,omitempty"`
	Events          []manifest.EstafetteEvent `json:"triggerEvents,omitempty"`
	InsertedAt      *time.Time                `json:"insertedAt,omitempty"`
	StartedAt       *time.Time                `json:"startedAt,omitempty"`
	UpdatedAt       *time.Time                `json:"updatedAt,omitempty"`
	Duration        *time.Duration            `json:"duration,omitempty"`
	PendingDuration *time.Duration            `json:"pendingDuration,omitempty"`
	ExtraInfo       *BotExtraInfo             `json:"extraInfo,omitempty"`
	Groups          []*Group                  `json:"groups,omitempty"`
	Organizations   []*Organization           `json:"organizations,omitempty"`
}

Bot represents a bot execution

func (*Bot) GetFullRepoPath added in v0.0.248

func (bot *Bot) GetFullRepoPath() string

GetFullRepoPath returns the full path of the bot repository with source, owner and name

type BotExtraInfo added in v0.0.248

type BotExtraInfo struct {
	MedianPendingDuration time.Duration `json:"medianPendingDuration"`
	MedianDuration        time.Duration `json:"medianDuration"`
}

BotExtraInfo contains extra information like aggregates over the last x releases

type BotLog added in v0.0.248

type BotLog struct {
	ID         string          `json:"id,omitempty"`
	RepoSource string          `json:"repoSource"`
	RepoOwner  string          `json:"repoOwner"`
	RepoName   string          `json:"repoName"`
	BotID      string          `json:"botID"`
	Steps      []*BuildLogStep `json:"steps"`
	InsertedAt time.Time       `json:"insertedAt"`
}

BotLog represents a bot log for a specific bot execution

func (*BotLog) GetAggregatedStatus added in v0.0.248

func (botLog *BotLog) GetAggregatedStatus() LogStatus

GetAggregatedStatus returns the status aggregated across all stages

func (*BotLog) HasCanceledStatus added in v0.0.248

func (botLog *BotLog) HasCanceledStatus() bool

HasCanceledStatus returns true if aggregated status is canceled

func (*BotLog) HasFailedStatus added in v0.0.248

func (botLog *BotLog) HasFailedStatus() bool

HasFailedStatus returns true if aggregated status is failed

func (*BotLog) HasSucceededStatus added in v0.0.248

func (botLog *BotLog) HasSucceededStatus() bool

HasSucceededStatus returns true if aggregated status is succeeded

func (*BotLog) HasUnknownStatus added in v0.0.248

func (botLog *BotLog) HasUnknownStatus() bool

HasUnknownStatus returns true if aggregated status is unknown

type BotParamsConfig added in v0.0.249

type BotParamsConfig struct {
	BotName string `json:"botName"`
	BotID   int    `json:"botID"`
}

BotParamsConfig has config specific to releases

type Build

type Build struct {
	ID                   string                      `json:"id"`
	RepoSource           string                      `json:"repoSource"`
	RepoOwner            string                      `json:"repoOwner"`
	RepoName             string                      `json:"repoName"`
	RepoBranch           string                      `json:"repoBranch"`
	RepoRevision         string                      `json:"repoRevision"`
	BuildVersion         string                      `json:"buildVersion,omitempty"`
	BuildStatus          Status                      `json:"buildStatus,omitempty"`
	Labels               []Label                     `json:"labels,omitempty"`
	ReleaseTargets       []ReleaseTarget             `json:"releaseTargets,omitempty"`
	Manifest             string                      `json:"manifest,omitempty"`
	ManifestWithDefaults string                      `json:"manifestWithDefaults,omitempty"`
	Commits              []GitCommit                 `json:"commits,omitempty"`
	Triggers             []manifest.EstafetteTrigger `json:"triggers,omitempty"`
	Events               []manifest.EstafetteEvent   `json:"triggerEvents,omitempty"`
	InsertedAt           time.Time                   `json:"insertedAt"`
	StartedAt            *time.Time                  `json:"startedAt,omitempty"`
	UpdatedAt            time.Time                   `json:"updatedAt"`
	Duration             time.Duration               `json:"duration"`
	PendingDuration      *time.Duration              `json:"pendingDuration,omitempty"`
	ManifestObject       *manifest.EstafetteManifest `json:"-"`
	Groups               []*Group                    `json:"groups,omitempty"`
	Organizations        []*Organization             `json:"organizations,omitempty"`
}

Build represents a specific build, including version number, repo, branch, revision, labels and manifest

func (*Build) GetFullRepoPath added in v0.0.155

func (build *Build) GetFullRepoPath() string

GetFullRepoPath returns the full path of the build repository with source, owner and name

type BuildEventType added in v0.0.260

type BuildEventType string
const (
	BuildEventTypeUnknown      BuildEventType = ""
	BuildEventTypeUpdateStatus BuildEventType = "updateStatus"
	BuildEventTypeClean        BuildEventType = "clean"
)

type BuildLog

type BuildLog struct {
	ID           string          `json:"id,omitempty"`
	RepoSource   string          `json:"repoSource"`
	RepoOwner    string          `json:"repoOwner"`
	RepoName     string          `json:"repoName"`
	RepoBranch   string          `json:"repoBranch"`
	RepoRevision string          `json:"repoRevision"`
	BuildID      string          `json:"buildID"`
	Steps        []*BuildLogStep `json:"steps"`
	InsertedAt   time.Time       `json:"insertedAt"`
}

BuildLog represents a build log for a specific revision

func (*BuildLog) GetAggregatedStatus added in v0.0.164

func (buildLog *BuildLog) GetAggregatedStatus() LogStatus

GetAggregatedStatus returns the status aggregated across all stages

func (*BuildLog) HasCanceledStatus added in v0.0.167

func (buildLog *BuildLog) HasCanceledStatus() bool

HasCanceledStatus returns true if aggregated status is canceled

func (*BuildLog) HasFailedStatus added in v0.0.175

func (buildLog *BuildLog) HasFailedStatus() bool

HasFailedStatus returns true if aggregated status is failed

func (*BuildLog) HasSucceededStatus added in v0.0.165

func (buildLog *BuildLog) HasSucceededStatus() bool

HasSucceededStatus returns true if aggregated status is succeeded

func (*BuildLog) HasUnknownStatus added in v0.0.175

func (buildLog *BuildLog) HasUnknownStatus() bool

HasUnknownStatus returns true if aggregated status is unknown

type BuildLogLine

type BuildLogLine struct {
	LineNumber int       `json:"line,omitempty"`
	Timestamp  time.Time `json:"timestamp"`
	StreamType string    `json:"streamType"`
	Text       string    `json:"text"`
}

BuildLogLine has low level log information

type BuildLogStep

type BuildLogStep struct {
	Step         string                   `json:"step"`
	Depth        int                      `json:"depth,omitempty"`
	Image        *BuildLogStepDockerImage `json:"image"`
	RunIndex     int                      `json:"runIndex,omitempty"`
	Duration     time.Duration            `json:"duration"`
	LogLines     []BuildLogLine           `json:"logLines"`
	ExitCode     int64                    `json:"exitCode"`
	Status       LogStatus                `json:"status"`
	AutoInjected bool                     `json:"autoInjected,omitempty"`
	NestedSteps  []*BuildLogStep          `json:"nestedSteps,omitempty"`
	Services     []*BuildLogStep          `json:"services,omitempty"`
}

BuildLogStep represents the logs for a single step of a pipeline

type BuildLogStepDockerImage

type BuildLogStepDockerImage struct {
	Name                   string        `json:"name"`
	Tag                    string        `json:"tag"`
	IsPulled               bool          `json:"isPulled"`
	ImageSize              int64         `json:"imageSize"`
	PullDuration           time.Duration `json:"pullDuration"`
	Error                  string        `json:"error,omitempty"`
	IsTrusted              bool          `json:"isTrusted,omitempty"`
	HasInjectedCredentials bool          `json:"hasInjectedCredentials,omitempty"`
}

BuildLogStepDockerImage represents info about the docker image used for a step

type BuildParamsConfig

type BuildParamsConfig struct {
	BuildID int `json:"buildID"`
}

BuildParamsConfig has config specific to builds

type BuilderConfig

type BuilderConfig struct {
	JobType JobType        `yaml:"jobType,omitempty" json:"jobType,omitempty"`
	Build   *Build         `yaml:"build,omitempty" json:"build,omitempty"`
	Release *Release       `yaml:"release,omitempty" json:"release,omitempty"`
	Bot     *Bot           `yaml:"bot,omitempty" json:"bot,omitempty"`
	Git     *GitConfig     `yaml:"git,omitempty" json:"git,omitempty"`
	Version *VersionConfig `yaml:"version,omitempty" json:"version,omitempty"`

	Track               *string                                `yaml:"track,omitempty" json:"track,omitempty"`
	DockerConfig        *DockerConfig                          `yaml:"dockerConfig,omitempty" json:"dockerConfig,omitempty"`
	Manifest            *manifest.EstafetteManifest            `yaml:"manifest,omitempty" json:"manifest,omitempty"`
	ManifestPreferences *manifest.EstafetteManifestPreferences `yaml:"manifestPreferences,omitempty" json:"manifestPreferences,omitempty"`
	JobName             *string                                `yaml:"jobName,omitempty" json:"jobName,omitempty"`
	Events              []manifest.EstafetteEvent              `yaml:"triggerEvents,omitempty" json:"triggerEvents,omitempty"`
	CIServer            *CIServerConfig                        `yaml:"ciServer,omitempty" json:"ciServer,omitempty"`
	Stages              []*manifest.EstafetteStage             `yaml:"stages,omitempty" json:"stages,omitempty"`
	Credentials         []*CredentialConfig                    `yaml:"credentials,omitempty" json:"credentials,omitempty"`
	TrustedImages       []*TrustedImageConfig                  `yaml:"trustedImages,omitempty" json:"trustedImages,omitempty"`
}

BuilderConfig parameterizes a build/release job

func (*BuilderConfig) GetCredentialsByType

func (c *BuilderConfig) GetCredentialsByType(filterType string) []*CredentialConfig

GetCredentialsByType returns all credentials of a certain type

func (*BuilderConfig) GetCredentialsForTrustedImage

func (c *BuilderConfig) GetCredentialsForTrustedImage(trustedImage TrustedImageConfig) map[string][]*CredentialConfig

GetCredentialsForTrustedImage returns all credentials of a certain type

func (*BuilderConfig) GetTrustedImage

func (c *BuilderConfig) GetTrustedImage(imagePath string) *TrustedImageConfig

GetTrustedImage returns a trusted image if the path without tag matches any of the trustedImages

func (*BuilderConfig) Validate added in v0.0.250

func (bc *BuilderConfig) Validate() (err error)

type CIServerConfig

type CIServerConfig struct {
	BaseURL          string    `json:"baseUrl"`
	BuilderEventsURL string    `json:"builderEventsUrl"`
	PostLogsURL      string    `json:"postLogsUrl"`
	CancelJobURL     string    `json:"cancelJobUrl"`
	JWT              string    `json:"jwt"`
	JWTExpiry        time.Time `json:"jwtExpiry"`
}

CIServerConfig has a number of config items related to communication or linking to the CI server

type CatalogEntity added in v0.0.210

type CatalogEntity struct {
	ID             string                 `json:"id,omitempty"`
	ParentKey      string                 `json:"parentKey,omitempty"`
	ParentValue    string                 `json:"parentValue,omitempty"`
	Key            string                 `json:"key,omitempty"`
	Value          string                 `json:"value,omitempty"`
	LinkedPipeline string                 `json:"linkedPipeline,omitempty"`
	Labels         []Label                `json:"labels,omitempty"`
	Metadata       map[string]interface{} `json:"metadata,omitempty"`
	InsertedAt     *time.Time             `json:"insertedAt,omitempty"`
	UpdatedAt      *time.Time             `json:"updatedAt,omitempty"`
}

CatalogEntity represents any entity stored in the catalog tree

type Client added in v0.0.206

type Client struct {
	ID            string          `json:"id,omitempty"`
	Active        bool            `json:"active,omitempty"`
	Name          string          `json:"name,omitempty"`
	ClientID      string          `json:"clientID,omitempty"`
	ClientSecret  string          `json:"clientSecret,omitempty"`
	Roles         []*string       `json:"roles,omitempty"`
	Organizations []*Organization `json:"organizations,omitempty"`
	CreatedAt     *time.Time      `json:"createdAt,omitempty"`
}

Client represents a client application registered with Estafette

type ContainerLinkDetail added in v0.0.263

type ContainerLinkDetail struct {
	Tag         string `json:"tag,omitempty"`
	PublicImage bool   `json:"publicImage,omitempty"`
}

type ContainerRepositoryCredentialConfig

type ContainerRepositoryCredentialConfig struct {
	Repository string `yaml:"repository"`
	Username   string `yaml:"username"`
	Password   string `yaml:"password"`
}

ContainerRepositoryCredentialConfig is used to authenticate for (private) container repositories (will be replaced by CredentialConfig eventually)

type CredentialConfig

type CredentialConfig struct {
	Name                 string                 `yaml:"name" json:"name"`
	Type                 string                 `yaml:"type" json:"type"`
	AllowedPipelines     string                 `yaml:"allowedPipelines,omitempty" json:"allowedPipelines,omitempty"`
	AllowedTrustedImages string                 `yaml:"allowedTrustedImages,omitempty" json:"allowedTrustedImages,omitempty"`
	AllowedBranches      string                 `yaml:"allowedBranches,omitempty" json:"allowedBranches,omitempty"`
	AdditionalProperties map[string]interface{} `yaml:",inline" json:"additionalProperties,omitempty"`
}

CredentialConfig is used to store credentials for every type of authenticated service you can use from docker registries, to kubernetes engine to, github apis, bitbucket; in combination with trusted images access to these centrally stored credentials can be limited

func AddCredentialsIfNotPresent

func AddCredentialsIfNotPresent(sourceCredentials []*CredentialConfig, newCredentials []*CredentialConfig) []*CredentialConfig

AddCredentialsIfNotPresent adds new credentials to source credentials if they're not present yet

func FilterCredentials

func FilterCredentials(credentials []*CredentialConfig, trustedImages []*TrustedImageConfig, fullRepositoryPath, branch string) []*CredentialConfig

FilterCredentials returns only credentials used by the trusted images

func FilterCredentialsByBranchesAllowList added in v0.0.228

func FilterCredentialsByBranchesAllowList(credentials []*CredentialConfig, branch string) (filteredCredentials []*CredentialConfig)

FilterCredentialsByBranchesAllowList returns the list of credentials filtered by the AllowedBranches property on the credentials

func FilterCredentialsByPipelinesAllowList added in v0.0.219

func FilterCredentialsByPipelinesAllowList(credentials []*CredentialConfig, fullRepositoryPath string) (filteredCredentials []*CredentialConfig)

FilterCredentialsByPipelinesAllowList returns the list of credentials filtered by the AllowedPipelines property on the credentials

func FilterCredentialsByTrustedImagesAllowList added in v0.0.219

func FilterCredentialsByTrustedImagesAllowList(credentials []*CredentialConfig, trustedImage TrustedImageConfig) (filteredCredentials []*CredentialConfig)

FilterCredentialsByTrustedImagesAllowList returns the list of credentials filtered by the AllowedTrustedImages property on the credentials

func GetCredentialsByType

func GetCredentialsByType(credentials []*CredentialConfig, filterType string) []*CredentialConfig

GetCredentialsByType returns all credentials of a certain type

func (*CredentialConfig) UnmarshalYAML

func (cc *CredentialConfig) UnmarshalYAML(unmarshal func(interface{}) error) (err error)

UnmarshalYAML customizes unmarshalling an EstafetteStage

type DockerConfig added in v0.0.234

type DockerConfig struct {
	RunType        DockerRunType         `yaml:"runType,omitempty" json:"runType,omitempty"`
	MTU            int                   `yaml:"mtu,omitempty" json:"mtu,omitempty"`
	BIP            string                `yaml:"bip,omitempty" json:"bip,omitempty"`
	Networks       []DockerNetworkConfig `yaml:"networks,omitempty" json:"networks,omitempty"`
	RegistryMirror string                `yaml:"registryMirror,omitempty" json:"registryMirror,omitempty"`
}

DockerConfig has configuration to configure docker in estafette-ci-builder

type DockerNetworkConfig added in v0.0.148

type DockerNetworkConfig struct {
	Name    string `json:"name"`
	Driver  string `json:"driver"`
	Subnet  string `json:"subnet"`
	Gateway string `json:"gateway"`
	Durable bool   `json:"durable"`
}

DockerNetworkConfig has settings for creating a user defined docker network to make service containers accessible by name from other containers

type DockerRunType added in v0.0.234

type DockerRunType string
const (
	// DockerRunTypeUnknown indicates the value couldn't be mapped
	DockerRunTypeUnknown DockerRunType = ""
	// DockerRunTypeDinD represents docker-inside-docker
	DockerRunTypeDinD DockerRunType = "dind"
	// DockerRunTypeDoD represents docker-outside-docker
	DockerRunTypeDoD DockerRunType = "dod"
)

type EstafetteCiBuilderEvent added in v0.0.255

type EstafetteCiBuilderEvent struct {
	BuildEventType BuildEventType `json:"buildEventType,omitempty"`
	JobType        JobType        `json:"jobType,omitempty"`
	JobName        string         `json:"job_name"`
	PodName        string         `json:"pod_name,omitempty"`

	Build   *Build     `json:"build,omitempty"`
	Release *Release   `json:"release,omitempty"`
	Bot     *Bot       `json:"bot,omitempty"`
	Git     *GitConfig `json:"git,omitempty"`
}

func (*EstafetteCiBuilderEvent) GetStatus added in v0.0.256

func (bc *EstafetteCiBuilderEvent) GetStatus() Status

func (*EstafetteCiBuilderEvent) SetStatus added in v0.0.258

func (bc *EstafetteCiBuilderEvent) SetStatus(status Status)

func (*EstafetteCiBuilderEvent) Validate added in v0.0.255

func (bc *EstafetteCiBuilderEvent) Validate() (err error)

type GitAuthor

type GitAuthor struct {
	Email    string `json:"email"`
	Name     string `json:"name"`
	Username string `json:"username"`
}

GitAuthor represents the author of a commmit

type GitCommit

type GitCommit struct {
	Message string    `json:"message"`
	Author  GitAuthor `json:"author"`
}

GitCommit represents a commit summary

type GitConfig

type GitConfig struct {
	RepoSource   string `json:"repoSource"`
	RepoOwner    string `json:"repoOwner"`
	RepoName     string `json:"repoName"`
	RepoBranch   string `json:"repoBranch"`
	RepoRevision string `json:"repoRevision"`
}

GitConfig contains all information for cloning the git repository for building/releasing a specific version

type Group added in v0.0.204

type Group struct {
	ID            string           `json:"id,omitempty"`
	Active        bool             `json:"active,omitempty"`
	Name          string           `json:"name,omitempty"`
	Description   string           `json:"description,omitempty"`
	Identities    []*GroupIdentity `json:"identities,omitempty"`
	Organizations []*Organization  `json:"organizations,omitempty"`
	Roles         []*string        `json:"roles,omitempty"`
}

Group represents a group of users as configured in different systems

type GroupIdentity added in v0.0.204

type GroupIdentity struct {
	Provider string `json:"provider,omitempty"`
	ID       string `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
}

GroupIdentity represents the various identities a group can have in different systems

type JobType added in v0.0.250

type JobType string
const (
	JobTypeUnknown JobType = ""
	JobTypeBuild   JobType = "build"
	JobTypeRelease JobType = "release"
	JobTypeBot     JobType = "bot"
)

type Label

type Label struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Label represents a key/value pair as set in a build manifest

type ListResponse

type ListResponse struct {
	Items      []interface{} `json:"items"`
	Pagination Pagination    `json:"pagination"`
}

ListResponse is a container for paginated filtered list items

type LogStatus added in v0.0.225

type LogStatus string
const (
	// LogStatusUnknown indicates execution never started for some reason
	LogStatusUnknown LogStatus = "UNKNOWN"
	// LogStatusSucceeded indicates execution was successful
	LogStatusSucceeded LogStatus = "SUCCEEDED"
	// LogStatusFailed indicates execution was not successful
	LogStatusFailed LogStatus = "FAILED"
	// LogStatusSkipped indicates execution was skipped
	LogStatusSkipped LogStatus = "SKIPPED"
	// LogStatusCanceled indicates execution was canceled
	LogStatusCanceled LogStatus = "CANCELED"
	// LogStatusPending indicates container is pulling
	LogStatusPending LogStatus = "PENDING"
	// LogStatusRunning indicates container is running
	LogStatusRunning LogStatus = "RUNNING"
)

func GetAggregatedStatus added in v0.0.164

func GetAggregatedStatus(steps []*BuildLogStep) LogStatus

GetAggregatedStatus returns the status aggregated across all stages

func (LogStatus) Equals added in v0.0.230

func (l LogStatus) Equals(s Status) bool

func (LogStatus) ToStatus added in v0.0.231

func (l LogStatus) ToStatus() Status

type LogType added in v0.0.225

type LogType string
const (
	// TypeStage indicates that a tail message is for a main stage or parallel stage
	LogTypeStage LogType = "stage"
	// TypeService indicates that a tail message is for a service container
	LogTypeService LogType = "service"
)

type Notification added in v0.0.261

type Notification struct {
	Type    NotificationType  `json:"type,omitempty"`
	Level   NotificationLevel `json:"level,omitempty"`
	Message string            `json:"message,omitempty"`
}

type NotificationLevel added in v0.0.261

type NotificationLevel string
const (
	NotificationLevelUnknown  NotificationLevel = ""
	NotificationLevelCritical NotificationLevel = "critical"
	NotificationLevelHigh     NotificationLevel = "high"
	NotificationLevelMedium   NotificationLevel = "medium"
	NotificationLevelLow      NotificationLevel = "low"
)

type NotificationLinkType added in v0.0.262

type NotificationLinkType string
const (
	NotificationLinkTypeUnknown   NotificationLinkType = ""
	NotificationLinkTypePipeline  NotificationLinkType = "pipeline"
	NotificationLinkTypeContainer NotificationLinkType = "container"
)

type NotificationRecord added in v0.0.262

type NotificationRecord struct {
	ID       string               `json:"id,omitempty"`
	LinkType NotificationLinkType `json:"linkType,omitempty"`
	LinkID   string               `json:"linkID,omitempty"`

	// fields mapped to link_detail column
	PipelineDetail  *PipelineLinkDetail  `json:"pipelineDetail,omitempty"`
	ContainerDetail *ContainerLinkDetail `json:"containerDetail,omitempty"`

	Source        string          `json:"source,omitempty"`
	Notifications []Notification  `json:"notifications,omitempty"`
	InsertedAt    *time.Time      `json:"insertedAt,omitempty"`
	Groups        []*Group        `json:"groups,omitempty"`
	Organizations []*Organization `json:"organizations,omitempty"`
}

func (*NotificationRecord) GetGroups added in v0.0.264

func (nr *NotificationRecord) GetGroups() ([]byte, error)

func (*NotificationRecord) GetLinkDetail added in v0.0.263

func (nr *NotificationRecord) GetLinkDetail() ([]byte, error)

func (*NotificationRecord) GetNotifications added in v0.0.265

func (nr *NotificationRecord) GetNotifications() ([]byte, error)

func (*NotificationRecord) GetOrganizations added in v0.0.264

func (nr *NotificationRecord) GetOrganizations() ([]byte, error)

func (*NotificationRecord) SetGroups added in v0.0.264

func (nr *NotificationRecord) SetGroups(groups []byte) error

func (*NotificationRecord) SetLinkDetail added in v0.0.263

func (nr *NotificationRecord) SetLinkDetail(linkDetail []byte) error

func (*NotificationRecord) SetNotifications added in v0.0.265

func (nr *NotificationRecord) SetNotifications(notifications []byte) error

func (*NotificationRecord) SetOrganizations added in v0.0.264

func (nr *NotificationRecord) SetOrganizations(organizations []byte) error

type NotificationType added in v0.0.261

type NotificationType string
const (
	NotificationTypeUnknown       NotificationType = ""
	NotificationTypeVulnerability NotificationType = "vulnerability"
	NotificationTypeWarning       NotificationType = "warning"
)

type Organization added in v0.0.204

type Organization struct {
	ID         string                  `json:"id,omitempty"`
	Active     bool                    `json:"active,omitempty"`
	Name       string                  `json:"name,omitempty"`
	Identities []*OrganizationIdentity `json:"identities,omitempty"`
	Roles      []*string               `json:"roles,omitempty"`
}

Organization represents an organization that uses a multi-tenancy installation

type OrganizationIdentity added in v0.0.204

type OrganizationIdentity struct {
	Provider string `json:"provider,omitempty"`
	ID       string `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
}

OrganizationIdentity represents the various identities an organization can have in different systems

type Pagination

type Pagination struct {
	Page       int `json:"page"`
	Size       int `json:"size"`
	TotalPages int `json:"totalPages"`
	TotalItems int `json:"totalItems"`
}

Pagination indicates the current page, the size of the pages and total pages / items

type Pipeline

type Pipeline struct {
	ID                   string                      `json:"id"`
	RepoSource           string                      `json:"repoSource"`
	RepoOwner            string                      `json:"repoOwner"`
	RepoName             string                      `json:"repoName"`
	RepoBranch           string                      `json:"repoBranch"`
	RepoRevision         string                      `json:"repoRevision"`
	BuildVersion         string                      `json:"buildVersion,omitempty"`
	BuildStatus          Status                      `json:"buildStatus,omitempty"`
	Labels               []Label                     `json:"labels,omitempty"`
	ReleaseTargets       []ReleaseTarget             `json:"releaseTargets,omitempty"`
	Manifest             string                      `json:"manifest,omitempty"`
	ManifestWithDefaults string                      `json:"manifestWithDefaults,omitempty"`
	Commits              []GitCommit                 `json:"commits,omitempty"`
	Triggers             []manifest.EstafetteTrigger `json:"triggers,omitempty"`
	Events               []manifest.EstafetteEvent   `json:"triggerEvents,omitempty"`
	Archived             bool                        `json:"archived,omitempty"`
	InsertedAt           time.Time                   `json:"insertedAt"`
	StartedAt            *time.Time                  `json:"startedAt,omitempty"`
	UpdatedAt            time.Time                   `json:"updatedAt"`
	Duration             time.Duration               `json:"duration"`
	PendingDuration      *time.Duration              `json:"pendingDuration,omitempty"`
	LastUpdatedAt        time.Time                   `json:"lastUpdatedAt"`
	ManifestObject       *manifest.EstafetteManifest `json:"-"`
	RecentCommitters     []string                    `json:"recentCommitters,omitempty"`
	RecentReleasers      []string                    `json:"recentReleasers,omitempty"`
	ExtraInfo            *PipelineExtraInfo          `json:"extraInfo,omitempty"`
	Groups               []*Group                    `json:"groups,omitempty"`
	Organizations        []*Organization             `json:"organizations,omitempty"`
}

Pipeline represents a pipeline with the latest build info, including version number, repo, branch, revision, labels and manifest

func (*Pipeline) GetFullRepoPath added in v0.0.155

func (pipeline *Pipeline) GetFullRepoPath() string

GetFullRepoPath returns the full path of the pipeline repository with source, owner and name

type PipelineExtraInfo added in v0.0.214

type PipelineExtraInfo struct {
	MedianPendingDuration time.Duration `json:"medianPendingDuration"`
	MedianDuration        time.Duration `json:"medianDuration"`
}

PipelineExtraInfo contains extra information like aggregates over the last x builds

type PipelineLinkDetail added in v0.0.263

type PipelineLinkDetail struct {
	Branch   string `json:"branch,omitempty"`
	Revision string `json:"revision"`
	Version  string `json:"version,omitempty"`
	Status   Status `json:"status,omitempty"`
}

type Release

type Release struct {
	Name            string                    `json:"name"`
	Action          string                    `json:"action,omitempty"`
	ID              string                    `json:"id,omitempty"`
	RepoSource      string                    `json:"repoSource,omitempty"`
	RepoOwner       string                    `json:"repoOwner,omitempty"`
	RepoName        string                    `json:"repoName,omitempty"`
	ReleaseVersion  string                    `json:"releaseVersion,omitempty"`
	ReleaseStatus   Status                    `json:"releaseStatus,omitempty"`
	Events          []manifest.EstafetteEvent `json:"triggerEvents,omitempty"`
	InsertedAt      *time.Time                `json:"insertedAt,omitempty"`
	StartedAt       *time.Time                `json:"startedAt,omitempty"`
	UpdatedAt       *time.Time                `json:"updatedAt,omitempty"`
	Duration        *time.Duration            `json:"duration,omitempty"`
	PendingDuration *time.Duration            `json:"pendingDuration,omitempty"`
	ExtraInfo       *ReleaseExtraInfo         `json:"extraInfo,omitempty"`
	Groups          []*Group                  `json:"groups,omitempty"`
	Organizations   []*Organization           `json:"organizations,omitempty"`
}

Release represents a release of a pipeline

func (*Release) GetFullRepoPath added in v0.0.155

func (release *Release) GetFullRepoPath() string

GetFullRepoPath returns the full path of the release repository with source, owner and name

type ReleaseExtraInfo added in v0.0.215

type ReleaseExtraInfo struct {
	MedianPendingDuration time.Duration `json:"medianPendingDuration"`
	MedianDuration        time.Duration `json:"medianDuration"`
}

ReleaseExtraInfo contains extra information like aggregates over the last x releases

type ReleaseLog

type ReleaseLog struct {
	ID         string          `json:"id,omitempty"`
	RepoSource string          `json:"repoSource"`
	RepoOwner  string          `json:"repoOwner"`
	RepoName   string          `json:"repoName"`
	ReleaseID  string          `json:"releaseID"`
	Steps      []*BuildLogStep `json:"steps"`
	InsertedAt time.Time       `json:"insertedAt"`
}

ReleaseLog represents a release log for a specific release

func (*ReleaseLog) GetAggregatedStatus added in v0.0.164

func (releaseLog *ReleaseLog) GetAggregatedStatus() LogStatus

GetAggregatedStatus returns the status aggregated across all stages

func (*ReleaseLog) HasCanceledStatus added in v0.0.167

func (releaseLog *ReleaseLog) HasCanceledStatus() bool

HasCanceledStatus returns true if aggregated status is canceled

func (*ReleaseLog) HasFailedStatus added in v0.0.175

func (releaseLog *ReleaseLog) HasFailedStatus() bool

HasFailedStatus returns true if aggregated status is failed

func (*ReleaseLog) HasSucceededStatus added in v0.0.165

func (releaseLog *ReleaseLog) HasSucceededStatus() bool

HasSucceededStatus returns true if aggregated status is succeeded

func (*ReleaseLog) HasUnknownStatus added in v0.0.175

func (releaseLog *ReleaseLog) HasUnknownStatus() bool

HasUnknownStatus returns true if aggregated status is unknown

type ReleaseParamsConfig

type ReleaseParamsConfig struct {
	ReleaseName   string `json:"releaseName"`
	ReleaseID     int    `json:"releaseID"`
	ReleaseAction string `json:"releaseAction,omitempty"`
	TriggeredBy   string `json:"triggeredBy,omitempty"`
}

ReleaseParamsConfig has config specific to releases

type ReleaseTarget

type ReleaseTarget struct {
	Name           string                            `json:"name"`
	Actions        []manifest.EstafetteReleaseAction `json:"actions,omitempty"`
	ActiveReleases []Release                         `json:"activeReleases,omitempty"`
}

ReleaseTarget contains the information to visualize and trigger release

type Status added in v0.0.225

type Status string
const (
	// StatusPending indicates container is pulling
	StatusPending Status = "pending"
	// StatusRunning indicates container is running
	StatusRunning Status = "running"
	// StatusSucceeded indicates execution was successful
	StatusSucceeded Status = "succeeded"
	// StatusFailed indicates execution was not successful
	StatusFailed Status = "failed"
	// StatusCanceling indicates execution is canceling
	StatusCanceling Status = "canceling"
	// StatusCanceled indicates execution was canceled
	StatusCanceled Status = "canceled"

	// StatusUnknown provides a default but not allowed status for unmarshalling
	StatusUnknown Status = ""
)

func (Status) Equals added in v0.0.230

func (s Status) Equals(l LogStatus) bool

func (Status) ToLogStatus added in v0.0.231

func (s Status) ToLogStatus() LogStatus

type TailLogLine

type TailLogLine struct {
	Step         string                   `json:"step"`
	ParentStage  string                   `json:"parentStage,omitempty"`
	Type         LogType                  `json:"type"`
	Depth        int                      `json:"depth,omitempty"`
	RunIndex     int                      `json:"runIndex,omitempty"`
	LogLine      *BuildLogLine            `json:"logLine,omitempty"`
	Image        *BuildLogStepDockerImage `json:"image,omitempty"`
	Duration     *time.Duration           `json:"duration,omitempty"`
	ExitCode     *int64                   `json:"exitCode,omitempty"`
	Status       *LogStatus               `json:"status,omitempty"`
	AutoInjected *bool                    `json:"autoInjected,omitempty"`
}

TailLogLine returns a log line for streaming logs to gui during a build

type TrustedImageConfig

type TrustedImageConfig struct {
	ImagePath               string   `yaml:"path" json:"path"`
	RunPrivileged           bool     `yaml:"runPrivileged" json:"runPrivileged"`
	RunDocker               bool     `yaml:"runDocker" json:"runDocker"`
	AllowCommands           bool     `yaml:"allowCommands" json:"allowCommands"`
	AllowNotifications      bool     `yaml:"allowNotifications" json:"allowNotifications"`
	InjectedCredentialTypes []string `yaml:"injectedCredentialTypes,omitempty" json:"injectedCredentialTypes,omitempty"`
	AllowedPipelines        string   `yaml:"allowedPipelines,omitempty" json:"allowedPipelines,omitempty"`
}

TrustedImageConfig allows trusted images to run docker commands or receive specific credentials

func FilterTrustedImages

func FilterTrustedImages(trustedImages []*TrustedImageConfig, stages []*manifest.EstafetteStage, fullRepositoryPath string) []*TrustedImageConfig

FilterTrustedImages returns only trusted images used in the stages

func FilterTrustedImagesByPipelinesAllowList added in v0.0.219

func FilterTrustedImagesByPipelinesAllowList(trustedImages []*TrustedImageConfig, fullRepositoryPath string) (filteredTrustedImages []*TrustedImageConfig)

FilterTrustedImagesByPipelinesAllowList returns the list of trusted images filtered by the AllowedTrustedPipelines property on the trusted images

func GetTrustedImage

func GetTrustedImage(trustedImages []*TrustedImageConfig, imagePath string) *TrustedImageConfig

GetTrustedImage returns a trusted image if the path without tag matches any of the trustedImages

type User added in v0.0.189

type User struct {
	ID                  string                 `json:"id,omitempty"`
	Active              bool                   `json:"active,omitempty"`
	Identities          []*UserIdentity        `json:"identities,omitempty"`
	Groups              []*Group               `json:"groups,omitempty"`
	Organizations       []*Organization        `json:"organizations,omitempty"`
	Roles               []*string              `json:"roles,omitempty"`
	Preferences         map[string]interface{} `json:"preferences,omitempty"`
	FirstVisit          *time.Time             `json:"firstVisit,omitempty"`
	LastVisit           *time.Time             `json:"lastVisit,omitempty"`
	CurrentProvider     string                 `json:"currentProvider,omitempty"`
	CurrentOrganization string                 `json:"currentOrganization,omitempty"`

	// computed fields
	Name  string `json:"name,omitempty"`
	Email string `json:"email,omitempty"`
}

User represents a user of Estafette

func (*User) AddRole added in v0.0.201

func (u *User) AddRole(role string)

AddRole adds a role if it's not present

func (*User) GetEmail added in v0.0.197

func (u *User) GetEmail() string

GetEmail returns the first identity email address

func (*User) GetName added in v0.0.197

func (u *User) GetName() string

GetName returns the first identity name

func (*User) GetProvider added in v0.0.197

func (u *User) GetProvider() string

GetProvider returns the first identity provider

func (*User) HasRole added in v0.0.201

func (u *User) HasRole(role string) bool

HasRole returns true if a user has the parameterized role

func (*User) RemoveRole added in v0.0.201

func (u *User) RemoveRole(role string)

RemoveRole removes a role if it's present

type UserIdentity added in v0.0.189

type UserIdentity struct {
	Provider string `json:"provider,omitempty"`
	ID       string `json:"id,omitempty"`
	Email    string `json:"email,omitempty"`
	Name     string `json:"name,omitempty"`
	Avatar   string `json:"avatar,omitempty"`
}

UserIdentity represents the various identities a user can have in different systems

type VersionConfig added in v0.0.252

type VersionConfig struct {
	Version                 string  `json:"version"`
	Major                   *int    `json:"major,omitempty"`
	Minor                   *int    `json:"minor,omitempty"`
	Patch                   *string `json:"patch,omitempty"`
	Label                   *string `json:"label,omitempty"`
	AutoIncrement           *int    `json:"autoincrement,omitempty"`
	CurrentCounter          int     `json:"currentCounter,omitempty"`
	MaxCounter              int     `json:"maxCounter,omitempty"`
	MaxCounterCurrentBranch int     `json:"maxCounterCurrentBranch,omitempty"`
}

VersionConfig contains all information regarding the version number to build or release

type Warning

type Warning struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

Warning is used to issue warnings for not following best practices

Jump to

Keyboard shortcuts

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