root package - github.com/csirmazbendeguz/regclient/cmd/regsync/root - Go Packages

root

package
v0.0.0-...-82ab6d4 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UserAgent sets the header on http requests
	UserAgent = "regclient/regsync"
)

Variables

View Source
var (
	// ErrCanceled is used when context is canceled before task completes
	ErrCanceled = errors.New("task was canceled")
	// ErrInvalidInput indicates a required field is invalid
	ErrInvalidInput = errors.New("invalid input")
	// ErrMissingInput indicates a required field is missing
	ErrMissingInput = errors.New("required input missing")
	// ErrNotImplemented returned when method has not been implemented yet
	ErrNotImplemented = errors.New("not implemented")
	// ErrNotFound when anything else isn't found
	ErrNotFound = errors.New("not found")
	// ErrUnsupportedConfigVersion happens when config file version is greater than this command supports
	ErrUnsupportedConfigVersion = errors.New("unsupported config version")
)

Functions

func ConfigWrite

func ConfigWrite(c *Config, w io.Writer) error

ConfigWrite outputs the processed config

func NewRootCmd

func NewRootCmd() (*cobra.Command, *rootOpts)

Types

type Config

type Config struct {
	Version  int            `yaml:"version" json:"version"`
	Creds    []config.Host  `yaml:"creds" json:"creds"`
	Defaults ConfigDefaults `yaml:"defaults" json:"defaults"`
	Sync     []ConfigSync   `yaml:"sync" json:"sync"`
}

Config is parsed configuration file for regsync

func ConfigLoadFile

func ConfigLoadFile(filename string) (*Config, error)

ConfigLoadFile loads the config from a specified filename

func ConfigLoadReader

func ConfigLoadReader(r io.Reader) (*Config, error)

ConfigLoadReader reads the config from an io.Reader

func ConfigNew

func ConfigNew() *Config

ConfigNew creates an empty configuration

type ConfigDefaults

type ConfigDefaults struct {
	Backup          string                 `yaml:"backup" json:"backup"`
	Interval        time.Duration          `yaml:"interval" json:"interval"`
	Schedule        string                 `yaml:"schedule" json:"schedule"`
	RateLimit       ConfigRateLimit        `yaml:"ratelimit" json:"ratelimit"`
	Parallel        int                    `yaml:"parallel" json:"parallel"`
	DigestTags      *bool                  `yaml:"digestTags" json:"digestTags"`
	Referrers       *bool                  `yaml:"referrers" json:"referrers"`
	ReferrerFilters []ConfigReferrerFilter `yaml:"referrerFilters" json:"referrerFilters"`
	ReferrerSrc     string                 `yaml:"referrerSource" json:"referrerSource"`
	ReferrerTgt     string                 `yaml:"referrerTarget" json:"referrerTarget"`
	ReferrerSlow    *bool                  `yaml:"referrerSlow" json:"referrerSlow"`
	FastCheck       *bool                  `yaml:"fastCheck" json:"fastCheck"`
	ForceRecursive  *bool                  `yaml:"forceRecursive" json:"forceRecursive"`
	IncludeExternal *bool                  `yaml:"includeExternal" json:"includeExternal"`
	MediaTypes      []string               `yaml:"mediaTypes" json:"mediaTypes"`
	Hooks           ConfigHooks            `yaml:"hooks" json:"hooks"`
	// general options
	BlobLimit      int64         `yaml:"blobLimit" json:"blobLimit"`
	CacheCount     int           `yaml:"cacheCount" json:"cacheCount"`
	CacheTime      time.Duration `yaml:"cacheTime" json:"cacheTime"`
	SkipDockerConf bool          `yaml:"skipDockerConfig" json:"skipDockerConfig"`
	UserAgent      string        `yaml:"userAgent" json:"userAgent"`
}

ConfigDefaults is uses for general options and defaults for ConfigSync entries

type ConfigHook

type ConfigHook struct {
	Type   string   `yaml:"type" json:"type"`
	Params []string `yaml:"params" json:"params"`
}

ConfigHook identifies the hook type and params

type ConfigHooks

type ConfigHooks struct {
	Pre       *ConfigHook `yaml:"pre" json:"pre"`
	Post      *ConfigHook `yaml:"post" json:"post"`
	Unchanged *ConfigHook `yaml:"unchanged" json:"unchanged"`
}

ConfigHooks for commands that run during the sync

type ConfigRateLimit

type ConfigRateLimit struct {
	Min   int           `yaml:"min" json:"min"`
	Retry time.Duration `yaml:"retry" json:"retry"`
}

ConfigRateLimit is for rate limit settings

type ConfigReferrerFilter

type ConfigReferrerFilter struct {
	ArtifactType string            `yaml:"artifactType" json:"artifactType"`
	Annotations  map[string]string `yaml:"annotations" json:"annotations"`
}

type ConfigSync

type ConfigSync struct {
	Source          string                 `yaml:"source" json:"source"`
	Target          string                 `yaml:"target" json:"target"`
	Type            string                 `yaml:"type" json:"type"`
	Tags            TagAllowDeny           `yaml:"tags" json:"tags"`
	TagSets         []TagAllowDeny         `yaml:"tagSets" json:"tagSets"`
	Repos           RepoAllowDeny          `yaml:"repos" json:"repos"`
	DigestTags      *bool                  `yaml:"digestTags" json:"digestTags"`
	Referrers       *bool                  `yaml:"referrers" json:"referrers"`
	ReferrerFilters []ConfigReferrerFilter `yaml:"referrerFilters" json:"referrerFilters"`
	ReferrerSrc     string                 `yaml:"referrerSource" json:"referrerSource"`
	ReferrerTgt     string                 `yaml:"referrerTarget" json:"referrerTarget"`
	ReferrerSlow    *bool                  `yaml:"referrerSlow" json:"referrerSlow"`
	Platform        string                 `yaml:"platform" json:"platform"`
	Platforms       []string               `yaml:"platforms" json:"platforms"`
	FastCheck       *bool                  `yaml:"fastCheck" json:"fastCheck"`
	ForceRecursive  *bool                  `yaml:"forceRecursive" json:"forceRecursive"`
	IncludeExternal *bool                  `yaml:"includeExternal" json:"includeExternal"`
	Backup          string                 `yaml:"backup" json:"backup"`
	Interval        time.Duration          `yaml:"interval" json:"interval"`
	Schedule        string                 `yaml:"schedule" json:"schedule"`
	RateLimit       ConfigRateLimit        `yaml:"ratelimit" json:"ratelimit"`
	MediaTypes      []string               `yaml:"mediaTypes" json:"mediaTypes"`
	Hooks           ConfigHooks            `yaml:"hooks" json:"hooks"`
}

ConfigSync defines a source/target repository to sync

type RepoAllowDeny

type RepoAllowDeny struct {
	Allow []string `yaml:"allow" json:"allow"`
	Deny  []string `yaml:"deny" json:"deny"`
}

RepoAllowDeny is an allow and deny list of regex strings for repository names

type TagAllowDeny

type TagAllowDeny struct {
	Allow       []string `yaml:"allow" json:"allow"`
	Deny        []string `yaml:"deny" json:"deny"`
	SemverRange []string `yaml:"semverRange,omitempty" json:"semverRange,omitempty"` // array of semver constraints, e.g., [">=1.0.0 <2.0.0", ">=4.0.0"]
}

TagAllowDeny is an allow and deny list of regex strings for tags, with optional semver version range support

Jump to

Keyboard shortcuts

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