forked from tektoncd/pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a simple HTTP resolver that can fetch a file from a remote HTTP(S) URL. Only fetch timeout configuration for now is supported. This is kept simple for now, and does not support any kind of HTTP authentication, custom TLS or any other features. Something we can improve on later. Signed-off-by: Chmouel Boudjnah <[email protected]>
- Loading branch information
1 parent
a22f812
commit 9f8fbb4
Showing
12 changed files
with
666 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright 2023 The Tekton Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: http-resolver-config | ||
namespace: tekton-pipelines-resolvers | ||
labels: | ||
app.kubernetes.io/component: resolvers | ||
app.kubernetes.io/instance: default | ||
app.kubernetes.io/part-of: tekton-pipelines | ||
data: | ||
# The maximum amount of time the http resolver will wait for a response from the server. | ||
fetch-timeout: "1m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<!-- | ||
--- | ||
linkTitle: "HTTP Resolver" | ||
weight: 311 | ||
--- | ||
--> | ||
|
||
# HTTP Resolver | ||
|
||
This resolver responds to type `http`. | ||
|
||
## Parameters | ||
|
||
| Param Name | Description | Example Value | | ||
|------------------|-------------------------------------------------------------------------------|------------------------------------------------------------| | ||
| `url` | The URL to fetch from | https://raw.githubusercontent.com/tektoncd-catalog/git-clone/main/task/git-clone/git-clone.yaml | | ||
|
||
A valid URL must be provided. Only HTTP or HTTPS URLs are supported. | ||
|
||
## Requirements | ||
|
||
- A cluster running Tekton Pipeline v0.41.0 or later. | ||
- The [built-in remote resolvers installed](./install.md#installing-and-configuring-remote-task-and-pipeline-resolution). | ||
- The `enable-http-resolver` feature flag in the `resolvers-feature-flags` ConfigMap in the | ||
`tekton-pipelines-resolvers` namespace set to `true`. | ||
- [Beta features](./additional-configs.md#beta-features) enabled. | ||
|
||
## Configuration | ||
|
||
This resolver uses a `ConfigMap` for its settings. See | ||
[`../config/resolvers/http-resolver-config.yaml`](../config/resolvers/http-resolver-config.yaml) | ||
for the name, namespace and defaults that the resolver ships with. | ||
|
||
### Options | ||
|
||
| Option Name | Description | Example Values | | ||
|-----------------------------|------------------------------------------------------|------------------------| | ||
| `fetch-timeout` | The maximum time any fetching of URL resolution may take. **Note**: a global maximum timeout of 1 minute is currently enforced on _all_ resolution requests. | `1m`, `2s`, `700ms` | | ||
|
||
## Usage | ||
|
||
### Task Resolution | ||
|
||
```yaml | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: TaskRun | ||
metadata: | ||
name: remote-task-reference | ||
spec: | ||
taskRef: | ||
resolver: http | ||
params: | ||
- name: url | ||
value: https://raw.githubusercontent.com/tektoncd-catalog/git-clone/main/task/git-clone/git-clone.yaml | ||
``` | ||
### Pipeline Resolution | ||
```yaml | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: PipelineRun | ||
metadata: | ||
name: http-demo | ||
spec: | ||
pipelineRef: | ||
resolver: http | ||
params: | ||
- name: url | ||
value: https://raw.githubusercontent.com/tektoncd/catalog/main/pipeline/build-push-gke-deploy/0.1/build-push-gke-deploy.yaml | ||
``` | ||
--- | ||
Except as otherwise noted, the content of this page is licensed under the | ||
[Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/), | ||
and code samples are licensed under the | ||
[Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
apiVersion: tekton.dev/v1 | ||
kind: PipelineRun | ||
metadata: | ||
generateName: http-resolver- | ||
spec: | ||
pipelineSpec: | ||
tasks: | ||
- name: http-resolver | ||
taskRef: | ||
resolver: http | ||
params: | ||
- name: url | ||
value: https://api.hub.tekton.dev/v1/resource/tekton/task/tkn/0.4/raw | ||
params: | ||
- name: ARGS | ||
value: ["version"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
Copyright 2023 The Tekton Authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package http | ||
|
||
const ( | ||
// timeoutKey is the configuration field name for controlling | ||
// the maximum duration of a resolution request for a file from http. | ||
timeoutKey = "fetch-timeout" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
Copyright 2023 The Tekton Authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package http | ||
|
||
const ( | ||
// urlParam is the url to fetch the task from | ||
urlParam string = "url" | ||
) |
Oops, something went wrong.