1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-29 06:34:08 +00:00
catalog/task/aws-cli/0.2
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
..
samples aws-cli: Make secrets workspace optional 2021-02-08 10:11:44 +00:00
aws-cli.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

aws

This task performs operations on Amazon Web Services resources using aws.

All aws cli commands can be found here.

Install the Task

kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/aws-cli/0.2/aws-cli.yaml

Parameters

  • SCRIPT: The script of aws commands to execute e.g. aws $1 $2 This will take the first value and second value of ARGS as s3 and ls (default: aws $@)
  • ARGS: The arguments to pass to aws CLI, which are appended to aws e.g. s3 ls ( default: ["help"] ).

Workspaces

  • source: To mount file which is to be uploaded to the aws resources, this should be mounted using any volume supported in workspace.
  • secrets: A workspace that consists of credentials required by aws which will be mounted to $HOME/.aws. This workspace can be omitted when using instance-profile credentials.

Secret

AWS credentials and config both should be provided in the form of secret.

This example can be referred to create aws-credentials.

Refer this guide for setting up AWS Credentials and Region.

Usage

After creating the task, you should now be able to execute aws commands by specifying the command you would like to run as the ARGS or SCRIPT param.

The ARGS param takes an array of aws subcommands that will be executed as part of this task and the SCRIPT param takes the multiple commands that you would like to run on aws CLI.

This samples, can be referred to create secret file for aws credentials.

In the samples, ConfigMap as the volume is used. In place of ConfigMap, any volume supported in workspace can be used.

Following command can be used to create ConfigMap from the file.

kubectl create configmap upload-file --from-file=demo.zip

Here upload-file is the name of the ConfigMap, this can be changed based on the requirements.

See here for example of aws s3 command.

Note

  • Either SCRIPT or ARGS must be provided in the params of the task.

  • To support multiple aws commands to run on a single task, SCRIPT can be used as follows:

    - name: SCRIPT
      value: |
        aws s3 mb s3://test-bucket
        aws s3api put-object --bucket test-bucket --key test/
        aws s3 cp $(workspaces.source.path)/demo.zip s3://test-bucket/test/demo.zip