Skip to content

Add multi-URL support and per-resolution url param to Hub Resolver#9465

Open
ab-ghosh wants to merge 1 commit intotektoncd:mainfrom
ab-ghosh:hub-resolver-multi-url
Open

Add multi-URL support and per-resolution url param to Hub Resolver#9465
ab-ghosh wants to merge 1 commit intotektoncd:mainfrom
ab-ghosh:hub-resolver-multi-url

Conversation

@ab-ghosh
Copy link
Member

@ab-ghosh ab-ghosh commented Mar 2, 2026

  • Adds a per-resolution url parameter to the Hub Resolver, allowing Pipeline authors to explicitly target a specific hub instance (Option A from Support multiple Artifact Hub URLs in the Hub Resolver #9353)
  • Adds artifact-hub-urls / tekton-hub-urls ConfigMap keys for configuring multiple hub URLs with ordered fallback — first successful response
    wins (Option B from Support multiple Artifact Hub URLs in the Hub Resolver #9353)
  • Implements URL precedence: url param > ConfigMap URL lists > env var > default
  • Add unit tests for fallback, url override, error formatting
  • Add e2e tests for url param and version constraint resolution
  • Update docs with new param, ConfigMap options, and URL precedence

Changes

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

@tekton-robot tekton-robot added the release-note-none Denotes a PR that doesnt merit a release note. label Mar 2, 2026
@tekton-robot tekton-robot requested review from dibyom and khrm March 2, 2026 08:34
@tekton-robot tekton-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Mar 2, 2026
@ab-ghosh
Copy link
Member Author

ab-ghosh commented Mar 2, 2026

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 2, 2026
@ab-ghosh ab-ghosh force-pushed the hub-resolver-multi-url branch from 8ba1f36 to ea7a4f2 Compare March 2, 2026 08:41
@waveywaves waveywaves self-assigned this Mar 2, 2026
// Precedence: ConfigMap YAML list > env var URL.
func resolveHubURLs(conf map[string]string, envVarURL, configKey string) []string {
if yamlStr, ok := conf[configKey]; ok && strings.TrimSpace(yamlStr) != "" {
urls, err := parseURLList(yamlStr)
Copy link
Member

Choose a reason for hiding this comment

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

if parseURLList fails here (bad YAML in the ConfigMap), the error gets swallowed and we silently fall back to the env var URL. Could be confusing for an operator who thinks they configured multi-URL but has a YAML typo. Could we at least log a warning so there's a breadcrumb?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah sure, will add a warning log here.

return nil, fmt.Errorf("failed to parse URL list: %w", err)
}
for i, u := range urls {
urls[i] = strings.TrimRight(strings.TrimSpace(u), "/")
Copy link
Member

Choose a reason for hiding this comment

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

ConfigMap URLs from parseURLList don't go through any scheme validation. The url param gets checked for http/https in validateParams (resolver.go:368-376), but a ConfigMap entry like ftp://example.com would pass through unchecked. Worth adding the same validation here, and then documenting the constraint in hub-resolver.md alongside the ConfigMap options

Copy link
Member Author

Choose a reason for hiding this comment

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

My understanding was that the ConfigMap URLs will usually be handled by the admins, while the url param is passed by the user, so I added the scheme validation there. Because of that I thought we could skip the validation for ConfigMap URLs. But yeah, it makes sense to keep the validation consistent there as well. I will add the same scheme validation for the ConfigMap URLs.

@ab-ghosh ab-ghosh force-pushed the hub-resolver-multi-url branch from ea7a4f2 to bde40b1 Compare March 5, 2026 18:53
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please ask for approval from waveywaves after the PR has been reviewed.

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

Details 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

@ab-ghosh ab-ghosh requested a review from waveywaves March 5, 2026 18:57
  Implements per-resolution  parameter
  for explicit hub selection and ConfigMap-based URL lists with ordered
  fallback for cluster-level defaults.

  - Add  param for per-resolution hub endpoint override
  - Add  /  ConfigMap keys for
    ordered URL lists with first-success-wins fallback
  - Use TrimRight for trailing slash stripping on ConfigMap URLs
  - Add unit tests for fallback, url override, error formatting
  - Add e2e tests for url param and version constraint resolution
  - Update docs with new param, ConfigMap options, and URL precedence

Signed-off-by: ab-ghosh <abghosh@redhat.com>
@ab-ghosh ab-ghosh force-pushed the hub-resolver-multi-url branch from bde40b1 to af9fe92 Compare March 6, 2026 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature. release-note-none Denotes a PR that doesnt merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants