internal

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// URIHealthz represents URI for health check
	URIHealthz = "/healthz"
	URIVersion = "/version"

	//SamsahaiCtrlName           = "samsahai-ctrl"
	SamsahaiAuthHeader  = "x-samsahai-auth"
	SamsahaiDefaultPort = "8080"

	StagingCtrlName    = "s2h-staging-ctrl"
	StagingDefaultPort = 8090

	// Viper keys
	VKDebug                           = "debug"
	VKServerHTTPPort                  = "port"
	VKMetricHTTPPort                  = "metric-port"
	VKPodNamespace                    = "pod-namespace"
	VKS2HConfigPath                   = "s2h-config-path"
	VKClusterDomain                   = "cluster-domain"
	VKS2HTeamName                     = "s2h-team-name"
	VKS2HAuthToken                    = "s2h-auth-token"
	VKS2HServerURL                    = "s2h-server-url"
	VKS2HServiceName                  = "s2h-service-name"
	VKS2HServiceScheme                = "s2h-service-scheme"
	VKS2HImage                        = "s2h-image"
	VKS2HExternalURL                  = "s2h-external-url"
	VKTeamcityURL                     = "teamcity-url"
	VKTeamcityUsername                = "teamcity-username"
	VKTeamcityPassword                = "teamcity-password"
	VKSlackToken                      = "slack-token"
	VKGithubURL                       = "github-url"
	VKGithubToken                     = "github-token"
	VKMSTeamsTenantID                 = "ms-teams-tenant-id"
	VKMSTeamsClientID                 = "ms-teams-client-id"
	VKMSTeamsClientSecret             = "ms-teams-client-secret"
	VKMSTeamsUsername                 = "ms-teams-username"
	VKMSTeamsPassword                 = "ms-teams-password"
	VKActivePromotionConcurrences     = "active-promotion-concurrences"
	VKActivePromotionTimeout          = "active-promotion-timeout"
	VKActivePromotionDemotionTimeout  = "active-demotion-timeout"
	VKActivePromotionRollbackTimeout  = "active-promotion-rollback-timeout"
	VKActivePromotionTearDownDuration = "active-promotion-teardown-duration"
	VKActivePromotionMaxRetry         = "active-promotion-max-retry"
	VKActivePromotionMaxHistories     = "active-promotion-max-histories"
	VKActivePromotionOnTeamCreation   = "active-promotion-on-team-creation"
	VKQueueMaxHistoryDays             = "queue-max-history-days"
	VKPRQueueConcurrences             = "pr-queue-concurrences"
	VKPRVerificationMaxRetry          = "pr-verification-max-retry"
	VKPRTriggerMaxRetry               = "pr-trigger-max-retry"
	VKPRTriggerPollingTime            = "pr-trigger-polling-time"
	VKPullRequestQueueMaxHistoryDays  = "pr-queue-max-history-days"
)
View Source
const AbbreviationName = "s2h"
View Source
const AppName = "samsahai"
View Source
const AppPrefix = AbbreviationName + "-"
View Source
const (
	MaxReleaseNameLength = 53
)

Variables

View Source
var GitCommit string

GitCommit defines commit hash of git during built

View Source
var Version string

Version defines the version of application

Functions

func GenConfigHashID added in v1.8.8

func GenConfigHashID(configStatus s2hv1.ConfigStatus) string

GenConfigHashID generates config hash from Config status.used

func GenPullRequestBundleName added in v1.10.0

func GenPullRequestBundleName(bundle, prNumber string) string

GenPullRequestBundleName generates PullRequest object name from bundle name and pull request number

func GenReleaseName

func GenReleaseName(namespace, compName string) string

GenReleaseName returns the release name for deploying components

func GenStagingNamespace

func GenStagingNamespace(teamName string) string

GenStagingNamespace returns the name of staging namespace by team name

func GenTeamHashID added in v1.8.8

func GenTeamHashID(teamStatus s2hv1.TeamStatus) string

GenTeamHashID generates team hash from Team status.used

func GetDefaultLabels

func GetDefaultLabels(teamName string) map[string]string

GetDefaultLabels returns default labels for kubernetes resources

func GetTeamLabelKey

func GetTeamLabelKey() string

GetTeamLabelKey returns team label key

Types

type ActiveEnvironmentDeletedReporter added in v1.8.10

type ActiveEnvironmentDeletedReporter struct {
	TeamName        string `json:"teamName,omitempty"`
	ActiveNamespace string `json:"activeNamespace,omitempty"`
	DeletedBy       string `json:"deletedBy,omitempty"`
	DeletedAt       string `json:"deletedAt,omitempty"`
}

ActiveEnvironmentDeletedReporter manages active namespace deletion report

func NewActiveEnvironmentDeletedReporter added in v1.8.10

func NewActiveEnvironmentDeletedReporter(teamname, activeNs, deletedBy, deleteAt string) *ActiveEnvironmentDeletedReporter

NewActiveEnvironmentDeletedReporter creates deleted active namespace reporter object

type ActivePromotionConfig

type ActivePromotionConfig struct {
	// Concurrences defines number of active promotion concurrences
	Concurrences int `json:"concurrences" yaml:"concurrences"`

	// Timeout defines timeout duration of active promotion process
	Timeout metav1.Duration `json:"timeout" yaml:"timeout"`

	// DemotionTimeout defines timeout duration of active demotion process
	DemotionTimeout metav1.Duration `json:"demotionTimeout" yaml:"demotionTimeout"`

	// RollbackTimeout defines timeout duration of rollback process
	RollbackTimeout metav1.Duration `json:"rollbackTimeout" yaml:"rollbackTimeout"`

	// TearDownDuration defines tear down duration of previous active environment
	TearDownDuration metav1.Duration `json:"teardownDuration" yaml:"teardownDuration"`

	// MaxRetry defines max retry counts of active promotion process in case failure
	MaxRetry *int `json:"maxRetry"`

	// MaxHistories defines max stored histories of active promotion
	MaxHistories int `json:"maxHistories" yaml:"maxHistories"`

	// PromoteOnTeamCreation defines whether auto-promote active environment or not when team creation?
	PromoteOnTeamCreation bool `json:"promoteOnTeamCreation" yaml:"promoteOnTeamCreation"`
}

ActivePromotionConfig represents configuration of active promotion

type ActivePromotionController

type ActivePromotionController interface {
}

type ActivePromotionOption

type ActivePromotionOption func(*ActivePromotionReporter)

ActivePromotionOption allows specifying various configuration

func WithActivePromotionOptCredential added in v1.8.3

func WithActivePromotionOptCredential(creds s2hv1.Credential) ActivePromotionOption

TODO: should override tc credential per team WithActivePromotionOptCredential specifies credential to override when create active promotion reporter object

type ActivePromotionReporter

type ActivePromotionReporter struct {
	TeamName               string           `json:"teamName,omitempty"`
	CurrentActiveNamespace string           `json:"currentActiveNamespace,omitempty"`
	Runs                   int              `json:"runs,omitempty"`
	Credential             s2hv1.Credential `json:"credential,omitempty"`
	Envs                   map[string]string
	s2hv1.ActivePromotionStatus
	SamsahaiConfig
}

ActivePromotionReporter manages active promotion report

func NewActivePromotionReporter

func NewActivePromotionReporter(status s2hv1.ActivePromotionStatus, s2hConfig SamsahaiConfig,
	teamName, currentNs string, runs int, opts ...ActivePromotionOption) *ActivePromotionReporter

NewActivePromotionReporter creates active promotion reporter object

type ComponentUpgradeOption

type ComponentUpgradeOption func(*ComponentUpgradeReporter)

ComponentUpgradeOption allows specifying various configuration

func WithComponentUpgradeOptCredential added in v1.8.3

func WithComponentUpgradeOptCredential(creds s2hv1.Credential) ComponentUpgradeOption

WithComponentUpgradeOptCredential specifies credential to override when create component upgrade reporter object

func WithNamespace added in v1.7.0

func WithNamespace(ns string) ComponentUpgradeOption

WithNamespace specifies namespace to override when creating component upgrade reporter object

func WithQueueHistoryName

func WithQueueHistoryName(qHist string) ComponentUpgradeOption

WithQueueHistoryName specifies queuehistory name to override when creating component upgrade reporter object QueueHistoryName will be the latest failure of component upgrade if reverification is success, QueueHistoryName will be the history of queue before running reverification

func WithTestRunner

func WithTestRunner(tr s2hv1.TestRunner) ComponentUpgradeOption

WithTestRunner specifies test runner to override when creating component upgrade reporter object

type ComponentUpgradeReporter

type ComponentUpgradeReporter struct {
	IssueTypeStr IssueType        `json:"issueTypeStr,omitempty"`
	StatusStr    StatusType       `json:"statusStr,omitempty"`
	StatusInt    int32            `json:"statusInt,omitempty"`
	TestRunner   s2hv1.TestRunner `json:"testRunner,omitempty"`
	Credential   s2hv1.Credential `json:"credential,omitempty"`
	Envs         map[string]string

	*rpc.ComponentUpgrade
	SamsahaiConfig
}

ComponentUpgradeReporter manages component upgrade report

func NewComponentUpgradeReporter

func NewComponentUpgradeReporter(comp *rpc.ComponentUpgrade, s2hConfig SamsahaiConfig, opts ...ComponentUpgradeOption) *ComponentUpgradeReporter

NewComponentUpgradeReporter creates component upgrade reporter from rpc object

type ConfigController added in v1.1.0

type ConfigController interface {
	// Get returns configuration from memory
	Get(configName string) (*s2hv1.Config, error)

	// GetComponents returns all components from `Configuration` that has valid `Source`
	GetComponents(configName string) (map[string]*s2hv1.Component, error)

	// GetParentComponents returns components that doesn't have parent (nil Parent)
	GetParentComponents(configName string) (map[string]*s2hv1.Component, error)

	// GetPullRequestComponents returns all pull request components of a given bundle name
	// with or without dependencies from `Configuration` that has valid `Source`
	GetPullRequestComponents(configName, prBundleName string, depIncluded bool) (map[string]*s2hv1.Component, error)

	// GetBundles returns a group of components for each bundle
	GetBundles(configName string) (s2hv1.ConfigBundles, error)

	// GetPriorityQueues returns a list of priority queues which defined in Config
	GetPriorityQueues(configName string) ([]string, error)

	// GetPullRequestConfig returns a configuration of pull request
	GetPullRequestConfig(configName string) (*s2hv1.ConfigPullRequest, error)

	// GetPullRequestBundleDependencies returns dependencies list of a pull request bundle from configuration
	GetPullRequestBundleDependencies(configName, prBundleName string) ([]string, error)

	// Update updates Config CRD
	Update(config *s2hv1.Config) error

	// Delete deletes Config CRD
	Delete(configName string) error

	//EnsureConfigTemplateChanged updates config if template changed
	EnsureConfigTemplateChanged(config *s2hv1.Config) error
}

type ConfigurationJSON

type ConfigurationJSON struct {
	GitRevision   string            `json:"gitRevision"`
	Configuration *s2hv1.ConfigSpec `json:"config"`
}

type Connection

type Connection struct {
	Name          string `json:"name"`
	URL           string `json:"url"`
	IP            string `json:"ip"`
	Port          string `json:"port"`
	ServicePort   string `json:"servicePort"`
	Type          string `json:"type"`
	ContainerPort string `json:"containerPort"`
}

type DeployEngine

type DeployEngine interface {
	// GetName returns name of deploy engine
	GetName() string

	// GetValues returns yaml values of release deployment
	GetValues() (map[string][]byte, error)

	// Create creates environment
	Create(refName string, comp *s2hv1.Component, parentComp *s2hv1.Component, values map[string]interface{}, deployTimeout *time.Duration) error

	// Rollback rollback helm release
	Rollback(refName string, revision int) error

	// GetHistories returns histories of release
	GetHistories(refName string) ([]*release.Release, error)

	// Delete deletes environment
	Delete(refName string) error

	// ForceDelete deletes environment when timeout
	ForceDelete(refName string) error

	// GetLabelSelector returns map of label for select the components that created by the engine
	GetLabelSelectors(refName string) map[string]string

	// GetReleases returns all deployed releases
	GetReleases() ([]*release.Release, error)

	// IsMocked uses for skip some functions due to mock deploy
	//
	// Skipped function: WaitForComponentsCleaned
	IsMocked() bool
}

type DesiredComponentChecker

type DesiredComponentChecker interface {
	// GetName returns name of checker
	GetName() string

	// GetVersion returns version from defined pattern
	GetVersion(repository string, name string, pattern string) (string, error)

	//EnsureVersion ensures the defined version is exist on repository
	EnsureVersion(repository string, name string, version string) error
}

DesiredComponentChecker represents standard interface for checking component version

type DesiredComponentController

type DesiredComponentController interface {
}

type EventType

type EventType string

EventType represents an event type of reporter

const (
	ComponentUpgradeType         EventType = "ComponentUpgrade"
	ActivePromotionType          EventType = "ActivePromotion"
	ImageMissingType             EventType = "ImageMissing"
	PullRequestTriggerType       EventType = "PullRequestTrigger"
	PullRequestQueueType         EventType = "PullRequestQueue"
	ActiveEnvironmentDeletedType EventType = "ActiveEnvironmentDeleted"
)

type GitInfo

type GitInfo struct {
	Name         string
	FullName     string
	BranchName   string
	HeadRevision string
}

GitInfo represents git repo, branch info. for process the update

type HTTPHeader

type HTTPHeader string

type ImageMissingReporter added in v1.4.1

type ImageMissingReporter struct {
	TeamName      string `json:"teamName,omitempty"`
	ComponentName string `json:"componentName,omitempty"`
	// Reason represents error reason
	Reason string `json:"reason,omitempty"`
	Envs   map[string]string
	s2hv1.Image
	SamsahaiConfig
}

ImageMissingReporter manages image missing report

func NewImageMissingReporter added in v1.4.1

func NewImageMissingReporter(image s2hv1.Image, s2hConfig SamsahaiConfig,
	teamName, compName, reason string) *ImageMissingReporter

NewImageMissingReporter creates image missing reporter object

type IssueType

type IssueType string

IssueType represents an issue type of component upgrade failure

const (
	IssueUnknown              IssueType = "Unknown issue"
	IssueDesiredVersionFailed IssueType = "Desired component failed"
	IssueImageMissing         IssueType = "Image missing"
	IssueEnvironment          IssueType = "Environment issue - Verification failed"
)

type MSTeamsCredential added in v1.3.0

type MSTeamsCredential struct {
	TenantID     string
	ClientID     string
	ClientSecret string
	Username     string
	Password     string
}

type Plugin

type Plugin interface {
	DesiredComponentChecker

	// GetComponentName returns component name when incoming webhook matched with plugin name.
	// Useful for converting incoming component name to matched with the internal one.
	GetComponentName(name string) string
}

type PostNamespaceCreation

type PostNamespaceCreation struct {
	// Namespace defines a creating namespace
	Namespace string     `json:"namespace"`
	Team      s2hv1.Team `json:"team"`
	SamsahaiConfig
}

PostNamespaceCreation represents a struct for running post namespace creation

type PullRequestConfig added in v1.7.0

type PullRequestConfig struct {
	// QueueConcurrences defines number of pull request queue concurrences
	QueueConcurrences int `json:"queueConcurrences" yaml:"queueConcurrences"`

	// MaxVerificationRetryCounts defines the maximum times of pull request has been verified
	MaxVerificationRetryCounts int `json:"maxVerificationRetryCounts" yaml:"maxVerificationRetryCounts"`

	// MaxPRTriggerRetryCounts defines the maximum times of pull request has been triggered
	MaxTriggerRetryCounts int `json:"maxTriggerRetryCounts" yaml:"maxTriggerRetryCounts"`

	// TriggerPollingTime defines a waiting duration time to re-check the pull request image in the registry
	TriggerPollingTime metav1.Duration `json:"triggerPollingTime" yaml:"triggerPollingTime"`

	// MaxHistoryDays defines maximum days of PullRequestQueueHistory stored
	MaxHistoryDays int `json:"maxHistoryDays" yaml:"maxHistoryDays"`
}

PullRequestConfig represents configuration of pull request

type PullRequestData added in v1.7.2

type PullRequestData struct {
	// PRNumber defines a pull request number
	PRNumber string
}

PullRequestData defines a pull request data for template rendering

type PullRequestTriggerController added in v1.7.0

type PullRequestTriggerController interface {
}

type PullRequestTriggerReporter added in v1.7.0

type PullRequestTriggerReporter struct {
	TeamName   string                               `json:"teamName,omitempty"`
	BundleName string                               `json:"bundleName,omitempty"`
	PRNumber   string                               `json:"prNumber,omitempty"`
	Result     string                               `json:"result,omitempty"`
	Components []*s2hv1.PullRequestTriggerComponent `json:"components,omitempty"`
	NoOfRetry  int                                  `json:"noOfRetry,omitempty"`
	s2hv1.PullRequestTriggerStatus
	SamsahaiConfig
}

PullRequestTriggerReporter manages pull request trigger report

func NewPullRequestTriggerResultReporter added in v1.7.0

func NewPullRequestTriggerResultReporter(status s2hv1.PullRequestTriggerStatus, s2hConfig SamsahaiConfig,
	teamName, bundleName, prNumber, result string, noOfRetry int,
	comps []*s2hv1.PullRequestTriggerComponent) *PullRequestTriggerReporter

NewPullRequestTriggerResultReporter creates pull request trigger result reporter object

type QueueController

type QueueController interface {
	// Add adds Queue with priority list
	Add(q runtime.Object, priorityQueues []string) error

	// AddTop adds Queue to the top
	AddTop(q runtime.Object) error

	// First returns first component in Queue or current running Queue
	First(namespace string) (runtime.Object, error)

	// Remove removes Queue
	Remove(q runtime.Object) error

	// Size returns no of queues
	Size(namespace string) int

	// SetLastOrder sets queue order to the last
	SetLastOrder(obj runtime.Object) error

	// SetReverifyQueueAtFirst sets queue to reverify type
	SetReverifyQueueAtFirst(q runtime.Object) error

	// SetRetryQueue sets Queue to retry one time
	SetRetryQueue(q runtime.Object, noOfRetry int, nextAt time.Time) error

	// RemoveAllQueues removes all queues
	RemoveAllQueues(namespace string) error
}

QueueController manages updating component queue through CRD

type Reporter

type Reporter interface {
	// GetName returns type of reporter
	GetName() string

	// SendComponentUpgrade sends details of component upgrade
	SendComponentUpgrade(configCtrl ConfigController, comp *ComponentUpgradeReporter) error

	// SendPullRequestQueue sends details of pull request deployment queue
	SendPullRequestQueue(configCtrl ConfigController, comp *ComponentUpgradeReporter) error

	// SendActivePromotionStatus sends active promotion status
	SendActivePromotionStatus(configCtrl ConfigController, atpRpt *ActivePromotionReporter) error

	// SendImageMissing sends image missing
	SendImageMissing(configCtrl ConfigController, imageMissingRpt *ImageMissingReporter) error

	// SendPullRequestTriggerResult sends pull request trigger result information
	SendPullRequestTriggerResult(configCtrl ConfigController, prTriggerRpt *PullRequestTriggerReporter) error

	// SendActiveEnvironmentDeleted send active namespace deleted information
	SendActiveEnvironmentDeleted(configCtrl ConfigController, activeNsDeletedRpt *ActiveEnvironmentDeletedReporter) error
}

Reporter is the interface of reporter

type SamsahaiConfig

type SamsahaiConfig struct {
	// ConfigDirPath defines a directory path of Samsahai configuration
	ConfigDirPath string `json:"-" yaml:"-"`

	// PluginsDir defines a plugins directory path
	PluginsDir string `json:"pluginsDir" yaml:"pluginsDir"`

	// SamsahaiImage defines a Samsahai image name and tag
	SamsahaiImage string `json:"s2hImage" yaml:"s2hImage"`

	// SamsahaiExternalURL defines a Samsahai external url
	SamsahaiExternalURL string `json:"s2hExternalURL" yaml:"s2hExternalURL"`

	// GithubURL defines a Github url
	GithubURL string `json:"githubURL" yaml:"githubURL"`

	// TeamcityURL defines a Teamcity url
	TeamcityURL string `json:"teamcityURL" yaml:"teamcityURL"`

	// ClusterDomain defines a cluster domain name
	ClusterDomain string `json:"clusterDomain" yaml:"clusterDomain"`

	// ActivePromotion defines an active promotion configuration
	ActivePromotion ActivePromotionConfig `json:"activePromotion,omitempty" yaml:"activePromotion,omitempty"`

	// PullRequest represents configuration of pull request
	PullRequest PullRequestConfig `json:"pullRequest,omitempty" yaml:"pullRequest,omitempty"`

	// PostNamespaceCreation defines commands executing after creating s2h namespace
	PostNamespaceCreation *struct {
		s2hv1.CommandAndArgs
	} `json:"postNamespaceCreation,omitempty" yaml:"postNamespaceCreation,omitempty"`

	// StagingEnvs defines environment variables of staging controller
	StagingEnvs map[string]string `json:"stagingEnvs,omitempty" yaml:"stagingEnvs,omitempty"`

	SamsahaiURL        string             `json:"-" yaml:"-"`
	SamsahaiCredential SamsahaiCredential `json:"-" yaml:"-"`
}

SamsahaiConfig represents configuration of Samsahai itself

type SamsahaiController

type SamsahaiController interface {
	s2hrpc.RPC

	http.Handler

	PathPrefix() string

	// Start runs internal worker
	Start(stop <-chan struct{})

	// QueueLen returns no. of internal queue
	QueueLen() int

	// GetTeam returns Team CRD
	GetTeam(teamName string, teamComp *s2hv1.Team) error

	// GetConfigController returns samsahai configuration from config crd
	GetConfigController() ConfigController

	// GetPlugins returns samsahai plugins
	GetPlugins() map[string]Plugin

	// GetActivePromotionDeployEngine returns samsahai deploy engine
	GetActivePromotionDeployEngine(teamName, ns string) DeployEngine

	// EnsureTeamTemplateChanged  updates team if template changed
	EnsureTeamTemplateChanged(teamComp *s2hv1.Team) error

	// LoadTeamSecret loads team secret from main namespace
	LoadTeamSecret(teamComp *s2hv1.Team) error

	// CreateStagingEnvironment creates staging environment
	CreateStagingEnvironment(teamName, namespace string) error

	// CreatePreActiveEnvironment creates pre-active environment
	CreatePreActiveEnvironment(teamName, namespace string) error

	// PromoteActiveEnvironment switches environment from pre-active to active and stores current active components
	PromoteActiveEnvironment(teamComp *s2hv1.Team, namespace, promotedBy string, comps map[string]s2hv1.StableComponent) error

	// DestroyActiveEnvironment destroys active environment when active demotion is failure.
	DestroyActiveEnvironment(teamName, namespace string) error

	// DestroyPreActiveEnvironment destroys pre-active environment when active promotion is failure.
	DestroyPreActiveEnvironment(teamName, namespace string) error

	// DestroyPreviousActiveEnvironment destroys previous active environment when active promotion is success.
	DestroyPreviousActiveEnvironment(teamName, namespace string) error

	// SetPreviousActiveNamespace updates previous active namespace to team status
	SetPreviousActiveNamespace(teamComp *s2hv1.Team, namespace string) error

	// SetPreActiveNamespace updates pre-active namespace to team status
	SetPreActiveNamespace(teamComp *s2hv1.Team, namespace string) error

	// SetActiveNamespace updates active namespace to team status
	SetActiveNamespace(teamComp *s2hv1.Team, namespace string) error

	// NotifyComponentChanged adds Component to queue for checking new version
	NotifyComponentChanged(name, repository, teamName string)

	// NotifyActivePromotionReport sends active promotion status report
	NotifyActivePromotionReport(atpRpt *ActivePromotionReporter)

	// TriggerPullRequestDeployment creates PullRequestTrigger crd object
	TriggerPullRequestDeployment(teamName, component, prNumber, commitSHA string, bundleCompTag map[string]string) error

	// GetConnections returns Services in NodePort type and Ingresses that exist in the namespace
	GetConnections(namespace string) (map[string][]Connection, error)

	// GetTeams returns list of teams in Samsahai
	GetTeams() (*s2hv1.TeamList, error)

	// GetQueueHistories returns QueueHistoryList of the namespace
	GetQueueHistories(namespace string) (*s2hv1.QueueHistoryList, error)

	// GetQueueHistory returns Queue by name and namespace
	GetQueueHistory(name, namespace string) (*s2hv1.QueueHistory, error)

	// GetQueues returns QueueList of the namespace
	GetQueues(namespace string) (*s2hv1.QueueList, error)

	// GetPullRequestQueueHistories returns PullRequestQueueHistoryList of the namespace
	GetPullRequestQueueHistories(namespace string) (*s2hv1.PullRequestQueueHistoryList, error)

	// GetQueueHistory returns PullRequestQueue by name and namespace
	GetPullRequestQueueHistory(name, namespace string) (*s2hv1.PullRequestQueueHistory, error)

	// GetQueues returns PullRequestQueueList of the namespace
	GetPullRequestQueues(namespace string) (*s2hv1.PullRequestQueueList, error)

	// GetStableValues returns Stable Values of parent component in team
	GetStableValues(team *s2hv1.Team, comp *s2hv1.Component) (s2hv1.ComponentValues, error)

	// GetActivePromotions returns ActivePromotionList by labels
	GetActivePromotions() (*s2hv1.ActivePromotionList, error)

	// GetActivePromotion returns ActivePromotion by name
	GetActivePromotion(name string) (v *s2hv1.ActivePromotion, err error)

	// GetActivePromotionHistories returns ActivePromotionList by labels
	GetActivePromotionHistories(selectors map[string]string) (*s2hv1.ActivePromotionHistoryList, error)

	// GetActivePromotionHistory returns ActivePromotion by name
	GetActivePromotionHistory(name string) (*s2hv1.ActivePromotionHistory, error)

	// DeleteTeamActiveEnvironment deletes all component in namespace and namespace object
	DeleteTeamActiveEnvironment(teamName, namespace, deletedBy string) error
}

SamsahaiController

type SamsahaiCredential

type SamsahaiCredential struct {
	InternalAuthToken string
	SlackToken        string
	GithubToken       string
	MSTeams           MSTeamsCredential
	TeamcityUsername  string
	TeamcityPassword  string
}

type SortableVersion

type SortableVersion []string

func (SortableVersion) Len

func (v SortableVersion) Len() int

func (SortableVersion) Less

func (v SortableVersion) Less(i, j int) bool

func (SortableVersion) Swap

func (v SortableVersion) Swap(i, j int)

type StableComponentController

type StableComponentController interface {
}

type StagingConfig

type StagingConfig struct {
	// MaxHistoryDays defines maximum days of QueueHistory stored
	MaxHistoryDays int `json:"maxHistoryDays" yaml:"maxHistoryDays"`
}

StagingConfig represents configuration of Staging

type StagingController

type StagingController interface {
	// should implement RPC
	stagingrpc.RPC

	// should be able to serve http
	http.Handler

	// Start runs internal worker
	Start(stop <-chan struct{})

	// IsBusy returns true if controller still processing queue
	IsBusy() bool

	// LoadTestRunner loads single test runner to controller
	LoadTestRunner(runner StagingTestRunner)

	// LoadDeployEngine loads single deploy engine to controller
	LoadDeployEngine(engine DeployEngine)
}

type StagingTestRunner

type StagingTestRunner interface {
	// GetName returns type of test runner
	GetName() string

	// Trigger makes http request to run the test build
	Trigger(testConfig *s2hv1.ConfigTestRunner, currentQueue *s2hv1.Queue) error

	// GetResult makes http request to get result of test build [FAILURE/SUCCESS/UNKNOWN]
	// It returns bool results of is build success and is build finished
	GetResult(testConfig *s2hv1.ConfigTestRunner, currentQueue *s2hv1.Queue) (
		isResultSuccess bool, isBuildFinished bool, err error)
}

type StatusType

type StatusType string

StatusType represents an active promotion type

const (
	StatusSuccess  StatusType = "Success"
	StatusFailure  StatusType = "Failure"
	StatusCanceled StatusType = "Canceled"
)

Directories

Path Synopsis
pullrequest
reporter
third_party
cmd
protostruct
Package protostruct supports operations on the protocol buffer Struct message.
Package protostruct supports operations on the protocol buffer Struct message.

Jump to

Keyboard shortcuts

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