imagepatch

package
v2.10.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package imagepatch contains shared types for Copacetic-based image patching.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PatchMode

type PatchMode string

PatchMode describes how package updates for a patch run were determined.

const (
	// PatchModeUpdateAll patches every outdated OS package in the image.
	PatchModeUpdateAll PatchMode = "update-all"
	// PatchModeReport patches only packages flagged by a vulnerability scan report.
	PatchModeReport PatchMode = "report"
)

type PatchOptions

type PatchOptions struct {
	// Suffix overrides the configured patched-tag suffix (e.g. "patched").
	Suffix string `json:"suffix,omitempty" doc:"Suffix appended to the source tag for the patched image"`
	// PatchedTag fully overrides the patched tag (takes precedence over Suffix).
	PatchedTag string `json:"patchedTag,omitempty" doc:"Explicit tag for the patched image"`
	// TimeoutSeconds overrides the configured patch timeout.
	TimeoutSeconds int `json:"timeoutSeconds,omitempty" doc:"Timeout for the patch operation in seconds"`
	// ScanID selects a stored vulnerability scan whose report drives the patch.
	// When empty, all outdated OS packages are updated.
	ScanID string `json:"scanId,omitempty" doc:"Vulnerability scan ID to patch from; empty patches all outdated packages"`
	// IgnoreErrors continues patching remaining packages when one fails.
	IgnoreErrors bool `json:"ignoreErrors,omitempty" doc:"Continue patching when individual package updates fail"`
}

PatchOptions are the caller-provided options for patching an image.

type PatchRecord

type PatchRecord struct {
	ID              string      `json:"id"`
	EnvironmentID   string      `json:"environmentId"`
	OriginalImageID string      `json:"originalImageId"`
	OriginalRef     string      `json:"originalRef"`
	OriginalDigest  string      `json:"originalDigest,omitempty"`
	PatchedRef      string      `json:"patchedRef"`
	Mode            PatchMode   `json:"mode"`
	Status          PatchStatus `json:"status"`
	PackagesUpdated *int        `json:"packagesUpdated,omitempty"`
	Error           *string     `json:"error,omitempty"`
	ActivityID      *string     `json:"activityId,omitempty"`
	DurationMs      *int64      `json:"durationMs,omitempty"`
	CreatedAt       time.Time   `json:"createdAt"`
	UpdatedAt       *time.Time  `json:"updatedAt,omitempty"`
}

PatchRecord describes one image patch run.

type PatchScanSummary

type PatchScanSummary struct {
	Status       string    `json:"status"`
	FixableCount int       `json:"fixableCount"`
	TotalCount   int       `json:"totalCount"`
	ScanTime     time.Time `json:"scanTime"`
}

PatchScanSummary is the scan outcome of a patched image, used to verify a patch actually removed the fixable vulnerabilities.

type PatchStatus

type PatchStatus string

PatchStatus is the lifecycle state of a patch run.

const (
	PatchStatusPatching  PatchStatus = "patching"
	PatchStatusCompleted PatchStatus = "completed"
	PatchStatusFailed    PatchStatus = "failed"
)

type PatchTarget

type PatchTarget struct {
	ImageID      string    `json:"imageId"`
	ImageRef     string    `json:"imageRef"`
	FixableCount int       `json:"fixableCount"`
	TotalCount   int       `json:"totalCount"`
	ScanTime     time.Time `json:"scanTime"`
	// LocalOnly marks images that were built locally and never pushed or
	// pulled; they have no registry source, so they cannot be patched.
	LocalOnly     bool              `json:"localOnly,omitempty"`
	LastPatch     *PatchRecord      `json:"lastPatch,omitempty"`
	LastPatchScan *PatchScanSummary `json:"lastPatchScan,omitempty"`
}

PatchTarget describes a scanned image from the patching point of view: how many of its vulnerabilities are fixable and what the latest patch run did.

Jump to

Keyboard shortcuts

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