Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ inputs:
command:
description: 'The command used by ECS to start the container image'
required: false
task-role-arn:
description: 'The ARN of the IAM role that the ECS container will assume'
required: false
execution-role-arn:
description: 'The ARN of the IAM role that the ECS task execution role will assume'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description can be made more explicit, as it could confuse some users since it's self-referencing.
Suggested reword: 'The ARN of the IAM role that the task definition will assume to run the task'

env-files:
description: 'S3 object arns to set env variables onto the container. You can specify multiple files with multi-line YAML strings.'
required: false
Expand Down
12 changes: 12 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ async function run() {
const logConfigurationOptions = core.getInput("log-configuration-options", { required: false });
const dockerLabels = core.getInput('docker-labels', { required: false });
const command = core.getInput('command', { required: false });
const taskRoleArn = core.getInput('task-role-arn', { required: false });
const executionRoleArn = core.getInput('execution-role-arn', { required: false });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could you remove unnecessary whitespace?


//New inputs to fetch task definition
const taskDefinitionArn = core.getInput('task-definition-arn', { required: false }) || undefined;
Expand Down Expand Up @@ -109,6 +112,7 @@ async function run() {
}
containerDef.image = imageURI;


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could you remove unnecessary whitespace?

if (command) {
containerDef.command = command.split(' ')
}
Expand Down Expand Up @@ -245,6 +249,14 @@ async function run() {
})
}

if (taskRoleArn) {
taskDefContents.taskRoleArn = taskRoleArn;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a regex validation for the arn? Need appropriate unit tests as well for these changes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ECS actually allows name-only format (if the role is in the same account as the task definition), and we rely on that to deploy the same task definition across multiple accounts.

}

if (executionRoleArn) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a regex validation for the arn? Need appropriate unit tests as well for these changes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ECS actually allows name-only format (if the role is in the same account as the task definition), and we rely on that to deploy the same task definition across multiple accounts.

taskDefContents.executionRoleArn = executionRoleArn;
}

// Write out a new task definition file
var updatedTaskDefFile = tmp.fileSync({
tmpdir: process.env.RUNNER_TEMP,
Expand Down