From b79b51a7151f430859dd56fe85fcbdbac7e86f7e Mon Sep 17 00:00:00 2001
From: Thomas George Hartland <thomas.george.hartland@cern.ch>
Date: Thu, 12 Mar 2020 15:25:56 +0100
Subject: [PATCH] Sync alpha and beta image tags

This is mainly for the hyperkube containers,
to be able to test Magnum with alpha/beta
Kubernetes versions.

The handling for quotes/commas is also removed
as jq with the -r flag doesn't output them.
---
 sync_image.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sync_image.sh b/sync_image.sh
index d498fea..fa1a4e8 100755
--- a/sync_image.sh
+++ b/sync_image.sh
@@ -8,7 +8,7 @@ upstream_json_resp="$(skopeo inspect docker://"${image}" | jq . -c)"
 upstream_repo_image=$(echo "${upstream_json_resp}" | jq .Name -r)
 image_name=$(basename "${upstream_repo_image}")
 upstream_image_repo=$(dirname "${upstream_repo_image}")
-tags_to_sync=$(echo "${upstream_json_resp}" | jq .RepoTags[] -r | egrep "^\"?v?([0-9]*)\.([0-9]*)\.([0-9]*)\"?\$"  | sed 's/\"//g' | sed 's/,//')
+tags_to_sync=$(echo "${upstream_json_resp}" | jq -r '.RepoTags[] | select(test("^v?([0-9]*)\\.([0-9]*)\\.([0-9]*)((-alpha\\.[0-9]*)|(-beta\\.[0-9]*))?$"))')
 
 # Get tags from CERN
 cern_json_resp="$(skopeo inspect docker://${CI_REGISTRY_IMAGE}/$(basename ${image}) | jq . -c)"
-- 
GitLab