cmd

package
v0.0.0-...-80a0973 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoChange

func DoChange(change ChangeRequest) (result bool)

func Execute

func Execute()

func MatchGlob

func MatchGlob(input string, globString string) bool

MatchGlob accepts the input string and then the glob string, returns "if match" bool

func MatchRegex

func MatchRegex(input string, regexPattern string) bool

MatchRegex accepts a regex pattern then an input string

func ReadFile

func ReadFile(filePath string) ([]byte, string)

ReadFile will return the raw []byte content of a file

Types

type ChangeRequest

type ChangeRequest struct {
	Old          string    `json:"old"`
	New          string    `json:"new"`
	Time         time.Time `json:"time"`
	PatternValue string    `json:"patternValue"`
	PatternType  string    `json:"patternType"`
	Image        string    `json:"image"`
	File         string    `json:"file"`
}

ChangeRequest is an object recording what changed and when

func EvaluateIfImageShouldChangeGlob

func EvaluateIfImageShouldChangeGlob(
	currentTag string,
	cachedTagList []registry.TagInfo,
	patternValue string,
	image string,
	file string,
) (
	intent bool,
	cr ChangeRequest,
)

EvaluateIfImageShouldChangeGlob checks if a currentTag should be updated required: - currentTag (string) - []TagInfo list of tags from cache (candidates to be promoted) - glob-string (all tags must match) returns (intent bool, struct ChangeRecord{}) ChangeRecord? we can record the ChangeRecord in the DB for potential "undo" button (One day) this function will evaluate "created" timestamps to ensure it has the latest match glob tag NOTE: if the currentTag is not indexed in the cache (eg the tag disappeared from docker registry)

it will assume that **every tag is more recent than the current one**

func EvaluateIfImageShouldChangeRegex

func EvaluateIfImageShouldChangeRegex(
	currentTag string,
	cachedTagList []registry.TagInfo,
	patternValue string,
	image string,
	file string,
) (
	intent bool,
	cr ChangeRequest,
)

EvaluateIfImageShouldChangeRegex checks if a currentTag should be updated required: - currentTag (string) - []TagInfo list of tags from cache (candidates to be promoted) - glob-string (all tags must match) returns (intent bool, struct ChangeRecord{}) ChangeRecord? we can record the ChangeRecord in the DB for potential "undo" button this function will evaluate "created" timestamps to ensure it has the latest match glob tag NOTE: if the currentTag is not indexed in the cache (eg the tag disappeared from docker registry)

it will assume that **every tag is more recent than the current one**

type Daemon

type Daemon struct {
	// contains filtered or unexported fields
}

func New

func New() (d *Daemon, err error)

func (*Daemon) FindDockerImages

func (d *Daemon) FindDockerImages(fileList []string, name string) (result []string)

FindDockerImages returns sorted and unique list of all docker images Tags are stripped the docker registries must be configured

func (*Daemon) Start

func (d *Daemon) Start()

func (*Daemon) UpdateFileList

func (d *Daemon) UpdateFileList(gitRepo cfg.GitRepo)

UpdateFileList returns a list of files found in the gitoperations repo NOTE: updatePolicies with references to the specific gitRepo are required NOTE2: if it looks like a folder all files found underneath will be included TODO: how does this play with .gitoperations files? we probably want to filter+exclude them here TODO: might want to exclude tarballs and other kind of things also I guess..

type GitState

type GitState struct {
	Repo *git.Repository
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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