Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the regex to match image in koparse #3434

Merged
merged 1 commit into from
Oct 22, 2020

Conversation

afrittoli
Copy link
Member

Changes

The regex to parse images does not include '/' after the base
registry. We should not require passing the registry with a
trailing '/', so adding it in the regex instead.

Signed-off-by: Andrea Frittoli [email protected]

/kind misc

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Double check this list of stuff that's easy to miss:

Reviewer Notes

If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.

Release Notes

NONE

@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. kind/misc Categorizes issue or PR as a miscellaneuous one. labels Oct 22, 2020
@tekton-robot tekton-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 22, 2020
@afrittoli
Copy link
Member Author

/cc @vdemeester

@vdemeester
Copy link
Member

diff --git a/tekton/koparse/koparse.py b/tekton/koparse/koparse.py
index 950259b6..7b6289b1 100755
--- a/tekton/koparse/koparse.py
+++ b/tekton/koparse/koparse.py
@@ -60,7 +60,7 @@ 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\-]+" + DIGEST_MARKER + r":[0-9a-f]*")
+    pattern = re.compile(base + r"[0-9a-z\-/:]+" + DIGEST_MARKER + r":[0-9a-f]*")
     with open(path) as f:
         for line in f:
             found = re.findall(pattern, line)
diff --git a/tekton/koparse/test_koparse.py b/tekton/koparse/test_koparse.py
index 200b72af..d20a6366 100755
--- a/tekton/koparse/test_koparse.py
+++ b/tekton/koparse/test_koparse.py
@@ -13,14 +13,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/creds-init@sha256:67448da79e4731ab534b91df08da547bc434ab08e41d905858f2244e70290f48",
+    "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/creds-init:a-tag@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/creds-init",
+    "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/creds-init:a-tag",
     "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init",
     "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/controller",
     "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/webhook",
diff --git a/tekton/koparse/test_release.yaml b/tekton/koparse/test_release.yaml
index 98a9b0e9..74205b6c 100644
--- a/tekton/koparse/test_release.yaml
+++ b/tekton/koparse/test_release.yaml
@@ -330,7 +330,7 @@ spec:
         "-logtostderr",
         "-stderrthreshold",
         "INFO",
-        "-kubeconfig-writer-image", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/kubeconfigwriter@sha256:68453f5bb4b76c0eab98964754114d4f79d3a50413872520d8919a6786ea2b35", "-creds-ige", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/creds-init@sha256:67448da79e4731ab534b91df08da547bc434ab08e41d905858f2244e70290f48",
+        "-kubeconfig-writer-image", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/kubeconfigwriter@sha256:68453f5bb4b76c0eab98964754114d4f79d3a50413872520d8919a6786ea2b35", "-creds-ige", "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/creds-init:a-tag@sha256:67448da79e4731ab534b91df08da547bc434ab08e41d905858f2244e70290f48",
         "-git-image",
         "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init@sha256:7d5520efa2d55e1346c424797988c541327ee52ef810a840b5c6f278a9de934a",
       ]

This should fix the nightlies

The regex to parse images does not include '/' after the base
registry. It does not take in account the possible tag before
the sha.

Changing the regex and updating tests accordingly.

Signed-off-by: Andrea Frittoli <[email protected]>
Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 22, 2020
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 22, 2020
@tekton-robot tekton-robot merged commit ceeec64 into tektoncd:master Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/misc Categorizes issue or PR as a miscellaneuous one. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesnt merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants