Documentation ¶
Index ¶
- Variables
- func AddRemoteTag(src, target string, cfg Config) error
- func CreateDockerTarContext(ctx context.Context, w io.Writer, buildCfg BuildConfig, cfg Config) error
- func GetDependencies(ctx context.Context, buildCfg BuildConfig, cfg Config) ([]string, error)
- func GetDependenciesCached(ctx context.Context, buildCfg BuildConfig, cfg Config) ([]string, error)
- func IsInsecure(ref name.Reference, insecureRegistries map[string]bool) bool
- func NewDockerIgnorePredicate(workspace string, excludes []string) (walk.Predicate, error)
- func NormalizeDockerfilePath(context, dockerfile string) (string, error)
- func Push(tarPath, tag string, cfg Config) (string, error)
- func ResolveDependencyImages(deps []*latestV1.ArtifactDependency, r ArtifactResolver, missingIsFatal bool) map[string]*string
- func RetrieveConfigFile(tagged string, cfg Config) (*v1.ConfigFile, error)
- func RetrieveLabels(tagged string, cfg Config) (map[string]string, error)
- func RetrieveRemoteConfig(identifier string, cfg Config) (*v1.ConfigFile, error)
- func RetrieveWorkingDir(tagged string, cfg Config) (string, error)
- func SanitizeImageName(image string) string
- func SubstituteDefaultRepoIntoImage(defaultRepo string, image string) (string, error)
- func SyncMap(workspace string, dockerfilePath string, buildArgs map[string]*string, ...) (map[string][]string, error)
- func ToCLIBuildArgs(a *latestV1.DockerArtifact, evaluatedArgs map[string]*string) ([]string, error)
- func WalkWorkspace(workspace string, excludes, deps []string) (map[string]bool, error)
- type ArtifactConfig
- type ArtifactResolver
- type AuthConfigHelper
- type BuildConfig
- type BuildOptions
- type BuildResult
- type Config
- type ContainerRun
- type ExitCoder
- type ImageReference
- type Keychain
- type LocalDaemon
- type PushResult
Constants ¶
This section is empty.
Variables ¶
var ( // EvalBuildArgsWithEnv evaluates the build args provided in the artifact definition and adds additional runtime defaults and extra arguments, based on OS and custom environment variables EvalBuildArgsWithEnv = evalBuildArgs // EvalBuildArgs evaluates the build args provided in the artifact definition and adds additional runtime defaults and extra arguments, based on OS environment variables EvalBuildArgs = func(mode config.RunMode, workspace string, dockerfilePath string, args map[string]*string, extra map[string]*string) (map[string]*string, error) { return evalBuildArgs(mode, workspace, dockerfilePath, args, extra, nil) } )
var Name = "Docker"
Name is the name of the Docker builder
var (
NewAPIClient = NewAPIClientImpl
)
For testing
var (
RemoteDigest = getRemoteDigest
)
for testing
var (
// RetrieveImage is overridden for unit testing
RetrieveImage = retrieveImage
)
var (
Validate = validate
)
For testing
Functions ¶
func AddRemoteTag ¶ added in v0.34.0
func CreateDockerTarContext ¶
func GetDependencies ¶ added in v0.7.0
GetDependencies finds the sources dependency for the given docker artifact. it caches the results for the computed dependency which can be used by `GetDependenciesCached` All paths are relative to the workspace.
func GetDependenciesCached ¶ added in v1.17.2
GetDependenciesCached reads from cache finds the sources dependency for the given docker artifact. All paths are relative to the workspace.
func IsInsecure ¶ added in v0.37.0
IsInsecure tests if an image is pulled from an insecure registry; default is false
func NewDockerIgnorePredicate ¶ added in v1.7.1
NewDockerIgnorePredicate creates a walk.Predicate that checks if directory entries should be ignored.
func NormalizeDockerfilePath ¶ added in v0.11.0
NormalizeDockerfilePath returns the absolute path to the dockerfilePath.
func ResolveDependencyImages ¶ added in v1.7.1
func ResolveDependencyImages(deps []*latestV1.ArtifactDependency, r ArtifactResolver, missingIsFatal bool) map[string]*string
ResolveDependencyImages creates a map of artifact aliases to their built image from a required artifacts slice. If `missingIsFatal` is false then it is permissive of missing entries in the ArtifactResolver and returns nil for those entries.
func RetrieveConfigFile ¶ added in v1.2.0
func RetrieveConfigFile(tagged string, cfg Config) (*v1.ConfigFile, error)
func RetrieveLabels ¶ added in v1.3.0
func RetrieveRemoteConfig ¶ added in v0.24.0
func RetrieveRemoteConfig(identifier string, cfg Config) (*v1.ConfigFile, error)
RetrieveRemoteConfig retrieves the remote config file for an image
func RetrieveWorkingDir ¶ added in v0.32.0
func SanitizeImageName ¶ added in v1.7.1
SanitizeImageName removes prefixes and lowercases the name portion of images. This is primarily used to handle `ko` import paths in image fields, e.g. `ko://github.com/GoogleContainerTools/skaffold`. Tags can contain uppercase characters, so this function takes care not to change tag cases.
func SubstituteDefaultRepoIntoImage ¶ added in v1.0.0
func SyncMap ¶ added in v0.32.0
func SyncMap(workspace string, dockerfilePath string, buildArgs map[string]*string, cfg Config) (map[string][]string, error)
SyncMap creates a map of syncable files by looking at the COPY/ADD commands in the Dockerfile. All keys are relative to the Skaffold root, the destinations are absolute container paths. TODO(corneliusweig) destinations are not resolved across stages in multistage dockerfiles. Is there a use-case for that?
func ToCLIBuildArgs ¶ added in v1.7.1
Types ¶
type ArtifactConfig ¶ added in v1.2.0
type ArtifactConfig struct {
File string `json:"path"`
}
ArtifactConfig holds information about a Docker build based project
func (ArtifactConfig) ArtifactType ¶ added in v1.6.0
func (c ArtifactConfig) ArtifactType(workspace string) latestV1.ArtifactType
ArtifactType returns the type of the artifact to be built.
func (ArtifactConfig) ConfiguredImage ¶ added in v1.2.0
func (c ArtifactConfig) ConfiguredImage() string
ConfiguredImage returns the target image configured by the builder, or an empty string if no image is configured
func (ArtifactConfig) Describe ¶ added in v1.2.0
func (c ArtifactConfig) Describe() string
Describe returns the initBuilder's string representation, used when prompting the user to choose a builder.
func (ArtifactConfig) Name ¶ added in v1.2.0
func (c ArtifactConfig) Name() string
Name returns the name of the builder, "Docker"
func (ArtifactConfig) Path ¶ added in v1.2.0
func (c ArtifactConfig) Path() string
Path returns the path to the dockerfile
type ArtifactResolver ¶ added in v1.7.1
ArtifactResolver provides an interface to resolve built artifact tags by image name.
type AuthConfigHelper ¶
type AuthConfigHelper interface { GetAuthConfig(registry string) (types.AuthConfig, error) GetAllAuthConfigs(ctx context.Context) (map[string]types.AuthConfig, error) }
AuthConfigHelper exists for testing purposes since GetAuthConfig shells out to native store helpers. Ideally this shouldn't be public, but the LocalBuilder needs to use it.
var ( // DefaultAuthHelper is exposed so that other packages can override it for testing DefaultAuthHelper AuthConfigHelper )
type BuildConfig ¶ added in v1.17.2
type BuildConfig struct {
// contains filtered or unexported fields
}
BuildConfig encapsulates all the build configuration required for performing a dockerbuild.
func NewBuildConfig ¶ added in v1.17.2
NewBuildConfig returns a `BuildConfig` for a dockerfilePath build.
type BuildOptions ¶
BuildOptions provides parameters related to the LocalDaemon build.
type BuildResult ¶ added in v0.21.0
type BuildResult struct {
ID string
}
BuildResult gives the information on an image that has been built.
type ContainerRun ¶ added in v1.0.0
type ImageReference ¶ added in v0.7.0
type ImageReference struct { BaseName string Domain string Path string Repo string Name string Tag string Digest string FullyQualified bool }
ImageReference is a parsed image name.
func ParseReference ¶ added in v0.7.0
func ParseReference(image string) (*ImageReference, error)
ParseReference parses an image name to a reference.
type Keychain ¶ added in v1.7.0
type Keychain struct {
// contains filtered or unexported fields
}
Keychain stores an authenticator per registry.
type LocalDaemon ¶ added in v0.21.0
type LocalDaemon interface { Close() error ExtraEnv() []string ServerVersion(ctx context.Context) (types.Version, error) ConfigFile(ctx context.Context, image string) (*v1.ConfigFile, error) Build(ctx context.Context, out io.Writer, workspace string, artifact string, a *latestV1.DockerArtifact, opts BuildOptions) (string, error) Push(ctx context.Context, out io.Writer, ref string) (string, error) Pull(ctx context.Context, out io.Writer, ref string) error Load(ctx context.Context, out io.Writer, input io.Reader, ref string) (string, error) Tag(ctx context.Context, image, ref string) error TagWithImageID(ctx context.Context, ref string, imageID string) (string, error) ImageID(ctx context.Context, ref string) (string, error) ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error) ImageRemove(ctx context.Context, image string, opts types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) ImageExists(ctx context.Context, ref string) bool ImageList(ctx context.Context, ref string) ([]types.ImageSummary, error) Prune(ctx context.Context, images []string, pruneChildren bool) ([]string, error) DiskUsage(ctx context.Context) (uint64, error) RawClient() client.CommonAPIClient }
LocalDaemon talks to a local Docker API.
func NewAPIClientImpl ¶ added in v0.35.0
func NewAPIClientImpl(cfg Config) (LocalDaemon, error)
NewAPIClientImpl guesses the docker client to use based on current Kubernetes context.
func NewLocalDaemon ¶ added in v0.21.0
func NewLocalDaemon(apiClient client.CommonAPIClient, extraEnv []string, forceRemove bool, cfg Config) LocalDaemon
NewLocalDaemon creates a new LocalDaemon.
type PushResult ¶ added in v0.21.0
type PushResult struct {
Digest string
}
PushResult gives the information on an image that has been pushed.