stage

package
v1.2.0-alpha9 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type BaseStage

type BaseStage struct {
	// contains filtered or unexported fields
}

func (*BaseStage) FetchDependencies added in v1.1.23

func (*BaseStage) GetContentDigest added in v1.2.0

func (s *BaseStage) GetContentDigest() string

func (*BaseStage) GetDependencies

func (s *BaseStage) GetDependencies(_ context.Context, _ Conveyor, _, _ container_runtime.ImageInterface) (string, error)

func (*BaseStage) GetDigest added in v1.2.0

func (s *BaseStage) GetDigest() string

func (*BaseStage) GetGitMappings

func (s *BaseStage) GetGitMappings() []*GitMapping

func (*BaseStage) GetImage

func (*BaseStage) GetNextStageDependencies

func (s *BaseStage) GetNextStageDependencies(_ context.Context, _ Conveyor) (string, error)

func (*BaseStage) IsEmpty

func (*BaseStage) LogDetailedName

func (s *BaseStage) LogDetailedName() string

func (*BaseStage) Name

func (s *BaseStage) Name() StageName

func (*BaseStage) PreRunHook

func (s *BaseStage) PreRunHook(_ context.Context, _ Conveyor) error

func (*BaseStage) PrepareImage

func (s *BaseStage) PrepareImage(ctx context.Context, c Conveyor, prevBuiltImage, image container_runtime.ImageInterface) error

func (*BaseStage) SelectSuitableStage

func (s *BaseStage) SelectSuitableStage(_ context.Context, c Conveyor, stages []*image.StageDescription) (*image.StageDescription, error)

func (*BaseStage) SetContentDigest added in v1.2.0

func (s *BaseStage) SetContentDigest(contentDigest string)

func (*BaseStage) SetDigest added in v1.2.0

func (s *BaseStage) SetDigest(digest string)

func (*BaseStage) SetGitMappings

func (s *BaseStage) SetGitMappings(gitMappings []*GitMapping)

func (*BaseStage) SetImage

func (s *BaseStage) SetImage(image container_runtime.ImageInterface)

type BeforeInstallStage

type BeforeInstallStage struct {
	*UserStage
}

func GenerateBeforeInstallStage

func GenerateBeforeInstallStage(ctx context.Context, imageBaseConfig *config.StapelImageBase, baseStageOptions *NewBaseStageOptions) *BeforeInstallStage

func (*BeforeInstallStage) GetDependencies

func (*BeforeInstallStage) PrepareImage

func (s *BeforeInstallStage) PrepareImage(ctx context.Context, c Conveyor, prevBuiltImage, image container_runtime.ImageInterface) error

type BeforeSetupStage

type BeforeSetupStage struct {
	*UserWithGitPatchStage
}

func GenerateBeforeSetupStage

func GenerateBeforeSetupStage(ctx context.Context, imageBaseConfig *config.StapelImageBase, gitPatchStageOptions *NewGitPatchStageOptions, baseStageOptions *NewBaseStageOptions) *BeforeSetupStage

func (*BeforeSetupStage) GetDependencies

func (*BeforeSetupStage) PrepareImage

func (s *BeforeSetupStage) PrepareImage(ctx context.Context, c Conveyor, prevBuiltImage, image container_runtime.ImageInterface) error

type ContainerFileDescriptor

type ContainerFileDescriptor struct {
	FilePath          string
	ContainerFilePath string
}

func (*ContainerFileDescriptor) Open

func (f *ContainerFileDescriptor) Open(flag int, perm os.FileMode) (*os.File, error)

type ContextChecksum

type ContextChecksum struct {
	// contains filtered or unexported fields
}

func NewContextChecksum

func NewContextChecksum(projectPath string, dockerignorePathMatcher *path_matcher.DockerfileIgnorePathMatcher, localGitRepo *git_repo.Local) *ContextChecksum

type Conveyor

type Conveyor interface {
	GetImageStageContentDigest(imageName, stageName string) string
	GetImageContentDigest(imageName string) string

	GetImageNameForLastImageStage(imageName string) string
	GetImageIDForLastImageStage(imageName string) string

	GetImageNameForImageStage(imageName, stageName string) string
	GetImageIDForImageStage(imageName, stageName string) string

	GetImportServer(ctx context.Context, imageName, stageName string) (import_server.ImportServer, error)
	GetLocalGitRepoVirtualMergeOptions() VirtualMergeOptions

	GetProjectRepoCommit(ctx context.Context) (string, error)
}

type DockerInstructionsStage

type DockerInstructionsStage struct {
	*BaseStage
	// contains filtered or unexported fields
}

func GenerateDockerInstructionsStage

func GenerateDockerInstructionsStage(imageConfig *config.StapelImage, baseStageOptions *NewBaseStageOptions) *DockerInstructionsStage

func (*DockerInstructionsStage) GetDependencies

func (*DockerInstructionsStage) PrepareImage

func (s *DockerInstructionsStage) PrepareImage(ctx context.Context, c Conveyor, prevBuiltImage, image container_runtime.ImageInterface) error

type DockerRunArgs

type DockerRunArgs struct {
	// contains filtered or unexported fields
}

func NewDockerRunArgs

func NewDockerRunArgs(dockerfilePath, target, context string, buildArgs map[string]interface{}, addHost []string, network, ssh string) *DockerRunArgs

type DockerStages

type DockerStages struct {
	// contains filtered or unexported fields
}

func NewDockerStages

func NewDockerStages(dockerStages []instructions.Stage, dockerArgsHash map[string]string, dockerTargetStageIndex int) *DockerStages

type DockerfileStage

type DockerfileStage struct {
	*DockerRunArgs
	*DockerStages
	*ContextChecksum
	*BaseStage
}

func GenerateDockerfileStage

func GenerateDockerfileStage(dockerRunArgs *DockerRunArgs, dockerStages *DockerStages, contextChecksum *ContextChecksum, baseStageOptions *NewBaseStageOptions) *DockerfileStage

func (*DockerfileStage) DockerBuildArgs

func (s *DockerfileStage) DockerBuildArgs() []string

func (*DockerfileStage) FetchDependencies added in v1.1.23

func (*DockerfileStage) GetDependencies

func (*DockerfileStage) PrepareImage

func (s *DockerfileStage) PrepareImage(_ context.Context, c Conveyor, prevBuiltImage, img container_runtime.ImageInterface) error

type FromStage

type FromStage struct {
	*BaseStage
	// contains filtered or unexported fields
}

func GenerateFromStage

func GenerateFromStage(imageBaseConfig *config.StapelImageBase, baseImageRepoId string, baseStageOptions *NewBaseStageOptions) *FromStage

func (*FromStage) GetDependencies

func (s *FromStage) GetDependencies(_ context.Context, c Conveyor, prevImage, _ container_runtime.ImageInterface) (string, error)

func (*FromStage) PrepareImage

func (s *FromStage) PrepareImage(ctx context.Context, c Conveyor, prevBuiltImage, image container_runtime.ImageInterface) error

type GitArchiveStage

type GitArchiveStage struct {
	*GitStage

	ArchivesDir          string
	ScriptsDir           string
	ContainerArchivesDir string
	ContainerScriptsDir  string
}

func NewGitArchiveStage

func NewGitArchiveStage(gitArchiveStageOptions *NewGitArchiveStageOptions, baseStageOptions *NewBaseStageOptions) *GitArchiveStage

func (*GitArchiveStage) GetDependencies

func (*GitArchiveStage) GetNextStageDependencies

func (s *GitArchiveStage) GetNextStageDependencies(ctx context.Context, c Conveyor) (string, error)

func (*GitArchiveStage) PrepareImage

func (s *GitArchiveStage) PrepareImage(ctx context.Context, c Conveyor, prevBuiltImage, image container_runtime.ImageInterface) error

func (*GitArchiveStage) SelectSuitableStage

func (s *GitArchiveStage) SelectSuitableStage(ctx context.Context, c Conveyor, stages []*image.StageDescription) (*image.StageDescription, error)

type GitCacheStage

type GitCacheStage struct {
	*GitPatchStage
}

func NewGitCacheStage

func NewGitCacheStage(gitPatchStageOptions *NewGitPatchStageOptions, baseStageOptions *NewBaseStageOptions) *GitCacheStage

func (*GitCacheStage) GetDependencies

func (s *GitCacheStage) GetDependencies(ctx context.Context, c Conveyor, _, prevBuiltImage container_runtime.ImageInterface) (string, error)

func (*GitCacheStage) GetNextStageDependencies

func (s *GitCacheStage) GetNextStageDependencies(ctx context.Context, c Conveyor) (string, error)

func (*GitCacheStage) IsEmpty

func (s *GitCacheStage) IsEmpty(ctx context.Context, c Conveyor, prevBuiltImage container_runtime.ImageInterface) (bool, error)

func (*GitCacheStage) SelectSuitableStage

func (s *GitCacheStage) SelectSuitableStage(ctx context.Context, c Conveyor, stages []*image.StageDescription) (*image.StageDescription, error)

type GitLatestPatchStage

type GitLatestPatchStage struct {
	*GitPatchStage
}

func NewGitLatestPatchStage

func NewGitLatestPatchStage(gitPatchStageOptions *NewGitPatchStageOptions, baseStageOptions *NewBaseStageOptions) *GitLatestPatchStage

func (*GitLatestPatchStage) GetDependencies

func (s *GitLatestPatchStage) GetDependencies(ctx context.Context, c Conveyor, _, prevBuiltImage container_runtime.ImageInterface) (string, error)

func (*GitLatestPatchStage) GetNextStageDependencies

func (s *GitLatestPatchStage) GetNextStageDependencies(ctx context.Context, c Conveyor) (string, error)

func (*GitLatestPatchStage) IsEmpty

func (s *GitLatestPatchStage) IsEmpty(ctx context.Context, c Conveyor, prevBuiltImage container_runtime.ImageInterface) (bool, error)

func (*GitLatestPatchStage) SelectSuitableStage

func (s *GitLatestPatchStage) SelectSuitableStage(ctx context.Context, c Conveyor, stages []*image.StageDescription) (*image.StageDescription, error)

type GitMapping

type GitMapping struct {
	GitRepoInterface git_repo.GitRepo
	LocalGitRepo     *git_repo.Local
	RemoteGitRepo    *git_repo.Remote
	GitRepoCache     *GitRepoCache

	Name               string
	As                 string
	Branch             string
	Tag                string
	Commit             string
	Add                string
	To                 string
	Owner              string
	Group              string
	IncludePaths       []string
	ExcludePaths       []string
	StagesDependencies map[StageName][]string

	PatchesDir           string
	ContainerPatchesDir  string
	ArchivesDir          string
	ContainerArchivesDir string
	ScriptsDir           string
	ContainerScriptsDir  string

	BaseCommitByPrevBuiltImageName map[string]string
	// contains filtered or unexported fields
}

func NewGitMapping added in v1.1.23

func NewGitMapping() *GitMapping

func (*GitMapping) AddGitCommitToImageLabels

func (gm *GitMapping) AddGitCommitToImageLabels(image container_runtime.ImageInterface, commitInfo ImageCommitInfo)

func (*GitMapping) ApplyArchiveCommand

func (gm *GitMapping) ApplyArchiveCommand(ctx context.Context, c Conveyor, image container_runtime.ImageInterface) error

func (*GitMapping) ApplyPatchCommand

func (gm *GitMapping) ApplyPatchCommand(ctx context.Context, c Conveyor, prevBuiltImage, image container_runtime.ImageInterface) error

func (*GitMapping) GetBaseCommitForPrevBuiltImage

func (gm *GitMapping) GetBaseCommitForPrevBuiltImage(ctx context.Context, c Conveyor, prevBuiltImage container_runtime.ImageInterface) (string, error)

func (*GitMapping) GetBuiltImageCommitInfo

func (gm *GitMapping) GetBuiltImageCommitInfo(builtImageLabels map[string]string) (ImageCommitInfo, error)

func (*GitMapping) GetFullName

func (gm *GitMapping) GetFullName() string

func (*GitMapping) GetLatestCommitInfo

func (gm *GitMapping) GetLatestCommitInfo(ctx context.Context, c Conveyor) (ImageCommitInfo, error)

func (*GitMapping) GetParamshash

func (gm *GitMapping) GetParamshash() string

func (*GitMapping) GetPatchContent

func (gm *GitMapping) GetPatchContent(ctx context.Context, c Conveyor, prevBuiltImage container_runtime.ImageInterface) (string, error)

func (*GitMapping) GitRepo

func (gm *GitMapping) GitRepo() git_repo.GitRepo

func (*GitMapping) ImageGitCommitLabel

func (gm *GitMapping) ImageGitCommitLabel() string

func (*GitMapping) IsEmpty

func (gm *GitMapping) IsEmpty(ctx context.Context, c Conveyor) (bool, error)

func (*GitMapping) IsLocal

func (gm *GitMapping) IsLocal() bool

func (*GitMapping) IsPatchEmpty

func (gm *GitMapping) IsPatchEmpty(ctx context.Context, c Conveyor, prevBuiltImage container_runtime.ImageInterface) (bool, error)

func (*GitMapping) PatchSize

func (gm *GitMapping) PatchSize(ctx context.Context, c Conveyor, fromCommit string) (int64, error)

func (*GitMapping) StageDependenciesChecksum

func (gm *GitMapping) StageDependenciesChecksum(ctx context.Context, c Conveyor, stageName StageName) (string, error)

func (*GitMapping) VirtualMergeFromCommitLabel

func (gm *GitMapping) VirtualMergeFromCommitLabel() string

func (*GitMapping) VirtualMergeIntoCommitLabel

func (gm *GitMapping) VirtualMergeIntoCommitLabel() string

func (*GitMapping) VirtualMergeLabel

func (gm *GitMapping) VirtualMergeLabel() string

type GitPatchStage

type GitPatchStage struct {
	*GitStage

	PatchesDir           string
	ArchivesDir          string
	ScriptsDir           string
	ContainerPatchesDir  string
	ContainerArchivesDir string
	ContainerScriptsDir  string
}

func (*GitPatchStage) IsEmpty

func (s *GitPatchStage) IsEmpty(ctx context.Context, c Conveyor, prevBuiltImage container_runtime.ImageInterface) (bool, error)

func (*GitPatchStage) PrepareImage

func (s *GitPatchStage) PrepareImage(ctx context.Context, c Conveyor, prevBuiltImage, image container_runtime.ImageInterface) error

type GitRepoCache

type GitRepoCache struct {
	Patches   map[string]git_repo.Patch
	Checksums map[string]git_repo.Checksum
	Archives  map[string]git_repo.Archive
	// contains filtered or unexported fields
}

func (*GitRepoCache) Terminate

func (cache *GitRepoCache) Terminate() error

type GitStage

type GitStage struct {
	*BaseStage
}

func (*GitStage) IsEmpty

func (*GitStage) PrepareImage

func (s *GitStage) PrepareImage(ctx context.Context, c Conveyor, prevBuiltImage, image container_runtime.ImageInterface) error

type ImageCommitInfo

type ImageCommitInfo struct {
	Commit string
	VirtualMergeOptions
}

type ImportsAfterInstallStage

type ImportsAfterInstallStage struct {
	*ImportsStage
}

func GenerateImportsAfterInstallStage

func GenerateImportsAfterInstallStage(imageBaseConfig *config.StapelImageBase, baseStageOptions *NewBaseStageOptions) *ImportsAfterInstallStage

type ImportsAfterSetupStage

type ImportsAfterSetupStage struct {
	*ImportsStage
}

func GenerateImportsAfterSetupStage

func GenerateImportsAfterSetupStage(imageBaseConfig *config.StapelImageBase, baseStageOptions *NewBaseStageOptions) *ImportsAfterSetupStage

type ImportsBeforeInstallStage

type ImportsBeforeInstallStage struct {
	*ImportsStage
}

func GenerateImportsBeforeInstallStage

func GenerateImportsBeforeInstallStage(imageBaseConfig *config.StapelImageBase, baseStageOptions *NewBaseStageOptions) *ImportsBeforeInstallStage

type ImportsBeforeSetupStage

type ImportsBeforeSetupStage struct {
	*ImportsStage
}

func GenerateImportsBeforeSetupStage

func GenerateImportsBeforeSetupStage(imageBaseConfig *config.StapelImageBase, baseStageOptions *NewBaseStageOptions) *ImportsBeforeSetupStage

type ImportsStage

type ImportsStage struct {
	*BaseStage
	// contains filtered or unexported fields
}

func (*ImportsStage) GetDependencies

func (*ImportsStage) PrepareImage

func (s *ImportsStage) PrepareImage(ctx context.Context, c Conveyor, _, image container_runtime.ImageInterface) error

type InstallStage

type InstallStage struct {
	*UserWithGitPatchStage
}

func GenerateInstallStage

func GenerateInstallStage(ctx context.Context, imageBaseConfig *config.StapelImageBase, gitPatchStageOptions *NewGitPatchStageOptions, baseStageOptions *NewBaseStageOptions) *InstallStage

func (*InstallStage) GetDependencies

func (s *InstallStage) GetDependencies(ctx context.Context, c Conveyor, _, _ container_runtime.ImageInterface) (string, error)

func (*InstallStage) PrepareImage

func (s *InstallStage) PrepareImage(ctx context.Context, c Conveyor, prevBuiltImage, image container_runtime.ImageInterface) error

type Interface

type Interface interface {
	Name() StageName
	LogDetailedName() string

	IsEmpty(ctx context.Context, c Conveyor, prevBuiltImage container_runtime.ImageInterface) (bool, error)

	FetchDependencies(ctx context.Context, c Conveyor, cr container_runtime.ContainerRuntime) error
	GetDependencies(ctx context.Context, c Conveyor, prevImage container_runtime.ImageInterface, prevBuiltImage container_runtime.ImageInterface) (string, error)
	GetNextStageDependencies(ctx context.Context, c Conveyor) (string, error)

	PrepareImage(ctx context.Context, c Conveyor, prevBuiltImage, image container_runtime.ImageInterface) error

	PreRunHook(context.Context, Conveyor) error

	SetDigest(digest string)
	GetDigest() string

	SetContentDigest(contentDigest string)
	GetContentDigest() string

	SetImage(container_runtime.ImageInterface)
	GetImage() container_runtime.ImageInterface

	SetGitMappings([]*GitMapping)
	GetGitMappings() []*GitMapping

	SelectSuitableStage(_ context.Context, c Conveyor, stages []*image.StageDescription) (*image.StageDescription, error)
}

type NewBaseStageOptions

type NewBaseStageOptions struct {
	ImageName        string
	ConfigMounts     []*config.Mount
	ImageTmpDir      string
	ContainerWerfDir string
	ProjectName      string
}

type NewGitArchiveStageOptions

type NewGitArchiveStageOptions struct {
	ArchivesDir          string
	ScriptsDir           string
	ContainerArchivesDir string
	ContainerScriptsDir  string
}

type NewGitPatchStageOptions

type NewGitPatchStageOptions struct {
	PatchesDir           string
	ArchivesDir          string
	ScriptsDir           string
	ContainerPatchesDir  string
	ContainerArchivesDir string
	ContainerScriptsDir  string
}

type SetupStage

type SetupStage struct {
	*UserWithGitPatchStage
}

func GenerateSetupStage

func GenerateSetupStage(ctx context.Context, imageBaseConfig *config.StapelImageBase, gitPatchStageOptions *NewGitPatchStageOptions, baseStageOptions *NewBaseStageOptions) *SetupStage

func (*SetupStage) GetDependencies

func (s *SetupStage) GetDependencies(ctx context.Context, c Conveyor, _, _ container_runtime.ImageInterface) (string, error)

func (*SetupStage) PrepareImage

func (s *SetupStage) PrepareImage(ctx context.Context, c Conveyor, prevBuiltImage, image container_runtime.ImageInterface) error

type StageName

type StageName string
const (
	From                 StageName = "from"
	BeforeInstall        StageName = "beforeInstall"
	ImportsBeforeInstall StageName = "importsBeforeInstall"
	GitArchive           StageName = "gitArchive"
	Install              StageName = "install"
	ImportsAfterInstall  StageName = "importsAfterInstall"
	BeforeSetup          StageName = "beforeSetup"
	ImportsBeforeSetup   StageName = "importsBeforeSetup"
	Setup                StageName = "setup"
	ImportsAfterSetup    StageName = "importsAfterSetup"
	GitCache             StageName = "gitCache"
	GitLatestPatch       StageName = "gitLatestPatch"
	DockerInstructions   StageName = "dockerInstructions"

	Dockerfile StageName = "dockerfile"
)

type UserStage

type UserStage struct {
	*BaseStage
	// contains filtered or unexported fields
}

type UserWithGitPatchStage

type UserWithGitPatchStage struct {
	*UserStage
	GitPatchStage *GitPatchStage
}

func (*UserWithGitPatchStage) GetNextStageDependencies

func (s *UserWithGitPatchStage) GetNextStageDependencies(ctx context.Context, c Conveyor) (string, error)

func (*UserWithGitPatchStage) PrepareImage

func (s *UserWithGitPatchStage) PrepareImage(ctx context.Context, c Conveyor, prevBuiltImage, image container_runtime.ImageInterface) error

func (*UserWithGitPatchStage) SelectSuitableStage

func (s *UserWithGitPatchStage) SelectSuitableStage(ctx context.Context, c Conveyor, stages []*image.StageDescription) (*image.StageDescription, error)

type VirtualMergeOptions

type VirtualMergeOptions struct {
	VirtualMerge           bool
	VirtualMergeFromCommit string
	VirtualMergeIntoCommit string
}

Jump to

Keyboard shortcuts

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