Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

envato-archive/ecs-scheduled-tasks-buildkite-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ECS Scheduled Tasks Buildkite Plugin

tests

A Buildkite plugin for deploying Amazon ECS Scheduled Tasks.

  • Requires the aws cli tool be installed
  • Registers a new task definition based on a given JSON file (register-task-definition)
  • Creates a CloudWatch Events rule (put-rule)
  • Adds the newly-registered task definition as a target for the Events rule (put-targets)

Example

steps:
  - label: ":ecs: :rocket:"
    concurrency_group: "my-scheduled-task"
    concurrency: 1
    plugins:
      - envato/ecs-scheduled-tasks#v0.1.0:
          task-family: "my-task-family"
          task-definition: "examples/hello-world.json"
          events-rule-name: "my-events-rule"
          events-rule-role-arn: "arn:aws:iam::123456789012:role/my-events-rule-role"
          events-target-definition: "examples/ecs-target.json"

Options

task-family

The name of the task family.

Example: "my-task"

task-definition

The file path to the ECS task definition JSON file.

Example: "examples/hello-world.json"

target-definition

The file path to the Events rule target definition JSON file.

Example: "examples/ecs-target.json"

events-rule-name

The name of the CloudWatch Events rule to create.

Example: "my-events-rule"

events-rule-role-arn

The IAM role used to invoke the targets of the Events rule.

At a minimum, this requires the ecs:RunTask permission on your task definition resource, and must be able to be assumed by events.amazonaws.com. An example policy for an ECS target can be found in the AWS documentation.

schedule-expression

The AWS schedule expression to use in the Events rule.

Example: "cron(* * * ? * *)"

events-rule-description (optional)

A text description for the Events rule.

task-role-arn (optional)

An IAM ECS Task Role to assign to tasks. Requires the iam:PassRole permission for the ARN specified.

execution-role-arn (optional)

The Execution Role ARN used by ECS to pull container images and secrets.

Example: "arn:aws:iam::012345678910:role/execution-role"

Requires the iam:PassRole permission for the execution role.

AWS Roles

At a minimum this plugin requires the following AWS permissions to be granted to the agent running this step:

Policy:
  Statement:
  - Action:
    - ecs:RegisterTaskDefinition
    - events:DescribeRules
    - events:PutRule
    - events:PutTargets
    Effect: Allow
    Resource: '*'

Developing

To run the tests:

docker-compose run tests

License

MIT (see LICENSE)

About

A Buildkite plugin for deploying ECS Scheduled Tasks

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages