Skip to content

Commit

Permalink
feat: add new feature to fetch task definition using task definition …
Browse files Browse the repository at this point in the history
…arn or name(#311)

Co-authored-by: Filipe Macedo (@filipemacedo)
Co-authored-by: Fábio BC Souza (@fabiobarboza7)

* "Updated action to support task definition ARN, family, and revision inputs, and refactored code to handle new inputs and error cases."

* updated index.js dist file

* updated package.json file and lock.json

* updated dist file with installed sdk package

* updated code with first round of comments

* modified code with suggested comments and tests

* modified code for testing cases

* new changes from suggested comments

* chnages made from comments and spacing fixing

* removing . promise from describeTaskDef call

* removing . promise and then from describeTaskDef call

* updated describe tasl def api call

* fixed api call

* fixed api call and removing data

* fixed api and moved call

* fixed spacing and indentation: final edits

* fixed spacing for task definition revision

* fixed spacing and descriptions

* polishing code with suggested comments

* adding small changes for new input default values

* fixing spacing

* fixing indentation for task definition file conditional block

* fixing indentation for one space

* changes after suggested comments for description and organization
  • Loading branch information
shesaave authored Aug 1, 2024
1 parent 343d32d commit e246ecd
Show file tree
Hide file tree
Showing 7 changed files with 26,965 additions and 332 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Inserts a container image URI into an Amazon ECS task definition JSON file, crea
<!-- tocstop -->

## Usage
If task definition file is provided that has precedence over any other option to fetch task definition.
If both task definition file and task definition arn are provided, a warning that both have been provided will be returned and the task definition file will be used.
If neither of task definition file, task definition arn, and task definition family are provided, an error will be thrown. (At least one option needs to be provided)

To insert the image URI `amazon/amazon-ecs-sample:latest` as the image for the `web` container in the task definition file, and then deploy the edited task definition file to ECS:

Expand All @@ -22,6 +25,9 @@ To insert the image URI `amazon/amazon-ecs-sample:latest` as the image for the `
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
task-definition-arn: task-definition-arn
task-definition-family: task-definition-family-name
task-definition-revision: task-definition-revision
container-name: web
image: amazon/amazon-ecs-sample:latest
environment-variables: "LOG_LEVEL=info"
Expand Down
11 changes: 10 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ branding:
inputs:
task-definition:
description: 'The path to the ECS task definition JSON file'
required: true
required: false
task-definition-arn:
description: 'The full Amazon Resource Name (ARN) of the task definition to be used'
required: false
task-definition-family:
description: 'The name of a family that the task definition is registered to'
required: false
task-definition-revision:
description: 'The revision of the task definition being used'
required: false
container-name:
description: 'The name of the container defined in the containerDefinitions section of the ECS task definition'
required: true
Expand Down
Loading

0 comments on commit e246ecd

Please sign in to comment.