Skip to content

Commit

Permalink
fix allow-dup flag as well
Browse files Browse the repository at this point in the history
  • Loading branch information
upodroid committed Jan 2, 2024
1 parent ca375e6 commit f7f23db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,21 +139,23 @@ 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()
imagesExist, imagesExistErr := images.Exists(bi.opts.Registry, version, bi.opts.Fast)
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
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/release/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit f7f23db

Please sign in to comment.