Documentation
¶
Index ¶
- Variables
- func PushArtifact(ctx context.Context, gitSvc *git.Service, ...) (string, error)
- type Actor
- type DescribeReleaseResponse
- type Environment
- type FluxReleaseMessage
- type NotifyReleaseOptions
- type PromoteEvent
- type PromoteResult
- type ReleaseArtifactIDEvent
- type ReleaseBranchEvent
- type RollbackEvent
- type RollbackResult
- type Service
- func (s *Service) DescribeArtifact(ctx context.Context, service string, n int) ([]artifact.Spec, error)
- func (s *Service) DescribeRelease(ctx context.Context, namespace, environment, service string) (DescribeReleaseResponse, error)
- func (s *Service) ExecPromote(ctx context.Context, p PromoteEvent) error
- func (s *Service) ExecReleaseArtifactID(ctx context.Context, event ReleaseArtifactIDEvent) error
- func (s *Service) ExecReleaseBranch(ctx context.Context, event ReleaseBranchEvent) error
- func (s *Service) ExecRollback(ctx context.Context, event RollbackEvent) error
- func (s *Service) NotifyCommitter(ctx context.Context, event *http.PodNotifyRequest) error
- func (s *Service) NotifyFluxEvent(ctx context.Context, event *http.FluxNotifyRequest) error
- func (s *Service) Promote(ctx context.Context, actor Actor, environment, namespace, service string) (PromoteResult, error)
- func (s *Service) ReleaseArtifactID(ctx context.Context, actor Actor, environment, service, artifactID string) (string, error)
- func (s *Service) ReleaseBranch(ctx context.Context, actor Actor, environment, service, branch string) (string, error)
- func (s *Service) Rollback(ctx context.Context, actor Actor, environment, namespace, service string) (RollbackResult, error)
- func (s *Service) Status(ctx context.Context, namespace, service string) (StatusResponse, error)
- type StatusResponse
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func PushArtifact ¶ added in v0.0.4
func PushArtifact(ctx context.Context, gitSvc *git.Service, artifactFileName, resourceRoot string) (string, error)
PushArtifact pushes an artifact into the configuration repository.
The resourceRoot specifies the path to the artifact files. All files in this path will be pushed.
Types ¶
type DescribeReleaseResponse ¶ added in v0.0.33
type Environment ¶
type Environment struct { Tag string `json:"tag,omitempty"` Committer string `json:"committer,omitempty"` Author string `json:"author,omitempty"` Message string `json:"message,omitempty"` Date time.Time `json:"date,omitempty"` BuildURL string `json:"buildUrl,omitempty"` HighVulnerabilities int64 `json:"highVulnerabilities,omitempty"` MediumVulnerabilities int64 `json:"mediumVulnerabilities,omitempty"` LowVulnerabilities int64 `json:"lowVulnerabilities,omitempty"` }
type FluxReleaseMessage ¶ added in v0.3.0
type NotifyReleaseOptions ¶ added in v0.0.12
type PromoteEvent ¶ added in v0.1.0
type PromoteEvent struct { Hash string `json:"hash,omitempty"` Service string `json:"service,omitempty"` Environment string `json:"environment,omitempty"` Namespace string `json:"namespace,omitempty"` Actor Actor `json:"actor,omitempty"` }
func (PromoteEvent) Marshal ¶ added in v0.1.0
func (p PromoteEvent) Marshal() ([]byte, error)
func (PromoteEvent) Type ¶ added in v0.1.0
func (PromoteEvent) Type() string
func (*PromoteEvent) Unmarshal ¶ added in v0.1.0
func (p *PromoteEvent) Unmarshal(data []byte) error
type PromoteResult ¶ added in v0.0.18
type ReleaseArtifactIDEvent ¶ added in v0.1.0
type ReleaseArtifactIDEvent struct { Service string `json:"service,omitempty"` Environment string `json:"environment,omitempty"` Namespace string `json:"namespace,omitempty"` ArtifactID string `json:"artifactID,omitempty"` Branch string `json:"branch,omitempty"` Actor Actor `json:"actor,omitempty"` }
func (ReleaseArtifactIDEvent) Marshal ¶ added in v0.1.0
func (p ReleaseArtifactIDEvent) Marshal() ([]byte, error)
func (ReleaseArtifactIDEvent) Type ¶ added in v0.1.0
func (ReleaseArtifactIDEvent) Type() string
func (*ReleaseArtifactIDEvent) Unmarshal ¶ added in v0.1.0
func (p *ReleaseArtifactIDEvent) Unmarshal(data []byte) error
type ReleaseBranchEvent ¶ added in v0.1.0
type ReleaseBranchEvent struct { Service string `json:"service,omitempty"` Environment string `json:"environment,omitempty"` Namespace string `json:"namespace,omitempty"` Branch string `json:"branch,omitempty"` Actor Actor `json:"actor,omitempty"` }
func (ReleaseBranchEvent) Marshal ¶ added in v0.1.0
func (p ReleaseBranchEvent) Marshal() ([]byte, error)
func (ReleaseBranchEvent) Type ¶ added in v0.1.0
func (ReleaseBranchEvent) Type() string
func (*ReleaseBranchEvent) Unmarshal ¶ added in v0.1.0
func (p *ReleaseBranchEvent) Unmarshal(data []byte) error
type RollbackEvent ¶ added in v0.1.0
type RollbackEvent struct { Service string `json:"service,omitempty"` Environment string `json:"environment,omitempty"` Namespace string `json:"namespace,omitempty"` CurrentArtifactID string `json:"currentArtifactID,omitempty"` NewHash string `json:"newHash,omitempty"` Actor Actor `json:"actor,omitempty"` }
func (RollbackEvent) Marshal ¶ added in v0.1.0
func (p RollbackEvent) Marshal() ([]byte, error)
func (RollbackEvent) Type ¶ added in v0.1.0
func (RollbackEvent) Type() string
func (*RollbackEvent) Unmarshal ¶ added in v0.1.0
func (p *RollbackEvent) Unmarshal(data []byte) error
type RollbackResult ¶ added in v0.0.10
type Service ¶ added in v0.0.15
type Service struct { ArtifactFileName string UserMappings map[string]string Slack *slack.Client Git *git.Service Tracer tracing.Tracer PublishPromote func(context.Context, PromoteEvent) error PublishRollback func(context.Context, RollbackEvent) error PublishReleaseArtifactID func(context.Context, ReleaseArtifactIDEvent) error PublishReleaseBranch func(context.Context, ReleaseBranchEvent) error MaxRetries int // NotifyReleaseHook is triggered in a Go routine when a release is completed. // The context.Context is cancelled if the originating flow call is cancelled. NotifyReleaseHook func(ctx context.Context, options NotifyReleaseOptions) }
func (*Service) DescribeArtifact ¶ added in v0.0.33
func (s *Service) DescribeArtifact(ctx context.Context, service string, n int) ([]artifact.Spec, error)
DescribeArtifact returns n artifacts for a service.
func (*Service) DescribeRelease ¶ added in v0.0.33
func (s *Service) DescribeRelease(ctx context.Context, namespace, environment, service string) (DescribeReleaseResponse, error)
DescribeRelease returns information about a specific release in an environment.
func (*Service) ExecPromote ¶ added in v0.1.0
func (s *Service) ExecPromote(ctx context.Context, p PromoteEvent) error
ExecPromote promotes a specific service to environment env.
By convention, promotion means:
Move released version of the previous environment into this environment
Promotion follows this convention
master -> dev -> staging -> prod
Flow ¶
Checkout the current kubernetes configuration status and find the artifact.json spec for the service and previous environment. Use the artifact ID as a key for locating the artifacts.
Find the commit with the artifact ID and checkout the config repository at this point.
Copy artifacts from the current release into the new environment and commit the changes
func (*Service) ExecReleaseArtifactID ¶ added in v0.1.0
func (s *Service) ExecReleaseArtifactID(ctx context.Context, event ReleaseArtifactIDEvent) error
func (*Service) ExecReleaseBranch ¶ added in v0.1.0
func (s *Service) ExecReleaseBranch(ctx context.Context, event ReleaseBranchEvent) error
func (*Service) ExecRollback ¶ added in v0.1.0
func (s *Service) ExecRollback(ctx context.Context, event RollbackEvent) error
func (*Service) NotifyCommitter ¶ added in v0.0.15
func (*Service) NotifyFluxEvent ¶ added in v0.3.0
func (*Service) Promote ¶ added in v0.0.15
func (s *Service) Promote(ctx context.Context, actor Actor, environment, namespace, service string) (PromoteResult, error)
Promote promotes a specific service to environment env. The flow is async in that this method validates the inputs and publishes an event that is handled later on by ExecPromote.
func (*Service) ReleaseArtifactID ¶ added in v0.0.15
func (s *Service) ReleaseArtifactID(ctx context.Context, actor Actor, environment, service, artifactID string) (string, error)
ReleaseArtifactID releases a specific artifact to environment env.
Flow ¶
Locate the commit of the artifact ID and checkout the config repository at this point.
Copy resources from the artifact commit into the environment and commit the changes
func (*Service) ReleaseBranch ¶ added in v0.0.15
func (s *Service) ReleaseBranch(ctx context.Context, actor Actor, environment, service, branch string) (string, error)
ReleaseBranch releases the latest artifact from a branch of a specific service to environment env.
Flow ¶
Checkout the current kubernetes configuration status and find the artifact spec for the service and branch.
Copy artifacts from the artifacts into the environment and commit the changes.
type StatusResponse ¶
type StatusResponse struct { DefaultNamespaces bool `json:"defaultNamespaces,omitempty"` Dev Environment `json:"dev,omitempty"` Staging Environment `json:"staging,omitempty"` Prod Environment `json:"prod,omitempty"` }