You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add multi-URL support and per-resolution url param to Hub Resolver
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>
Copy file name to clipboardExpand all lines: docs/hub-resolver.md
+67Lines changed: 67 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ Use resolver type `hub`.
18
18
|`kind`| Either `task` or `pipeline` (Optional) | Default: `task`|
19
19
|`name`| The name of the task or pipeline to fetch from the hub |`golang-build`|
20
20
|`version`| Version or a Constraint (see [below](#version-constraint) of a task or a pipeline to pull in from. Wrap the number in quotes! |`"0.5.0"`, `">= 0.5.0"`|
21
+
|`url`| Custom hub API endpoint to query instead of the cluster-configured default (Optional). Must be an absolute HTTP or HTTPS URL. Overrides all other URL configuration (ConfigMap URL lists, environment variables, and defaults). |`https://internal-hub.example.com`|
21
22
22
23
The Catalogs in the Artifact Hub follows the semVer (i.e.` <major-version>.<minor-version>.0`) and the Catalogs in the Tekton Hub follows the simplified semVer (i.e. `<major-version>.<minor-version>`). Both full and simplified semantic versioning will be accepted by the `version` parameter. The Hub Resolver will map the version to the format expected by the target Hub `type`.
23
24
@@ -44,6 +45,8 @@ for the name, namespace and defaults that the resolver ships with.
44
45
|`default-artifact-hub-pipeline-catalog`| The default artifact hub catalog from where to pull the resource for pipeline kind. |`tekton-catalog-pipelines`|
45
46
|`default-kind`| The default object kind for references. |`task`, `pipeline`|
46
47
|`default-type`| The default hub from where to pull the resource. |`artifact`, `tekton`|
48
+
|`artifact-hub-urls`| Ordered YAML list of Artifact Hub API URLs to try. First successful response wins. If not set, the `ARTIFACT_HUB_API` env var or default is used. | See [below](#configuring-multiple-hub-urls)|
49
+
|`tekton-hub-urls`| Ordered YAML list of Tekton Hub API URLs to try. First successful response wins. If not set, the `TEKTON_HUB_API` env var is used. | See [below](#configuring-multiple-hub-urls)|
47
50
48
51
### Configuring the Hub API endpoint
49
52
@@ -128,6 +131,70 @@ spec:
128
131
# overall will not succeed without those parameters.
129
132
```
130
133
134
+
### Task Resolution from a Private Hub
135
+
136
+
```yaml
137
+
apiVersion: tekton.dev/v1beta1
138
+
kind: TaskRun
139
+
metadata:
140
+
name: private-hub-task-reference
141
+
spec:
142
+
taskRef:
143
+
resolver: hub
144
+
params:
145
+
- name: url
146
+
value: https://internal-hub.example.com
147
+
- name: catalog
148
+
value: my-team-catalog
149
+
- name: type
150
+
value: artifact
151
+
- name: kind
152
+
value: task
153
+
- name: name
154
+
value: my-task
155
+
- name: version
156
+
value: "1.0.0"
157
+
```
158
+
159
+
When the `url` parameter is not specified, the resolver falls back to the
160
+
cluster-configured defaults: first checking the ConfigMap URL lists
161
+
(`artifact-hub-urls` / `tekton-hub-urls`), then the environment variables
162
+
(`ARTIFACT_HUB_API` / `TEKTON_HUB_API`). This allows Pipeline authors to
163
+
explicitly choose which hub instance to query on a per-resolution basis, which
164
+
is useful in multi-team environments or air-gapped deployments where resources
165
+
are hosted on private hub instances.
166
+
167
+
### Configuring Multiple Hub URLs
168
+
169
+
You can configure multiple hub API URLs in the `hubresolver-config` ConfigMap.
170
+
The resolver will try each URL in order and return the first successful result.
171
+
This is useful for layered catalogs, multi-team environments, or air-gapped
172
+
deployments where resources may exist on different hub instances.
173
+
174
+
```yaml
175
+
apiVersion: v1
176
+
kind: ConfigMap
177
+
metadata:
178
+
name: hubresolver-config
179
+
namespace: tekton-pipelines-resolvers
180
+
data:
181
+
artifact-hub-urls: |
182
+
- https://internal-hub.example.com/
183
+
- https://artifacthub.io/
184
+
tekton-hub-urls: |
185
+
- https://internal-tekton-hub.example.com/
186
+
- https://api.hub.tekton.dev/
187
+
```
188
+
189
+
**URL precedence** (highest to lowest):
190
+
1. Per-resolution `url` parameter — single URL override for a specific resolution request
191
+
2. ConfigMap URL lists (`artifact-hub-urls` / `tekton-hub-urls`) — tried in order, first success wins
192
+
3. Environment variable (`ARTIFACT_HUB_API` / `TEKTON_HUB_API`) — single URL fallback
193
+
4. Default URL (`https://artifacthub.io` for artifact type)
194
+
195
+
If the ConfigMap URL list keys are not set (commented out by default), the
196
+
resolver behaves exactly as before, using the environment variable or default URL.
197
+
131
198
### Version constraint
132
199
133
200
Instead of a version you can specify a constraint to choose from. The constraint is a string as documented in the [go-version](https://github.com/hashicorp/go-version) library.
0 commit comments