podman
50 строк · 1.4 Кб
1package define2
3import (4"fmt"5)
6
7// PullPolicy takes the value PullIfMissing, PullAlways, PullIfNewer, or PullNever.
8type PullPolicy int9
10const (11// PullIfMissing is one of the values that BuilderOptions.PullPolicy12// can take, signalling that the source image should be pulled from a13// registry if a local copy of it is not already present.14PullIfMissing PullPolicy = iota15// PullAlways is one of the values that BuilderOptions.PullPolicy can16// take, signalling that a fresh, possibly updated, copy of the image17// should be pulled from a registry before the build proceeds.18PullAlways
19// PullIfNewer is one of the values that BuilderOptions.PullPolicy20// can take, signalling that the source image should only be pulled21// from a registry if a local copy is not already present or if a22// newer version the image is present on the repository.23PullIfNewer
24// PullNever is one of the values that BuilderOptions.PullPolicy can25// take, signalling that the source image should not be pulled from a26// registry.27PullNever
28)
29
30// String converts a PullPolicy into a string.
31func (p PullPolicy) String() string {32switch p {33case PullIfMissing:34return "missing"35case PullAlways:36return "always"37case PullIfNewer:38return "ifnewer"39case PullNever:40return "never"41}42return fmt.Sprintf("unrecognized policy %d", p)43}
44
45var PolicyMap = map[string]PullPolicy{46"missing": PullIfMissing,47"always": PullAlways,48"never": PullNever,49"ifnewer": PullIfNewer,50}
51