From 3e31262031c124a638c94c563dc7f8ef0471bc88 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Mon, 26 Oct 2020 14:17:51 +0100 Subject: [PATCH] tekton: port koparse fix to release-0.17.x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without porting those fixes to the release branch, we cannot do a release 😅 Signed-off-by: Vincent Demeester --- tekton/koparse/koparse.py | 7 ++++--- tekton/koparse/test_koparse.py | 4 ++-- tekton/koparse/test_release.yaml | 18 ++++++++---------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/tekton/koparse/koparse.py b/tekton/koparse/koparse.py index dda4e3dac13..d93305ec342 100755 --- a/tekton/koparse/koparse.py +++ b/tekton/koparse/koparse.py @@ -60,11 +60,12 @@ def parse_release(base: str, path: str) -> List[str]: list of the images parsed from the file """ images = [] + pattern = re.compile(base + r"[0-9a-z\-/\.]+(?::[0-9a-zA-Z\-\._]+)?" + DIGEST_MARKER + r":[0-9a-f]+") with open(path) as f: for line in f: - match = re.search(base + ".*" + DIGEST_MARKER + ":[0-9a-f]*", line) - if match: - images.append(match.group(0)) + found = re.findall(pattern, line) + for image in found: + images.append(image) return images diff --git a/tekton/koparse/test_koparse.py b/tekton/koparse/test_koparse.py index 200b72afc90..4b2271dda1b 100755 --- a/tekton/koparse/test_koparse.py +++ b/tekton/koparse/test_koparse.py @@ -12,14 +12,14 @@ PATH_TO_WRONG_FILE = os.path.join(os.path.dirname( os.path.abspath(__file__)), "koparse.py") BUILT_IMAGES = [ - "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/kubeconfigwriter@sha256:68453f5bb4b76c0eab98964754114d4f79d3a50413872520d8919a6786ea2b35", + "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/kubeconfigwriter:v20201022-ceeec6463e.1_1A@sha256:68453f5bb4b76c0eab98964754114d4f79d3a50413872520d8919a6786ea2b35", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/creds-init@sha256:67448da79e4731ab534b91df08da547bc434ab08e41d905858f2244e70290f48", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init@sha256:7d5520efa2d55e1346c424797988c541327ee52ef810a840b5c6f278a9de934a", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/controller@sha256:bdc6f22a44944c829983c30213091b60f490b41f89577e8492f6a2936be0df41", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/webhook@sha256:cca7069a11aaf0d9d214306d456bc40b2e33e5839429bf07c123ad964d495d8a", ] EXPECTED_IMAGES = [ - "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/kubeconfigwriter", + "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/kubeconfigwriter:v20201022-ceeec6463e.1_1A", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/creds-init", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/controller", diff --git a/tekton/koparse/test_release.yaml b/tekton/koparse/test_release.yaml index 66e32e87ba1..8012343b460 100644 --- a/tekton/koparse/test_release.yaml +++ b/tekton/koparse/test_release.yaml @@ -326,16 +326,14 @@ spec: app: tekton-pipelines-controller spec: containers: - - args: - - -logtostderr - - -stderrthreshold - - INFO - - -kubeconfig-writer-image - - gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/kubeconfigwriter@sha256:68453f5bb4b76c0eab98964754114d4f79d3a50413872520d8919a6786ea2b35 - - -creds-image - - gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/creds-init@sha256:67448da79e4731ab534b91df08da547bc434ab08e41d905858f2244e70290f48 - - -git-image - - gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init@sha256:7d5520efa2d55e1346c424797988c541327ee52ef810a840b5c6f278a9de934a + - args: [ + "-logtostderr", + "-stderrthreshold", + "INFO", + "-kubeconfig-writer-image", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/kubeconfigwriter:v20201022-ceeec6463e.1_1A@sha256:68453f5bb4b76c0eab98964754114d4f79d3a50413872520d8919a6786ea2b35", "-creds-ige", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/creds-init@sha256:67448da79e4731ab534b91df08da547bc434ab08e41d905858f2244e70290f48", + "-git-image", + "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init@sha256:7d5520efa2d55e1346c424797988c541327ee52ef810a840b5c6f278a9de934a", + ] image: gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/controller@sha256:bdc6f22a44944c829983c30213091b60f490b41f89577e8492f6a2936be0df41 name: tekton-pipelines-controller volumeMounts: