models

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: MIT Imports: 20 Imported by: 17

Documentation

Index

Constants

View Source
const (
	DefaultChartTagValue  = "image.tag"
	DefaultNamespaceValue = "namespace"
	DefaultEnvNameValue   = "env_name"
	DefaultDockerfilePath = "Dockerfile"
)

Variables

View Source
var DefaultCommitStatusTemplates = map[string]CommitStatusTemplate{
	"success": CommitStatusTemplate{
		Description: "The Acyl environment {{ .EnvName }} was created successfully.",
		TargetURL:   "https://media.giphy.com/media/SRO0ZwmImic0/giphy.gif",
	},
	"pending": CommitStatusTemplate{
		Description: "The Acyl environment {{ .EnvName }} is being created.",
		TargetURL:   "https://media.giphy.com/media/oiymhxu13VYEo/giphy.gif",
	},
	"failure": CommitStatusTemplate{
		Description: "The Acyl environment {{ .EnvName }} failed.",
		TargetURL:   "https://media.giphy.com/media/pyFsc5uv5WPXN9Ocki/giphy.gif",
	},
}

DefaultCommitStatusTemplates are the templates that are used if the user does not specify a template in the acyl.yml configuration file.

View Source
var DefaultNotificationTemplates = map[string]NotificationTemplate{
	"create": NotificationTemplate{
		Title: "🛠 Creating Environment",
		Sections: []NotificationTemplateSection{
			NotificationTemplateSection{
				Title: "{{ .EnvName }}",
				Text:  "{{ .Repo }}\nPR #{{ .PullRequest }}: {{ .SourceBranch }} ➡️ {{ .BaseBranch }}",
				Style: "good",
			},
		},
	},
	"update": NotificationTemplate{
		Title: "🚦 Updating Environment",
		Sections: []NotificationTemplateSection{
			NotificationTemplateSection{
				Title: "{{ .EnvName }}",
				Text:  "{{ .Repo }}\nPR #{{ .PullRequest }}: {{ .SourceBranch }} ➡️ {{ .BaseBranch }}\nUpdating to commit:\nhttps://github.com/{{ .Repo }}/commit/{{ .SourceSHA }}\n\"{{ .CommitMessage }}\" - {{ .User }}",
				Style: "warning",
			},
		},
	},
	"destroy": NotificationTemplate{
		Title: `💣 Destroying Environment{{ if eq .Event "EnvironmentLimitExceeded" }} (Environment Limit Exceeded){{ end }}`,
		Sections: []NotificationTemplateSection{
			NotificationTemplateSection{
				Title: "{{ .EnvName }}",
				Text:  "{{ .Repo }}\nPR #{{ .PullRequest }}: {{ .SourceBranch }} ➡️ {{ .BaseBranch }}",
				Style: "warning",
			},
		},
	},
	"success": NotificationTemplate{
		Title: "🏁 Environment Ready",
		Sections: []NotificationTemplateSection{
			NotificationTemplateSection{
				Title: "{{ .EnvName }}",
				Text:  "{{ .Repo }}\nPR #{{ .PullRequest }}: {{ .SourceBranch }} ➡️ {{ .BaseBranch }}",
				Style: "good",
			},
			NotificationTemplateSection{
				Text:  "https://github.com/{{ .Repo }}/pull/{{ .PullRequest }}\nK8s Namespace: {{ .K8sNamespace }}",
				Style: "good",
			},
		},
	},
	"failure": NotificationTemplate{
		Title: "❌☠️ Environment Error",
		Sections: []NotificationTemplateSection{
			NotificationTemplateSection{
				Title: "{{ .EnvName }}",
				Text:  "{{ .Repo }}\nPR #{{ .PullRequest }}: {{ .SourceBranch }} ➡️ {{ .BaseBranch }}",
				Style: "danger",
			},
			NotificationTemplateSection{
				Title: "{{ .EnvName }}",
				Text:  "{{ .ErrorMessage }}",
				Style: "danger",
			},
		},
	},
}

DefaultNotificationTemplates are the default notification templates if none are supplied

Functions

func GetName

func GetName(repo string) string

GetName returns a name derived from a repository name. This is used to generate a name for the triggering repository.

Types

type APIKey added in v0.8.0

type APIKey struct {
	ID              uuid.UUID       `json:"id"`
	Created         time.Time       `json:"created"`
	LastUsed        pq.NullTime     `json:"last_used"`
	PermissionLevel PermissionLevel `json:"permission_level"`
	Description     string          `json:"description"`
	GitHubUser      string          `json:"github_user"`
	Token           uuid.UUID       `json:"token"`
}

func (APIKey) Columns added in v0.8.0

func (apik APIKey) Columns() string

func (APIKey) InsertColumns added in v0.8.0

func (apik APIKey) InsertColumns() string

func (APIKey) InsertParams added in v0.8.0

func (apik APIKey) InsertParams() string

func (*APIKey) InsertValues added in v0.8.0

func (apik *APIKey) InsertValues() []interface{}

func (*APIKey) ScanValues added in v0.8.0

func (apik *APIKey) ScanValues() []interface{}

type CommitStatus added in v0.7.0

type CommitStatus int

CommitStatus enumerates the statuses of commits that Nitro supports.

const (
	// CommitStatusSuccess occurs when a Nitro environment has been created.
	CommitStatusSuccess CommitStatus = iota
	// CommitStatusPending occurs when Nitro is first creating an environment,
	// or updating an existing environment
	CommitStatusPending
	// CommitStatusFailure occurs when an unrecoverable error has occured during
	// the creation or update of an environment
	CommitStatusFailure
)

Valid commit statuses from Nitro's perspective

func (CommitStatus) Key added in v0.7.0

func (ncs CommitStatus) Key() string

type CommitStatusTemplate added in v0.7.0

type CommitStatusTemplate struct {
	Description string `yaml:"description" json:"description"`
	TargetURL   string `yaml:"target_url" json:"target_url"`
}

func (CommitStatusTemplate) Render added in v0.7.0

Render renders the commit status template using the supplied data.

type CommitStatuses added in v0.7.0

type CommitStatuses struct {
	Templates map[string]CommitStatusTemplate `yaml:"templates" json:"templates"`
}

CommitStatuses models the configuration that Nitro supports for setting commit statuses. Users can specify templates for each valid commit status.

type ConfigProcessingDuration added in v0.7.5

type ConfigProcessingDuration struct {
	time.Duration
}

func (ConfigProcessingDuration) MarshalJSON added in v0.7.5

func (d ConfigProcessingDuration) MarshalJSON() ([]byte, error)

func (*ConfigProcessingDuration) UnmarshalJSON added in v0.7.5

func (d *ConfigProcessingDuration) UnmarshalJSON(b []byte) error

type DependencyDeclaration

type DependencyDeclaration struct {
	Direct      []RepoConfigDependency `yaml:"direct" json:"direct"`
	Environment []RepoConfigDependency `yaml:"environment" json:"environment"`
}

DependencyDeclaration models the dependencies for an environment

func (DependencyDeclaration) All

All returns all dependencies (direct + environment)

func (DependencyDeclaration) Count

func (dd DependencyDeclaration) Count() int

Count returns the total count of all dependencies

func (DependencyDeclaration) RefMapCount

func (dd DependencyDeclaration) RefMapCount() int

RefMapCount returns the count of dependencies that can participate in branch matching

func (DependencyDeclaration) ValidateNames

func (dd DependencyDeclaration) ValidateNames() (bool, error)

ValidateNames indicates whether all dependencies have unique names and valid requirement references.

type EnvSearchParameters

type EnvSearchParameters struct {
	Repo         string
	Repos        []string // include all these repos (mutually exclusive with Repo)
	Pr           uint
	SourceSHA    string
	SourceBranch string
	User         string
	Status       EnvironmentStatus
	Statuses     []EnvironmentStatus // include all these statuses (mutually exclusive with Status)
	CreatedSince time.Duration       // Duration prior to time.Now().UTC()
	TrackingRef  string
}

EnvSearchParameters models the possible parameters for an environment search

type EnvironmentStatus

type EnvironmentStatus int

EnvironmentStatus enumerates the states an environment can be in

const (
	UnknownStatus EnvironmentStatus = iota // UnknownStatus means unknown
	Spawned                                // Spawned means created but not yet registered (we don't know InstanceID or IPs yet)
	Success                                // Success means provisioning was successful and applications are working
	Failure                                // Failure means there was an error during provisioning or application startup
	Destroyed                              // Destroyed means the environment was destroyed explicitly or as part of a PR synchronize or close
	Updating                               // Updating means an existing env is being updated (replaced behind the scenes)
	Cancelled                              // Cancelled means an environment has been cancelled via a context.
)

func EnvironmentStatusFromString

func EnvironmentStatusFromString(es string) (EnvironmentStatus, error)

EnvironmentStatusFromString returns the EnvironmentStatus constant for a string or error if unknown

func (EnvironmentStatus) String

func (i EnvironmentStatus) String() string

type EventLog

type EventLog struct {
	ID               uuid.UUID          `json:"id"`
	Created          time.Time          `json:"created"`
	Updated          pq.NullTime        `json:"updated"`
	EnvName          string             `json:"env_name"`
	Repo             string             `json:"repo"`
	PullRequest      uint               `json:"pull_request"`
	WebhookPayload   []byte             `json:"webhook_payload"`
	GitHubDeliveryID uuid.UUID          `json:"github_delivery_id"`
	Log              []string           `json:"log"`
	LogKey           uuid.UUID          `json:"log_key"` // additional secret needed for logs via web UI (no API key)
	Status           EventStatusSummary `json:"status"`
}

func (EventLog) Columns

func (el EventLog) Columns() string

func (EventLog) ColumnsWithoutID added in v0.8.0

func (el EventLog) ColumnsWithoutID() string

func (EventLog) InsertColumns

func (el EventLog) InsertColumns() string

func (EventLog) InsertParams

func (el EventLog) InsertParams() string

func (*EventLog) InsertValues

func (el *EventLog) InsertValues() []interface{}

func (*EventLog) ScanValues

func (el *EventLog) ScanValues() []interface{}

type EventStatus added in v0.7.5

type EventStatus int
const (
	UnknownEventStatus EventStatus = iota
	PendingStatus
	DoneStatus
	FailedStatus
	CancelledStatus
)

func (EventStatus) String added in v0.7.5

func (i EventStatus) String() string

type EventStatusSummary added in v0.7.5

type EventStatusSummary struct {
	Config EventStatusSummaryConfig       `json:"config"`
	Tree   map[string]EventStatusTreeNode `json:"tree"`
}

func (*EventStatusSummary) Scan added in v0.7.5

func (es *EventStatusSummary) Scan(value interface{}) error

Scan implements database/sql Scanner interface.

func (EventStatusSummary) Value added in v0.7.5

func (es EventStatusSummary) Value() (driver.Value, error)

Value implements database/sql/driver Valuer interface.

type EventStatusSummaryConfig added in v0.7.5

type EventStatusSummaryConfig struct {
	Type            EventStatusType          `json:"type"`
	Status          EventStatus              `json:"status"`
	RenderedStatus  RenderedEventStatus      `json:"rendered_status"`
	FailedResources metahelm.ChartError      `json:"failed_resources"`
	EnvName         string                   `json:"env_name"`
	K8sNamespace    string                   `json:"k8s_ns"`
	TriggeringRepo  string                   `json:"triggering_repo"`
	PullRequest     uint                     `json:"pull_request"`
	GitHubUser      string                   `json:"github_user"`
	Branch          string                   `json:"branch"`
	Revision        string                   `json:"revision"`
	ProcessingTime  ConfigProcessingDuration `json:"processing_time"`
	Started         time.Time                `json:"started"`
	Completed       time.Time                `json:"completed"`
	RefMap          map[string]string        `json:"ref_map"`
}

type EventStatusTreeNode added in v0.7.5

type EventStatusTreeNode struct {
	Parent string                   `json:"parent"`
	Image  EventStatusTreeNodeImage `json:"image"`
	Chart  EventStatusTreeNodeChart `json:"chart"`
}

type EventStatusTreeNodeChart added in v0.7.5

type EventStatusTreeNodeChart struct {
	Status    NodeChartStatus `json:"status"`
	Started   time.Time       `json:"started"`
	Completed time.Time       `json:"completed"`
}

type EventStatusTreeNodeImage added in v0.7.5

type EventStatusTreeNodeImage struct {
	Name      string    `json:"name"`
	Error     bool      `json:"error"`
	Completed time.Time `json:"completed"`
	Started   time.Time `json:"started"`
}

type EventStatusType added in v0.7.5

type EventStatusType int
const (
	UnknownEventStatusType EventStatusType = iota
	CreateEvent
	UpdateEvent
	DestroyEvent
)

func (EventStatusType) String added in v0.7.5

func (i EventStatusType) String() string

type GitHubNotifications

type GitHubNotifications struct {
	PRComments     bool           `yaml:"pr_comments" json:"pr_comments"`
	CommitStatuses CommitStatuses `yaml:"commit_statuses" json:"commit_statuses"`
}

GitHubNotifications models GitHub notification options

type HelmRelease

type HelmRelease struct {
	ID           uint      `json:"id"`
	Created      time.Time `json:"created"`
	EnvName      string    `json:"env_name"`
	K8sNamespace string    `json:"k8s_namespace"`
	Release      string    `json:"release"`
	RevisionSHA  string    `json:"revision_sha"`
	Name         string    `json:"name"`
}

HelmRelease models a single Helm release within K8s associated with an environment

func (HelmRelease) Columns

func (hr HelmRelease) Columns() string

func (HelmRelease) InsertColumns

func (hr HelmRelease) InsertColumns() string

func (HelmRelease) InsertParams

func (hr HelmRelease) InsertParams() string

func (*HelmRelease) InsertValues

func (hr *HelmRelease) InsertValues() []interface{}

func (*HelmRelease) ScanValues

func (hr *HelmRelease) ScanValues() []interface{}

type KubernetesEnvironment

type KubernetesEnvironment struct {
	Created         time.Time   `yaml:"created" json:"created"`
	Updated         pq.NullTime `yaml:"updated" json:"updated"`
	Namespace       string      `yaml:"namespace" json:"namespace"`
	EnvName         string      `yaml:"env_name" json:"env_name" `
	RepoConfigYAML  []byte      `yaml:"config" json:"config"`
	ConfigSignature []byte      `yaml:"config_signature" json:"config_signature"`
	RefMapJSON      string      `yaml:"ref_map_json" json:"ref_map_json"`
	Privileged      bool        `yaml:"privileged" json:"privileged"`
}

KubernetesEnvironment models a single environment in k8s

func (KubernetesEnvironment) Columns

func (ke KubernetesEnvironment) Columns() string

func (KubernetesEnvironment) InsertColumns

func (ke KubernetesEnvironment) InsertColumns() string

func (KubernetesEnvironment) InsertParams

func (ke KubernetesEnvironment) InsertParams() string

func (*KubernetesEnvironment) InsertValues

func (ke *KubernetesEnvironment) InsertValues() []interface{}

func (*KubernetesEnvironment) ScanValues

func (ke *KubernetesEnvironment) ScanValues() []interface{}

func (KubernetesEnvironment) UpdateColumns

func (ke KubernetesEnvironment) UpdateColumns() string

func (KubernetesEnvironment) UpdateParams

func (ke KubernetesEnvironment) UpdateParams() string

func (*KubernetesEnvironment) UpdateValues

func (ke *KubernetesEnvironment) UpdateValues() []interface{}

type NodeChartStatus added in v0.7.5

type NodeChartStatus int
const (
	UnknownChartStatus NodeChartStatus = iota
	WaitingChartStatus
	InstallingChartStatus
	UpgradingChartStatus
	DoneChartStatus
	FailedChartStatus
)

func (NodeChartStatus) String added in v0.7.5

func (i NodeChartStatus) String() string

type NotificationData

type NotificationData struct {
	EnvName, Repo, SourceBranch, SourceSHA, BaseBranch, BaseSHA, CommitMessage, ErrorMessage, User, K8sNamespace, Event string
	PullRequest                                                                                                         uint
}

NotificationData models the data available to notification templates (all events)

type NotificationTemplate

type NotificationTemplate struct {
	Title    string                        `yaml:"title" json:"title"`
	Sections []NotificationTemplateSection `yaml:"sections" json:"sections"`
}

NotificationTemplate models a notification template for an event

func (NotificationTemplate) Render

type NotificationTemplateSection

type NotificationTemplateSection struct {
	Title string `yaml:"title" json:"title"`
	Text  string `yaml:"text" json:"text"`
	Style string `yaml:"style" json:"style"`
}

NotificationTemplateSection models a section of a notification template

type Notifications

type Notifications struct {
	Slack     SlackNotifications              `yaml:"slack" json:"slack"`
	GitHub    GitHubNotifications             `yaml:"github" json:"github"`
	Templates map[string]NotificationTemplate `yaml:"templates" json:"templates"`
}

Notifications models configuration for notifications in acyl.yml v2

func (*Notifications) FillMissingTemplates

func (n *Notifications) FillMissingTemplates()

FillMissingTemplates fills in any missing templates with defaults

type PermissionLevel added in v0.8.0

type PermissionLevel int
const (
	UnknownPermission PermissionLevel = iota
	ReadOnlyPermission
	WritePermission
	AdminPermission
)

func (PermissionLevel) String added in v0.8.0

func (i PermissionLevel) String() string

type QADestroyReason

type QADestroyReason int

QADestroyReason enumerates the reasons for destroying an environment

const (
	ReapAgeSpawned               QADestroyReason = iota // Environment exceeds max age
	ReapAgeFailure                                      // Environment has been in state Failure for too long
	ReapPrClosed                                        // PR associated with the environment is now closed
	ReapEnvironmentLimitExceeded                        // Environment destroyed by Reaper to bring environment count into compliance with the global limit
	CreateFoundStale                                    // The environment is a stale environment associated with a PR that we are executing a create for
	DestroyApiRequest                                   // Explicit API destroy request
	EnvironmentLimitExceeded                            // Environment destroyed by a new environment create request to bring environment count into compliance with the global limit
)

func (QADestroyReason) String

func (i QADestroyReason) String() string

type QAEnvironment

type QAEnvironment struct {
	ID                       int64                `json:"id"`
	Name                     string               `json:"name"`
	Created                  time.Time            `json:"created"`
	CreatedDate              string               `json:"created_date"`
	RawEvents                []string             `json:"-"`
	Events                   []QAEnvironmentEvent `json:"events"`
	Hostname                 string               `json:"hostname"`
	QAType                   string               `json:"qa_type"`
	User                     string               `json:"user"`
	Repo                     string               `json:"repo"`
	PullRequest              uint                 `json:"pull_request"`
	SourceSHA                string               `json:"source_sha"`
	BaseSHA                  string               `json:"base_sha"`
	SourceBranch             string               `json:"source_branch"`
	BaseBranch               string               `json:"base_branch"`
	SourceRef                string               `json:"source_ref"`
	RawStatus                string               `json:"status"`
	Status                   EnvironmentStatus    `json:"status_int"`
	RefMap                   RefMap               `json:"ref_map"`
	CommitSHAMap             RefMap               `json:"commit_sha_map"`
	AminoServiceToPort       map[string]int64     `json:"amino_service_to_port"`
	AminoServiceToPortRaw    map[string]string    `json:"-"`
	AminoKubernetesNamespace string               `json:"amino_kubernetes_namespace"`
	AminoEnvironmentID       int                  `json:"amino_environment_id"`
	EventIDs                 []uuid.UUID          `json:"event_ids"`
	// contains filtered or unexported fields
}

QAEnvironment describes an individual QA environment Fields prefixed with "Raw" are directly out of the database without processing

func (*QAEnvironment) AfterInsert

func (qae *QAEnvironment) AfterInsert(db orm.DB) error

func (*QAEnvironment) AfterSelect

func (qae *QAEnvironment) AfterSelect(db orm.DB) error

func (*QAEnvironment) AminoServiceToPortHStore

func (qae *QAEnvironment) AminoServiceToPortHStore() *hstore.Hstore

AminoServiceToPortHStore returns the HStore struct suitable for scanning during queries

func (*QAEnvironment) BeforeInsert

func (qae *QAEnvironment) BeforeInsert(db orm.DB) error

func (QAEnvironment) Columns

func (qae QAEnvironment) Columns() string

Columns returns a comma-separated string of column names suitable for a SELECT

func (*QAEnvironment) CommitSHAMapHStore

func (qae *QAEnvironment) CommitSHAMapHStore() *hstore.Hstore

CommitSHAMapHStore returns the HStore struct suitable for scanning during queries

func (QAEnvironment) InsertColumns added in v0.9.1

func (qae QAEnvironment) InsertColumns() string

func (QAEnvironment) InsertParams

func (qae QAEnvironment) InsertParams() string

InsertParams returns the query placeholder params for a full model insert

func (*QAEnvironment) InsertValues added in v0.9.1

func (qae *QAEnvironment) InsertValues() []interface{}

func (*QAEnvironment) ProcessAminoServiceToPort

func (qae *QAEnvironment) ProcessAminoServiceToPort() error

ProcessAminoServiceToPort parses out a map[string]int64 port mapping from AminoServiceToPortRaw since hstore doesn't integers.

func (*QAEnvironment) ProcessEvents

func (qae *QAEnvironment) ProcessEvents() error

ProcessEvents unmarshals a list of JSON-encoded event strings into

func (*QAEnvironment) ProcessHStores

func (qae *QAEnvironment) ProcessHStores() error

ProcessHStores processes raw HStores into their respective struct fields

func (*QAEnvironment) ProcessRaw

func (qae *QAEnvironment) ProcessRaw() error

ProcessRaw converts raw values from the database into associated data fields

func (*QAEnvironment) ProcessStatus

func (qae *QAEnvironment) ProcessStatus()

ProcessStatus sets Status from RawStatus

func (*QAEnvironment) RefMapHStore

func (qae *QAEnvironment) RefMapHStore() *hstore.Hstore

RefMapHStore returns the HStore struct suitable for scanning during queries

func (QAEnvironment) RepoRevisionDataFromQA

func (qa QAEnvironment) RepoRevisionDataFromQA() *RepoRevisionData

RepoRevisionDataFromQA returns a RepoRevisionData from a QAEnvironment

func (*QAEnvironment) ScanValues

func (qae *QAEnvironment) ScanValues() []interface{}

ScanValues returns a slice of values suitable for a query Scan()

func (*QAEnvironment) SetCreatedDate

func (qa *QAEnvironment) SetCreatedDate()

SetCreatedDate sets the CreatedDate field from Created for the secondary table

func (*QAEnvironment) SetRaw

func (qae *QAEnvironment) SetRaw() error

SetRaw processes/serializes fields into their respective Raw* fields in preparation for insertion into the database

type QAEnvironmentEvent

type QAEnvironmentEvent struct {
	Timestamp time.Time `json:"created"`
	Message   string    `json:"message"`
}

QAEnvironmentEvent is an event registered by the QA environment during provisioning

type QAEnvironments

type QAEnvironments []QAEnvironment

QAEnvironments is a slice of QAEnvironment to allow sorting by Created timestamp

func (QAEnvironments) Len

func (slice QAEnvironments) Len() int

func (QAEnvironments) Less

func (slice QAEnvironments) Less(i, j int) bool

func (QAEnvironments) Swap

func (slice QAEnvironments) Swap(i, j int)

type QAType

type QAType struct {
	ID              int               `json:"id"`
	Version         uint              `json:"version" yaml:"version"`
	CreatedAt       time.Time         `json:"created_at"`
	UpdatedAt       time.Time         `json:"updated_at"`
	Name            string            `json:"name" yaml:"name"`
	Template        string            `json:"template" yaml:"template"`                 // dollarshaveclub/resource-manifests
	TargetRepo      string            `json:"target_repo" yaml:"target_repo"`           // GitHub repo to watch for PR events
	OtherRepos      []string          `json:"other_repos" yaml:"other_repos"`           // Any other repos used by the template that require images built or branch coordination
	TargetBranch    string            `json:"target_branch" yaml:"target_branch"`       // Branch to watch on target repo
	TargetBranches  []string          `json:"target_branches" yaml:"target_branches"`   // Branch list to watch on target repo
	BranchOverrides map[string]string `json:"branch_overrides" yaml:"branch_overrides"` // Map of repo name to override branch (Instead of using base branch of PR, fallback to this branch)
	EnvType         string            `json:"env_type" yaml:"env_type"`
	TrackRefs       []string          `json:"track_refs" yaml:"track_refs"` // Create an environment for each of these refs (branch/tag) and keep it continuously updated as commits are pushed
}

QAType defines a QA environment type and how it needs to be triggered This is the type for the legacy (version < 2) acyl.yml

func (*QAType) FromYAML

func (qat *QAType) FromYAML(data []byte) error

FromYAML unmarshals the provided YAML data into the QAType struct

type RefMap

type RefMap map[string]string

RefMap is a mapping of Github repository to a ref.

type RenderedCommitStatus added in v0.7.0

type RenderedCommitStatus struct {
	Description, TargetURL string
}

type RenderedEventStatus added in v0.7.5

type RenderedEventStatus struct {
	Description   string `json:"description"`
	LinkTargetURL string `json:"link_target_url"`
}

type RenderedNotification

type RenderedNotification struct {
	Title    string
	Sections []RenderedNotificationSection
}

RenderedNotification models a rendered notification template for an event

type RenderedNotificationSection

type RenderedNotificationSection struct {
	Title, Text, Style string
}

RenderedNotificationSection models a rendered section of a notification

type RepoConfig

type RepoConfig struct {
	Version        uint                  `yaml:"version" json:"version"`
	TargetBranches []string              `yaml:"target_branches" json:"target_branches"`
	TrackBranches  []string              `json:"track_branches" yaml:"track_branches"`
	Application    RepoConfigAppMetadata `yaml:"application" json:"application"`
	Dependencies   DependencyDeclaration `yaml:"dependencies" json:"dependencies"`
	Notifications  Notifications         `yaml:"notifications" json:"notifications"`
}

RepoConfig models the config retrieved from the repository via acyl.yml (version >= 2)

func (RepoConfig) CommitSHAMap

func (rc RepoConfig) CommitSHAMap() (RefMap, error)

CommitSHAMap generates a CommitSHAMap for a particular environment

func (RepoConfig) ConfigSignature

func (rc RepoConfig) ConfigSignature() [32]byte

ConfigSignature returns a hash of the config dependency configuration, for determining whether to upgrade an environment or tear down and rebuild

func (RepoConfig) NameToRefMap

func (rc RepoConfig) NameToRefMap() map[string]string

NameToRefMap returns a map of name (triggering repo and dependencies) to ref

func (RepoConfig) RefMap

func (rc RepoConfig) RefMap() (RefMap, error)

RefMap generates RefMap for a particular environment

type RepoConfigAppMetadata

type RepoConfigAppMetadata struct {
	Repo              string   `yaml:"-" json:"repo"`   // set by nitro
	Ref               string   `yaml:"-" json:"ref"`    // set by nitro
	Branch            string   `yaml:"-" json:"branch"` // set by nitro
	ChartPath         string   `yaml:"chart_path" json:"chart_path"`
	ChartRepoPath     string   `yaml:"chart_repo_path" json:"chart_repo_path"`
	ChartVarsPath     string   `yaml:"chart_vars_path" json:"chart_vars_path"`
	ChartVarsRepoPath string   `yaml:"chart_vars_repo_path" json:"chart_vars_repo_path"`
	Image             string   `yaml:"image" json:"image"`
	DockerfilePath    string   `yaml:"dockerfile_path" json:"dockerfile_path"`
	ChartTagValue     string   `yaml:"image_tag_value" json:"image_tag_value"`
	NamespaceValue    string   `yaml:"namespace_value" json:"namespace_value"`
	EnvNameValue      string   `yaml:"env_name_value" json:"env_name_value"`
	ValueOverrides    []string `yaml:"value_overrides" json:"value_overrides"`
}

RepoConfigAppMetadata models app-specific metadata for the primary application

func (*RepoConfigAppMetadata) SetValueDefaults

func (ram *RepoConfigAppMetadata) SetValueDefaults()

SetValueDefaults sets default chart value names if empty

type RepoConfigDependency

type RepoConfigDependency struct {
	Name               string                `yaml:"name" json:"name"`                       // Unique name for the dependency
	Repo               string                `yaml:"repo" json:"repo"`                       // Repo indicates a GitHub repository which contains a top-level acyl.yml
	ChartPath          string                `yaml:"chart_path" json:"chart_path"`           // Path to the chart within the triggering repository
	ChartRepoPath      string                `yaml:"chart_repo_path" json:"chart_repo_path"` // GitHub repo and path to chart (no acyl.yml)
	ChartVarsPath      string                `yaml:"chart_vars_path" json:"chart_vars_path"`
	ChartVarsRepoPath  string                `yaml:"chart_vars_repo_path" json:"chart_vars_repo_path"`
	DisableBranchMatch bool                  `yaml:"disable_branch_match" json:"disable_branch_match"`
	DefaultBranch      string                `yaml:"default_branch" json:"default_branch"`
	Requires           []string              `yaml:"requires" json:"requires"`
	ValueOverrides     []string              `yaml:"value_overrides" json:"value_overrides"`
	AppMetadata        RepoConfigAppMetadata `yaml:"-" json:"app_metadata"` // set by nitro
	Parent             string                `yaml:"-" json:"-"`            // Name of the parent dependency if this is a transitive dep, set by nitro
}

RepoConfigDependency models a dependency repo for an environment

func (RepoConfigDependency) BranchMatchable

func (rcd RepoConfigDependency) BranchMatchable() bool

BranchMatchable indicates whether the depencency can participate in branch matching and can be found in RefMap

type RepoRevisionData

type RepoRevisionData struct {
	User         string `json:"user"`
	Repo         string `json:"repo"`
	PullRequest  uint   `json:"pull_request"`
	SourceSHA    string `json:"source_sha"`
	BaseSHA      string `json:"base_sha"`
	SourceBranch string `json:"source_branch"`
	BaseBranch   string `json:"base_branch"`
	SourceRef    string `json:"source_ref"` // if environment is not based on a PR
	IsFork       bool   `json:"is_fork"`    // set if PR head is from a different repo (fork) from base
}

RepoRevisionData models the GitHub repo data

type SlackNotifications

type SlackNotifications struct {
	DisableGithubUserDM bool      `yaml:"disable_github_user_dm" json:"disable_github_user_dm"`
	Channels            *[]string `yaml:"channels" json:"channels"`
	Users               []string  `yaml:"users" json:"users"`
}

SlackNotifications models configuration for slack notifications in acyl.yml v2

type UISession added in v0.7.6

type UISession struct {
	ID                 int         `json:"id"`
	Created            time.Time   `json:"created"`
	Updated            pq.NullTime `json:"updated"`
	Expires            time.Time   `json:"expires"`
	State              []byte      `json:"state"`
	GitHubUser         string      `json:"github_user"`
	TargetRoute        string      `json:"target_route"`
	ClientIP           string      `json:"client_ip"`
	UserAgent          string      `json:"user_agent"`
	Authenticated      bool        `json:"authenticated"`
	EncryptedUserToken []byte      `json:"-"` // GitHub API user-scoped token encrypted w/ NaCl secretbox
}

func (UISession) Columns added in v0.7.6

func (uis UISession) Columns() string

func (*UISession) EncryptandSetUserToken added in v0.7.6

func (uis *UISession) EncryptandSetUserToken(tkn []byte, key [32]byte) error

EncryptUserToken takes a user token, encrypts it and sets EncryptedUserToken accordingly

func (*UISession) GetUserToken added in v0.7.6

func (uis *UISession) GetUserToken(key [32]byte) (string, error)

GetUserToken returns the decrypted user token using key or error

func (UISession) HasEncryptedToken added in v0.7.6

func (uis UISession) HasEncryptedToken() bool

func (UISession) InsertColumns added in v0.7.6

func (uis UISession) InsertColumns() string

func (UISession) InsertParams added in v0.7.6

func (uis UISession) InsertParams() string

func (*UISession) InsertValues added in v0.7.6

func (uis *UISession) InsertValues() []interface{}

func (UISession) IsExpired added in v0.7.6

func (uis UISession) IsExpired() bool

func (UISession) IsValid added in v0.7.6

func (uis UISession) IsValid() bool

func (*UISession) ScanValues added in v0.7.6

func (uis *UISession) ScanValues() []interface{}

Jump to

Keyboard shortcuts

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