Documentation
¶
Index ¶
- Constants
- func BuildImage(dockerClient DockerClient, image *Image, config BuildConfig) error
- func GenerateReport(image *Image, config BuildConfig) error
- func ImageExists(dockerClient DockerClient, image *Image, config BuildConfig) (bool, error)
- func PushImage(dockerClient DockerClient, image *Image, config BuildConfig) error
- func Tar(source string, target string) error
- func TransformConfigToImages(config BuildConfig) (images map[string]*Image, err error)
- func WalkBuildGraph(graph *Image, apply func(image *Image))
- func WalkBuildGraphParallel(graph *Image, apply func(image *Image))
- type AuthConfig
- type BuildConfig
- type BuildReport
- type DockerClient
- type ExternalDockerClient
- func (client *ExternalDockerClient) ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
- func (client *ExternalDockerClient) ImagePush(ctx context.Context, image string, options types.ImagePushOptions) (io.ReadCloser, error)
- func (client *ExternalDockerClient) Tags(imageName string) (tags []string, err error)
- type Image
- type ImageBuildSummary
- type ImageConfig
Constants ¶
const DefaultShaLength = 64
const GeneratedDockerFileNamePrefix = "Dockerfile.generated"
Variables ¶
This section is empty.
Functions ¶
func BuildImage ¶
func BuildImage(dockerClient DockerClient, image *Image, config BuildConfig) error
func GenerateReport ¶
func GenerateReport(image *Image, config BuildConfig) error
func ImageExists ¶
func ImageExists(dockerClient DockerClient, image *Image, config BuildConfig) (bool, error)
func PushImage ¶
func PushImage(dockerClient DockerClient, image *Image, config BuildConfig) error
func TransformConfigToImages ¶
func TransformConfigToImages(config BuildConfig) (images map[string]*Image, err error)
Transforms list of config items into independent Tree nodes. Checks for duplicate IDs and multiple parents (images with no parent defined)
func WalkBuildGraph ¶
WalkBuildGraph performs a breadth-first traversal of the tree and applies the provided function to all elements from the same level in order. It is recommended using it when 'apply' function has side-effects which require deterministic ordering e.g. building an ordered slice of image tags.
func WalkBuildGraphParallel ¶
WalkBuildGraphParallel performs a breadth-first traversal of the tree and applies the provided function to all elements from the same level in parallel. The provided function should not rely on the ordering of the elements within the same level. The function is called within a goroutine and while it is applied to each element in order, the order of completion is not guaranteed. However, the ordering of levels is always preserved and the new tree level processing doesn't start until all the elements from the previous level are processed.
Types ¶
type AuthConfig ¶
type BuildConfig ¶
type BuildConfig struct { AuthConfig AuthConfig BaseDir string ReleaseTag string OutputFile string Images []ImageConfig `yaml:"images"` GlobalProperties map[string]string `yaml:"global_properties"` }
func (*BuildConfig) LoadConfigFromFile ¶
func (config *BuildConfig) LoadConfigFromFile(fileName string) error
type BuildReport ¶
type BuildReport struct {
Images []ImageBuildSummary
}
type DockerClient ¶
type DockerClient interface { Tags(imageName string) (tags []string, err error) ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error) ImagePush(ctx context.Context, image string, options types.ImagePushOptions) (io.ReadCloser, error) }
type ExternalDockerClient ¶
type ExternalDockerClient struct { AuthConfig AuthConfig Client *client.Client Registry *registry.Registry TagsCache map[string][]string }
func NewExternalDockerClient ¶
func NewExternalDockerClient(authConfig AuthConfig) *ExternalDockerClient
func (*ExternalDockerClient) ImageBuild ¶
func (client *ExternalDockerClient) ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
func (*ExternalDockerClient) ImagePush ¶
func (client *ExternalDockerClient) ImagePush(ctx context.Context, image string, options types.ImagePushOptions) (io.ReadCloser, error)
func (*ExternalDockerClient) Tags ¶
func (client *ExternalDockerClient) Tags(imageName string) (tags []string, err error)
Tags retrieves tags list from the registry for specified image name and adds them to the cache. It returns tags list (whether by making an HTTP call to a registry of from the cache) and any error encountered.
type Image ¶
type Image struct { ImageConfig ImageConfig Dockerfile string Checksum string Parent *Image Children []*Image }
Tree Node represents Docker Image
func CreateImageBuildGraph ¶
Constructs a tree/DAG of images and performs cycle detection check and orphaned images check
func (*Image) CalculateChecksum ¶
func (*Image) RenderDockerfileFromTemplate ¶
func (image *Image) RenderDockerfileFromTemplate(config BuildConfig) error
type ImageBuildSummary ¶
type ImageConfig ¶
type ImageConfig struct { Id string Parent string Repository string Name string TagPrefix string `yaml:"tag_prefix"` TagSuffix string `yaml:"tag_suffix"` Template string ExtraFiles []string `yaml:"extra_files"` ExcludedFiles []string `yaml:"exclude_files"` Properties map[string]string }
func (ImageConfig) String ¶
func (image ImageConfig) String() string