aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/containers/buildah/pkg/cli/common.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/containers/buildah/pkg/cli/common.go')
-rw-r--r--vendor/github.com/containers/buildah/pkg/cli/common.go20
1 files changed, 14 insertions, 6 deletions
diff --git a/vendor/github.com/containers/buildah/pkg/cli/common.go b/vendor/github.com/containers/buildah/pkg/cli/common.go
index e8979cd7f..6f49cc240 100644
--- a/vendor/github.com/containers/buildah/pkg/cli/common.go
+++ b/vendor/github.com/containers/buildah/pkg/cli/common.go
@@ -63,6 +63,7 @@ type BudResults struct {
Platform string
Pull bool
PullAlways bool
+ PullNever bool
Quiet bool
Rm bool
Runtime string
@@ -159,8 +160,9 @@ func GetBudFlags(flags *BudResults) pflag.FlagSet {
fs.StringVar(&flags.Logfile, "logfile", "", "log to `file` instead of stdout/stderr")
fs.IntVar(&flags.Loglevel, "loglevel", 0, "adjust logging level (range from -2 to 3)")
fs.StringVar(&flags.Platform, "platform", "", "CLI compatibility: no action or effect")
- fs.BoolVar(&flags.Pull, "pull", true, "pull the image if not present")
- fs.BoolVar(&flags.PullAlways, "pull-always", false, "pull the image, even if a version is present")
+ fs.BoolVar(&flags.Pull, "pull", true, "pull the image from the registry if newer or not present in store, if false, only pull the image if not present")
+ fs.BoolVar(&flags.PullAlways, "pull-always", false, "pull the image even if the named image is present in store")
+ fs.BoolVar(&flags.PullNever, "pull-never", false, "do not pull the image, use the image present in store if available")
fs.BoolVarP(&flags.Quiet, "quiet", "q", false, "refrain from announcing build instructions and image read/write progress")
fs.BoolVar(&flags.Rm, "rm", true, "Remove intermediate containers after a successful build")
// "runtime" definition moved to avoid name collision in podman build. Defined in cmd/buildah/bud.go.
@@ -265,9 +267,15 @@ func VerifyFlagsArgsOrder(args []string) error {
}
func GetDefaultAuthFile() string {
- authfile := os.Getenv("REGISTRY_AUTH_FILE")
- if authfile != "" {
- return authfile
+ return os.Getenv("REGISTRY_AUTH_FILE")
+}
+
+func CheckAuthFile(authfile string) error {
+ if authfile == "" {
+ return nil
}
- return ""
+ if _, err := os.Stat(authfile); err != nil {
+ return errors.Wrapf(err, "error checking authfile path %s", authfile)
+ }
+ return nil
}