Documentation
¶
Index ¶
- func BuildProject(ctx context.Context, client *Client, opts *ProjectBuildOpts) error
- func PushTag(tagName, platformStr, buildID string) string
- func TarFilePath(distPath, name, tag, platformStr string) string
- func WithBuildID(tag, buildID string) string
- type BuildOpts
- type Client
- type Filter
- type HiveDeps
- type HiveDepsOpts
- type ProjectBuildOpts
- type Registry
- type ResolvedConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildProject ¶
func BuildProject(ctx context.Context, client *Client, opts *ProjectBuildOpts) error
BuildProject builds all images in the project according to the dependency order, applying filters and pushing to the registry when dependents exist.
func PushTag ¶
PushTag returns the tag to use when pushing to the registry, with platform suffix and optional build-id suffix. Format: tagName.sanitized-platform[.buildID]
func TarFilePath ¶
TarFilePath returns the OCI tar output path for a given image tag and platform inside the rendered dist directory. The layout is: dist/<name>/<tag>/<sanitized-platform>/image.tar
func WithBuildID ¶
WithBuildID appends an optional build ID suffix to a tag. Returns the tag unchanged if buildID is empty.
Types ¶
type BuildOpts ¶
type BuildOpts struct {
ImageName string
Platform string
TarFile string
BuildArgs map[string]string
Secrets map[string][]byte
Cache cache.BuildkitCache
// ContextDir is the build context root directory.
ContextDir string
// Dockerfile is the relative path to the Dockerfile within ContextDir.
// Defaults to "Dockerfile" if empty.
Dockerfile string
// RegistryRef is the full image reference for direct registry push
// (e.g. "localhost:8500/ubuntu:22.04.linux-amd64").
RegistryRef string
// RegistryInsecure allows pushing over HTTP.
RegistryInsecure bool
// DockerMediaTypes forces BuildKit's image exporter to emit Docker-scheme
// media types (manifest, config, layers) rather than OCI. Required when
// the target registry (e.g. Docker Hub) doesn't accept pure OCI.
DockerMediaTypes bool
// OCIStores maps store IDs to content stores for OCI layout named contexts.
OCIStores map[string]content.Store
// NamedContexts maps frontend attribute keys to OCI layout references.
NamedContexts map[string]string
// ProgressConfig controls how build progress is displayed.
// When zero-valued, AutoMode with DefaultColors is used.
ProgressConfig progress.Config
}
BuildOpts contains all parameters for a single image build.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the internal BuildKit client.
func NewClient ¶
NewClient connects to a BuildKit daemon at the given endpoint. If endpoint is empty, it falls back to BUILDKIT_HOST environment variable.
type HiveDeps ¶
type HiveDeps struct {
OCIStores map[string]content.Store
NamedContexts map[string]string
// Dockerfile is the path to a rewritten Dockerfile where __hive__/ has been
// replaced with a valid Docker reference prefix for named context resolution.
Dockerfile string
// contains filtered or unexported fields
}
HiveDeps holds the OCI layout stores and named context mappings needed to resolve inter-image dependencies via BuildKit named contexts instead of a registry.
func ResolveHiveDeps ¶
func ResolveHiveDeps(opts HiveDepsOpts) (*HiveDeps, error)
ResolveHiveDeps scans a Dockerfile for __hive__/ references and resolves each to an OCI layout content store (local) or a docker-image:// registry reference (CI). It also creates a rewritten Dockerfile that uses a valid Docker reference prefix (hive-dep/) so BuildKit can parse it. Returns nil (not an error) when the Dockerfile has no hive dependencies.
type HiveDepsOpts ¶
type HiveDepsOpts struct {
DockerfilePath string
DistPath string
PlatformStr string
// RegistryAddress is the registry address for CI fallback resolution.
// When set and a local tar is not found, dependencies resolve to
// docker-image:// references pointing at the registry manifest.
RegistryAddress string
// BuildID is appended to registry tags when resolving via registry.
BuildID string
}
HiveDepsOpts configures how hive dependencies are resolved.
type ProjectBuildOpts ¶
type ProjectBuildOpts struct {
Project *model.ContainerHiveProject
BuildOrder *deps.BuildOrder
DistPath string
Cache cache.BuildkitCache
Registry Registry // nil when no inter-image dependencies exist
ProgressOut io.Writer
// ProgressConfig controls build progress display (mode, colors, no-color).
// When zero-valued, AutoMode with DefaultColors is used.
ProgressConfig progress.Config
Filters []Filter // empty = build everything
BuildID string // if set, registry push/retag uses tags suffixed with .<BuildID>
// OnBuild is called after each successful build with the image tag and tar path.
OnBuild func(imageTag, tarFile string)
}
ProjectBuildOpts holds shared configuration for a project-wide build.
type ResolvedConfig ¶
ResolvedConfig holds the resolved build arguments and secrets for an image build.
func ResolveTagConfig ¶
ResolveTagConfig resolves build args and secrets for a specific image tag.
func ResolveVariantConfig ¶
func ResolveVariantConfig(image *model.Image, variant *model.ImageVariant, tag *model.Tag) (*ResolvedConfig, error)
ResolveVariantConfig resolves build args and secrets for a specific image tag variant.