diff --git a/pkg/build/ci.go b/pkg/build/ci.go index 11ee3fd824b..f6642dc5290 100644 --- a/pkg/build/ci.go +++ b/pkg/build/ci.go @@ -139,12 +139,14 @@ func (bi *Instance) checkBuildExists() (bool, error) { // TODO: Do we need to handle the errors more effectively? existErrors := []error{} + foundItems := 0 for _, path := range gcsBuildPaths { logrus.Infof("Checking if GCS build path (%s) exists", path) exists, existErr := bi.objStore.PathExists(path) if existErr != nil || !exists { existErrors = append(existErrors, existErr) } + foundItems++ } images := release.NewImages() @@ -152,8 +154,8 @@ func (bi *Instance) checkBuildExists() (bool, error) { if imagesExistErr != nil { existErrors = append(existErrors, imagesExistErr) } - - if imagesExist && len(existErrors) == 0 { + // we are expecting atleast 3 items to be found; /version folder, kubernetes.tgz and /version/bin folder + if imagesExist && len(existErrors) == 0 && foundItems >= 3 && !bi.opts.AllowDup { logrus.Infof("Build already exists. Exiting...") return true, nil } diff --git a/pkg/release/images.go b/pkg/release/images.go index 051eefdf85e..5ad4698d623 100644 --- a/pkg/release/images.go +++ b/pkg/release/images.go @@ -298,6 +298,10 @@ func (i *Images) Validate(registry, version, buildPath string) error { // existence of a local build directory. Used in CI builds to quickly validate // if a build is actually required. func (i *Images) Exists(registry, version string, fast bool) (bool, error) { + if registry == "" { + logrus.Info("no image registry was supplied, assuming no images are being pushed") + return true, nil + } logrus.Infof("Validating image manifests in %s", registry) version = i.normalizeVersion(version)