Supporting multiple catalog hubs in Pipelines-as-Code.
## Goals
- Let platform administrators setup multiple hub endpoint
Currently, Pipelines as Code allows customization of the catalog hub from where the tasks are fetched, using upstream hub as default.
Platforms Administrators may want to configure multiple catalog hubs to utilize tasks from different locations. For example, they might have their own set of tasks from their own hub and also want to use tasks from the official upstream Hub.
- Let the user specify the catalog hub from which they want to fetch tasks in the PipelineRun.
Users should be able to specify in the PipelineRun from which catalog hub they want to fetch tasks. This allows them to use tasks from different catalog hubs within the same PipelineRun.
## Non-Goals
This applies only to Pipelines as Code's remote resolution from hub feature using annotations and does not apply to the Tekton custom resolver feature.
## Design
An admin can configure multiple hubs within the Pipelines-as-Code Configmap.
The default configuration for fetching task from the hub isas follows:
```yaml
hub-catalog-name: tekton
hub-catalog-url: https://api.hub.tekton.dev/v1
```
When a user writes a PipelineRun with the annotation:
```
pipelinesascode.tekton.dev/task: "task"
```
the task will be fetched from the default hub.
If the cluster administrator wants to configure multiple hubs, they can add a setting in the configmap as follows:
```yaml=
catalog-1-id: anotherhub
catalog-1-name: tekton
catalog-1-url: https://api.other.com/v1
```
To use this hub, the user can write the following annotation in their PipelineRun:
```
pipelinesascode.tekton.dev/task: "anotherhub://task"
```
Additional hubs can be added by increasing the number in the configmap:
```yaml=
hub-2-catalog-id: myhub
hub-2-catalog-name: tekton
hub-2-url: https://api.myhub.com/v1
hub-3-catalog-id: anotherone
hub-3-catalog-name: tekton
hub-3-url: https://api.myhub.com/v1
```
*(**Note**: `catalog-name` is an implementation detail of the hub API to specify multiple catalogs from the same hub endpoint.)*
## Fallback
No fallback mechanism is implemented. If the task is not found on the specified hub, the PipelineRun will fail.
###### tags: pipelines-as-code, tekton, enhancement