1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-29 06:34:08 +00:00
catalog/task/aws-cli/0.1
PuneetPunamiya ccd1080419 Modifies the path in readme for samples directory
Signed-off-by: Puneet Punamiya <ppunamiy@redhat.com>
2020-07-15 02:43:58 +01:00
..
samples Modifies directory names based on the proposal 2020-07-14 19:01:58 +01:00
aws-cli.yaml Modifies aws-cli task according to the new reorg proposal 2020-07-10 22:06:57 +01:00
README.md Modifies the path in readme for samples directory 2020-07-15 02:43:58 +01: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/master/task/aws-cli/0.1/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 the aws which needs to be mounted to their default path as required by the aws.

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
    
  • In case there is no requirement of file that is to be uploaded on the aws resources, then emptyDir needs to be mounted in the workspace as shown below:

    workspaces:
      - name: source
        emptyDir: {}
    

    otherwise, if `Volume(e.g. ConfigMap) is needed:

    workspaces:
      - name: source
        configmap:
            name: upload-file