update

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 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(schema map[string]Item, data interface{})

Apply applies concrete update plan (schema + data) to 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 GetImageSHA added in v1.30.0

func GetImageSHA(image string) (string, error)

GetImageSHA gets the SHA of the provided image

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 ImageTagsFromDockerHub added in v1.33.0

func ImageTagsFromDockerHub(repo string) ([]string, error)

ImageTagsFromDockerHub returns the 100 latest image tags from Docker Hub for the provided repository

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 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 StableVersion added in v1.30.0

func StableVersion(ctx context.Context, owner, repo string) (string, error)

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
	Replace map[string]string
}

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.

type Release added in v1.30.0

type Release struct {
	Tag    string
	Commit string
}

func GHReleases

func GHReleases(ctx context.Context, owner, repo string) (stable, latest, edge Release, 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.

type Response added in v1.33.0

type Response struct {
	Results []struct {
		Name string `json:"name"`
	}
}

Response is used to unmarshal the response from Docker Hub

Jump to

Keyboard shortcuts

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