bulk

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExpectedAPIVersion = "copa.sh/v1alpha1"
	ExpectedKind       = "PatchConfig"
)
View Source
const (
	StrategyList    = "list"
	StrategyPattern = "pattern"
	StrategyLatest  = "latest"
)

Variables

This section is empty.

Functions

func FindTagsToPatch

func FindTagsToPatch(spec *ImageSpec) ([]string, error)

FindTagsToPatch discovers image tags based on the specified strategy in the ImageSpec.

func PatchChart added in v0.15.0

func PatchChart(ctx context.Context, opts *types.Options) error

PatchChart orchestrates patching all images discovered from a single Helm chart and generating a patched wrapper chart pushed to an OCI registry.

Flow:

  1. Download and render the chart to discover container images
  2. Patch each discovered image using the existing single-image patching flow
  3. Build a wrapper chart with patched image overrides
  4. Push the wrapper chart to the configured OCI registry

func PatchFromConfig

func PatchFromConfig(ctx context.Context, configPath string, opts *types.Options) error

PatchFromConfig orchestrates the bulk patching process based on a configuration file.

Types

type ChartImageMapping added in v0.15.0

type ChartImageMapping struct {
	ChartName    string
	OriginalRepo string
	OriginalTag  string
	PatchedRepo  string
	PatchedTag   string
}

ChartImageMapping tracks the original→patched image mapping for chart-based patching.

type ChartSpec added in v0.15.0

type ChartSpec struct {
	Name       string `yaml:"name"`
	Version    string `yaml:"version"`
	Repository string `yaml:"repository"` // "oci://..." or "https://..."
}

ChartSpec defines a Helm chart from which images should be discovered.

type ChartTargetSpec added in v0.15.0

type ChartTargetSpec struct {
	Registry string `yaml:"registry"` // OCI registry for patched charts (e.g. "oci://ghcr.io/myorg/charts")
}

ChartTargetSpec defines where to push patched wrapper charts.

type ImageSpec

type ImageSpec struct {
	Name          string      `yaml:"name"`
	Image         string      `yaml:"image"`
	ChiselRelease string      `yaml:"chiselRelease,omitempty"`
	Tags          TagStrategy `yaml:"tags"`
	Target        TargetSpec  `yaml:"target,omitempty"`
	Platforms     []string    `yaml:"platforms,omitempty"`
}

ImageSpec defines the configuration for patching a single image.

type OverrideSpec added in v0.15.0

type OverrideSpec struct {
	From      string `yaml:"from"`
	To        string `yaml:"to"`
	ValuePath string `yaml:"valuePath,omitempty"` // Explicit values.yaml path for image override (e.g. "controller.image")
}

OverrideSpec defines a tag variant substitution for chart-discovered images. From and To are substrings of the image tag (e.g., From: "distroless-libc", To: "debian").

type PatchConfig

type PatchConfig struct {
	APIVersion    string                  `yaml:"apiVersion"`
	Kind          string                  `yaml:"kind"`
	ChiselRelease string                  `yaml:"chiselRelease,omitempty"`
	Target        TargetSpec              `yaml:"target,omitempty"`      // Default target for all images
	Charts        []ChartSpec             `yaml:"charts,omitempty"`      // Helm charts to discover images from
	ChartTarget   *ChartTargetSpec        `yaml:"chartTarget,omitempty"` // Where to push patched wrapper charts
	Overrides     map[string]OverrideSpec `yaml:"overrides,omitempty"`   // Tag variant overrides for chart images
	Images        []ImageSpec             `yaml:"images,omitempty"`      // Explicitly listed images
}

PatchConfig represents the top-level structure for the bulk patching configuration.

type TagStrategy

type TagStrategy struct {
	Strategy string   `yaml:"strategy"`
	Pattern  string   `yaml:"pattern,omitempty"`
	MaxTags  int      `yaml:"maxTags,omitempty"`
	List     []string `yaml:"list,omitempty"`
	Exclude  []string `yaml:"exclude,omitempty"`
	// contains filtered or unexported fields
}

TagStrategy defines the method for discovering image tags to be patched.

func (*TagStrategy) UnmarshalYAML

func (t *TagStrategy) UnmarshalYAML(unmarshal func(interface{}) error) error

type TargetSpec

type TargetSpec struct {
	Registry string `yaml:"registry,omitempty"` // Target registry/namespace prefix (e.g., "ghcr.io/myorg")
	Tag      string `yaml:"tag,omitempty"`      // Tag template (defaults to "{{ .SourceTag }}-patched")
}

TargetSpec defines how the patched image should be tagged and where it should be pushed.

Jump to

Keyboard shortcuts

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