update

package
v1.25.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FSRoot is a relative (to scripts in subfolders) root folder of local filesystem repo to update
	FSRoot = "../../../"
)

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, schema map[string]Item, data interface{}, prBranchPrefix, prTitle string, prIssue int)

Apply applies concrete update plan (schema + data) to GitHub or local filesystem repo

func CRUpdateAll

func CRUpdateAll(ctx context.Context, image, version string) (updated bool)

CRUpdateAll updates all registries, and returns if at least one got updated.

func GHReleases

func GHReleases(ctx context.Context, owner, repo string) (stable, latest, edge string, err error)

GHReleases returns greatest current stable release and greatest latest rc or beta pre-release from GitHub owner/repo repository, and any error occurred. If latest pre-release version is lower than the current stable release, then it will return current stable release for both.

func GetPlan

func GetPlan(schema map[string]Item, data interface{}) (plan map[string]Item, prettyprint string, err error)

GetPlan returns concrete plan replacing placeholders in schema with actual data values, returns JSON-formatted representation of the plan and any error occurred.

func Loadf added in v1.16.0

func Loadf(path string) []byte

Loadf returns the file content read as byte slice

func ParseTmpl added in v1.16.0

func ParseTmpl(text string, data interface{}, name string) (string, error)

ParseTmpl replaces placeholders in text with actual data values

func PullImage

func PullImage(ctx context.Context, current, release string) (image string, err error)

PullImage checks if current image exists locally, tries to pull it if not, and returns reference image url and any error occurred.

func Run

func Run(cmd *exec.Cmd, stdin io.Reader) error

Run runs command cmd with stdin

func RunWithRetryNotify

func RunWithRetryNotify(ctx context.Context, cmd *exec.Cmd, stdin io.Reader, maxTime time.Duration, maxRetries uint64) error

RunWithRetryNotify runs command cmd with stdin using exponential backoff for maxTime duration up to maxRetries (negative values will make it ignored), notifies about any intermediary errors and return any final error. similar to pkg/util/retry/retry.go:Expo(), just for commands with params and also with context

func TagImage

func TagImage(ctx context.Context, image, current, stable string) error

TagImage tags local image:current with stable version, and returns any error occurred.

Types

type Item

type Item struct {
	Content []byte            `json:"-"`
	Replace map[string]string `json:"replace"`
}

Item defines Content where all occurrences of each Replace map key, corresponding to GitHub TreeEntry.Path and/or local filesystem repo file path (prefixed with FSRoot), would be swapped with its respective actual map value (having placeholders replaced with data), creating a concrete update plan. Replace map keys can use RegExp and map values can use Golang Text Template.

Jump to

Keyboard shortcuts

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