-
Notifications
You must be signed in to change notification settings - Fork 923
Expand file tree
/
Copy pathpull.go
More file actions
61 lines (56 loc) · 1.95 KB
/
Copy pathpull.go
File metadata and controls
61 lines (56 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package define
import (
"fmt"
)
// PullPolicy takes the value PullIfMissing, PullAlways, PullIfNewer, or PullNever.
// N.B.: the enumeration values for this type differ from those used by
// github.com/containers/common/pkg/config.PullPolicy (their zero values
// indicate different policies), so they are not interchangeable.
type PullPolicy int
const (
// PullIfMissing is one of the values that BuilderOptions.PullPolicy
// can take, signalling that the source image should be pulled from a
// registry if a local copy of it is not already present.
PullIfMissing PullPolicy = iota
// PullAlways is one of the values that BuilderOptions.PullPolicy can
// take, signalling that a fresh, possibly updated, copy of the image
// should be pulled from a registry before the build proceeds.
PullAlways
// PullIfNewer is one of the values that BuilderOptions.PullPolicy
// can take, signalling that the source image should only be pulled
// from a registry if a local copy is not already present or if a
// newer version the image is present on the repository.
PullIfNewer
// PullNever is one of the values that BuilderOptions.PullPolicy can
// take, signalling that the source image should not be pulled from a
// registry.
PullNever
)
// String converts a PullPolicy into a string.
func (p PullPolicy) String() string {
switch p {
case PullIfMissing:
return "missing"
case PullAlways:
return "always"
case PullIfNewer:
return "newer"
case PullNever:
return "never"
}
return fmt.Sprintf("unrecognized policy %d", p)
}
// PolicyMap maps from names of PullPolicy values (including aliases) to
// PullPolicy values.
var PolicyMap = map[string]PullPolicy{
"missing": PullIfMissing,
"ifmissing": PullIfMissing,
"notpresent": PullIfMissing,
"always": PullAlways,
"true": PullAlways,
"never": PullNever,
"false": PullNever,
"newer": PullIfNewer,
"ifnewer": PullIfNewer,
// This map is used by pkg/parse.pullPolicyWithFlags().
}