From 9b01077223e6ee00c508a3457c77c8e2e2b622cd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 13:57:28 +0000 Subject: [PATCH 1/3] Initial plan From 42010ad26906f6a1445d02e52ca40fe0ec24d708 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 13:59:31 +0000 Subject: [PATCH 2/3] docs: document replaceall usage under versionFilter for regex and regex/semver kinds Co-authored-by: gionn <71768+gionn@users.noreply.github.com> --- content/en/docs/plugins/_versionFilter.adoc | 46 +++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/content/en/docs/plugins/_versionFilter.adoc b/content/en/docs/plugins/_versionFilter.adoc index 2c5fdf891..ec58609bc 100644 --- a/content/en/docs/plugins/_versionFilter.adoc +++ b/content/en/docs/plugins/_versionFilter.adoc @@ -57,6 +57,9 @@ If `versionFilter.kind` is set to `regex` then we can use `versionFilter.pattern return the newest version returned from a resource matching the regex If no versionFilter.pattern is provided then it uses '.*' which return the newest version +`versionFilter.replaceall` can optionally be used to transform version strings before the regex is applied. +It accepts a `pattern` (regex) and a `replacement` string, similar to a find-and-replace operation. + ``` sources: kubectl: @@ -74,6 +77,26 @@ sources: ``` => Return the newest kubectl version matching pattern "kubernetes-1.(\\d*).(\\d*)$" and remove "kubernetes-" from it +===== Example with replaceall + +Some projects use version tags that are not directly compatible with the regex pattern. For example, curl uses tags like `curl-8_11_1` where underscores separate version components. The `replaceall` option can be used to normalize these tags before applying the regex. + +```yaml +sources: + curl: + kind: githubRelease + spec: + owner: "curl" + repository: "curl" + versionFilter: + kind: regex + regex: 'curl-(\d+\.\d+\.\d+)' + replaceall: + pattern: "_" + replacement: "." +``` +=> The `replaceall` converts `curl-8_11_1` to `curl-8.11.1` before matching, then the regex extracts `8.11.1` + ==== semver If `versionFilter.kind` is set to `semver` then we can use `versionFilter.pattern` to specify version pattern as explained link:https://github.com/Masterminds/semver#checking-version-constraints[here]. In the process we also sort. @@ -108,6 +131,9 @@ We can then use `versionFilter.pattern` to specify version pattern as explained If no `versionFilter.pattern` is provided then it fallback to '*' which return the newest version. If a extracted version doesn't respect semantic versioning, then it's not the value is just ignored. +`versionFilter.replaceall` can optionally be used to transform version strings before the regex is applied. +It accepts a `pattern` (regex) and a `replacement` string, similar to a find-and-replace operation. + ===== Example ``` @@ -125,6 +151,26 @@ sources: ``` => Return the version "4.5.3" +===== Example with replaceall + +Some projects use version tags that are not directly compatible with the regex pattern. For example, curl uses tags like `curl-8_11_1` where underscores separate version components. The `replaceall` option can be used to normalize these tags before applying the regex. + +```yaml +sources: + curl: + kind: githubRelease + spec: + owner: "curl" + repository: "curl" + versionFilter: + kind: regex/semver + regex: 'curl-(\d+\.\d+\.\d+)' + replaceall: + pattern: "_" + replacement: "." +``` +=> The `replaceall` converts `curl-8_11_1` to `curl-8.11.1` before matching, then the regex extracts `8.11.1` and applies semver sorting/filtering + ==== regex/time If `versionFilter.kind` is set to `regex/time` then we can use `versionFilter.regex` to specify a regular expression to extract dates. From faffdbb93f7cb15748c8eeaa5dcb6bc6aab6fe7f Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo <71768+gionn@users.noreply.github.com> Date: Wed, 25 Feb 2026 15:05:32 +0100 Subject: [PATCH 3/3] avoid duplicating the sections. --- content/en/docs/plugins/_versionFilter.adoc | 25 ++++----------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/content/en/docs/plugins/_versionFilter.adoc b/content/en/docs/plugins/_versionFilter.adoc index ec58609bc..4c2db0225 100644 --- a/content/en/docs/plugins/_versionFilter.adoc +++ b/content/en/docs/plugins/_versionFilter.adoc @@ -79,7 +79,9 @@ sources: ===== Example with replaceall -Some projects use version tags that are not directly compatible with the regex pattern. For example, curl uses tags like `curl-8_11_1` where underscores separate version components. The `replaceall` option can be used to normalize these tags before applying the regex. +Some projects use version tags that are not directly compatible with the regex pattern. For example, curl uses tags like +`curl-8_11_1` where underscores separate version components. +The `replaceall` option can be used to normalize these tags before applying the regex. ```yaml sources: @@ -133,6 +135,7 @@ If a extracted version doesn't respect semantic versioning, then it's not the va `versionFilter.replaceall` can optionally be used to transform version strings before the regex is applied. It accepts a `pattern` (regex) and a `replacement` string, similar to a find-and-replace operation. +See the [regex section](#_regexp) for an example. ===== Example @@ -151,26 +154,6 @@ sources: ``` => Return the version "4.5.3" -===== Example with replaceall - -Some projects use version tags that are not directly compatible with the regex pattern. For example, curl uses tags like `curl-8_11_1` where underscores separate version components. The `replaceall` option can be used to normalize these tags before applying the regex. - -```yaml -sources: - curl: - kind: githubRelease - spec: - owner: "curl" - repository: "curl" - versionFilter: - kind: regex/semver - regex: 'curl-(\d+\.\d+\.\d+)' - replaceall: - pattern: "_" - replacement: "." -``` -=> The `replaceall` converts `curl-8_11_1` to `curl-8.11.1` before matching, then the regex extracts `8.11.1` and applies semver sorting/filtering - ==== regex/time If `versionFilter.kind` is set to `regex/time` then we can use `versionFilter.regex` to specify a regular expression to extract dates.