From 25b27ad37dbe1b4976aead83e0f0a29ef3304ca1 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Mon, 27 Sep 2021 12:35:42 +0200 Subject: [PATCH] Keep optionally a way to pull from the image list Signed-off-by: Ettore Di Giacinto --- .github/build.go | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/build.go b/.github/build.go index e2025e3f65d..08ab1e4b587 100644 --- a/.github/build.go +++ b/.github/build.go @@ -193,11 +193,24 @@ func main() { if os.Getenv("DOWNLOAD_ALL") == "true" { fmt.Println("Downloading all available metadata files on the remote repository") var err error - for _, t := range currentPackages.Packages { - img := fmt.Sprintf("%s:%s.metadata.yaml", finalRepo, t.ImageTag()) - fmt.Println("Downloading", img) - err = multierror.Append(err, downloadImage(img, "build")) + if os.Getenv("DOWNLOAD_FROM_LIST") == "true" { + tags, err := imageTags(finalRepo) + checkErr(err) + for _, t := range tags { + if strings.HasSuffix(t, ".metadata.yaml") { + img := fmt.Sprintf("%s:%s", finalRepo, t) + fmt.Println("Downloading", img) + err = multierror.Append(err, downloadImage(img, "build")) + } + } + } else { + for _, t := range currentPackages.Packages { + img := fmt.Sprintf("%s:%s.metadata.yaml", finalRepo, t.ImageTag()) + fmt.Println("Downloading", img) + err = multierror.Append(err, downloadImage(img, "build")) + } } + if err != nil { // We might not want to always be strict, but we might relax because // there might be occasions when we remove images from registries due