1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-25 06:17:50 +00:00
catalog/task/curl/0.1
PuneetPunamiya 5a3e5f630f Adds category field as an annotation as tekton.dev/categories
- Initially all tags were mapped to categories in Hub,
     for e.g. config.yaml: https://github.com/tektoncd/hub/blob/master/config.yaml,
     so whenever a new tag was added in a task it was mapped to a category called `others`.
     Hence before every release we had to manually map these new tags to some category,
     hence after the discussion in Catalog and Hub WG, a proposal was created for adding
     a category as an annotation.

   - PR to update the TEP-0003-Tekton Catalog Organization: https://github.com/tektoncd/community/pull/352

Signed-off-by: Puneet Punamiya <ppunamiy@redhat.com>
2021-07-26 13:15:08 +01:00
..
tests Modifies curl task according to the new reorg proposal 2020-07-10 22:06:57 +01:00
curl.yaml Adds category field as an annotation as tekton.dev/categories 2021-07-26 13:15:08 +01:00
README.md Update self reference from master to main 🧙 2021-03-19 11:09:49 +00:00

curl

This task performs curl operation to transfer data from internet .

Install the Task

kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/curl/0.1/curl.yaml

Parameters

  • options: The arguments to pass to curl CLI. default: [""]
  • url: The url we want to download file from, required field.
  • curl-image: The curl docker image to be used. Defaults to curlimages/curl.

Usage

Running the Task

Viewing request headers and connection details

You can invoke curl -i url to get request header from specified url:

Create a file, curl-header-run.yaml:

apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: curl-header-run
spec:
  params:
    - name: url
      value: "www.google.com"
    - name: options
      value:
       - "-i"
  taskRef:
    name: curl

Run it with kubectl apply -f curl-header-run.yaml

When this runs, it will print logs containing only headers of the response

View full response from request to specified url

You can invoke curl url to get a full response from specified url:

Create a file, curl-reponse-run.yaml:

apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: curl-response-run
spec:
  params:
    - name: url
      value: "www.google.com"
  taskRef:
    name: curl

Run it with kubectl apply -f curl-response-run.yaml

When this runs, it will print logs containing full response fields of the request

Use a different version of curl image

You can invoke curl url to get a full response from specified url while specifying a different image in taskrun:

Create a file, curl-diffimage-run.yaml:

apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: curl-diffimage-run
spec:
  params:
    - name: url
      value: "www.google.com"
    - name: curl-image
      value: "appropriate/curl"
  taskRef:
    name: curl

Run it with kubectl apply -f curl-diffimage-run.yaml

When this runs, it will print logs containing full response fields of the request as in the last example, but now uses a different version of image