Documentation ¶
Index ¶
- Constants
- func GetStagesFromAnnotations(annotations map[string]string) (map[string]string, error)
- type CommitResolver
- type Image
- type Stage
- type StageFile
- type StageManager
- func (sm *StageManager) AddImage(ctx context.Context, image, gitRepo string) error
- func (sm *StageManager) Apply(ctx context.Context) error
- func (sm *StageManager) PromoteStage(ctx context.Context, image, stageToMatch, stageToUpdate string) error
- func (sm *StageManager) ReadStageFile(ctx context.Context) (*StageFile, error)
- func (sm *StageManager) RemoveImage(ctx context.Context, image string) error
- func (sm *StageManager) RemoveStage(ctx context.Context, image, stage string) error
- func (sm *StageManager) SetStage(ctx context.Context, image, stage, reference string) error
Constants ¶
const ( // StageFilePath is the path to the json file. StageFilePath = "pipeline/stages.json" // GitTagPrefix is a prefix applied to all Docker image tags which // correspond to Git commit hashes. GitTagPrefix = "git-" // PodAnnotationKey is the key of the annotation which is attached to // PodTemplateSpec to map container names to stages. PodAnnotationKey = "skia.org/stage" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CommitResolver ¶
CommitResolver is a function used to resolve a short Git commit hash or ref to a full commit hash.
func GitilesCommitResolver ¶
func GitilesCommitResolver(httpClient *http.Client) CommitResolver
GitilesCommitResolver returns a CommitResolver which uses gitiles and the given http.Client to resolve commits.
type Image ¶
type Image struct { // GitRepo is the URL of the Git repository from which the image is built. GitRepo string `json:"git_repo,omitempty"` // Stages are the release stages tracked by users of this image. Stages map[string]*Stage `json:"stages,omitempty"` }
Image represents an image within a StageFile.
type Stage ¶
type Stage struct { // GitHash is the Git commit hash at which this version of the image was // built. GitHash string `json:"git_hash"` // Digest is the sha256 digest of the image. Digest string `json:"digest"` }
Stage represents a stage of a given Image.
type StageFile ¶
type StageFile struct { // DefaultGitRepo is the URL of the git repository from which most images // are built. It is used to provide git commit information when an image // does not specify its own git repository. DefaultGitRepo string `json:"default_git_repo,omitempty"` // Images are the images which have release stages defined in this file. Images map[string]*Image `json:"images,omitempty"` }
StageFile represents a file which defines release pipeline stages.
func DecodeFile ¶
DecodeFile parses the given file as a StageFile.
func (*StageFile) EncodeFile ¶
EncodeFile writes the StageFile to a file.
type StageManager ¶
type StageManager struct {
// contains filtered or unexported fields
}
StageManager provides utilities for working with release stage files.
func NewStageManager ¶
func NewStageManager(ctx context.Context, fs vfs.FS, dockerClient docker.Client, commitResolver CommitResolver) *StageManager
NewStageManager returns a StageManager instance. The http.Client is used for interacting with git repositories and should have the necessary authentication settings (eg. OAuth2.0 token source and scopes) attached.
func (*StageManager) AddImage ¶
func (sm *StageManager) AddImage(ctx context.Context, image, gitRepo string) error
AddImage adds the given image to the stage file. The gitRepo is optional and overrides the default git repo.
func (*StageManager) Apply ¶
func (sm *StageManager) Apply(ctx context.Context) error
Apply updates all config files to conform to the stage file.
func (*StageManager) PromoteStage ¶
func (sm *StageManager) PromoteStage(ctx context.Context, image, stageToMatch, stageToUpdate string) error
PromoteStage sets a given stage to the same image version as another.
func (*StageManager) ReadStageFile ¶
func (sm *StageManager) ReadStageFile(ctx context.Context) (*StageFile, error)
ReadStageFile reads and returns the stage file.
func (*StageManager) RemoveImage ¶
func (sm *StageManager) RemoveImage(ctx context.Context, image string) error
RemoveImage removes the given image from the stage file.
func (*StageManager) RemoveStage ¶
func (sm *StageManager) RemoveStage(ctx context.Context, image, stage string) error
RemoveStage removes the given stage from the stage file.