Skip to content

Commit

Permalink
Checking default AWS env var
Browse files Browse the repository at this point in the history
  • Loading branch information
oryanmoshe committed Mar 4, 2020
1 parent f21743e commit d352050
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 24 deletions.
33 changes: 15 additions & 18 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
name: "ECS Wait"
author: "Oryan Moshe"
description: "Waits for ECS service stability"
name: 'ECS Wait'
author: 'Oryan Moshe'
description: 'Waits for ECS service stability'
inputs:
retries:
description: "How many times to retry the 10 minute wait (integer)"
description: 'How many times to retry the 10 minute wait (integer)'
required: true
default: 2
aws-access-key-id:
description: "The AWS_ACCESS_KEY_ID (string)"
required: true
description: 'The AWS_ACCESS_KEY_ID (string)'
aws-secret-access-key:
description: "The AWS_SECRET_ACCESS_KEY (string)"
required: true
description: 'The AWS_SECRET_ACCESS_KEY (string)'
aws-region:
description: "The AWS_REGION (string)"
required: true
description: 'The AWS_REGION (string)'
ecs-cluster:
description: "The ECS cluster name (string)"
description: 'The ECS cluster name (string)'
required: true
ecs-services:
description: "List of ECS services to wait for (string[])"
description: 'List of ECS services to wait for (string[])'
required: true
verbose:
description: "Whether to print the retry log (bool)"
description: 'Whether to print the retry log (bool)'
default: false
outputs:
retries:
description: "How many retries happened until success (integer)"
description: 'How many retries happened until success (integer)'
runs:
using: "node12"
main: "dist/index.js"
using: 'node12'
main: 'dist/index.js'
branding:
icon: "clock"
color: "purple"
icon: 'clock'
color: 'purple'
16 changes: 13 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,25 @@ const createEcsConnection = ({ accessKeyId, secretAccessKey, region }) =>
const main = async () => {
try {
const params = {
accessKeyId: core.getInput('aws-access-key-id'),
secretAccessKey: core.getInput('aws-secret-access-key'),
region: core.getInput('aws-region'),
accessKeyId:
core.getInput('aws-access-key-id') || process.env.AWS_ACCESS_KEY_ID,
secretAccessKey:
core.getInput('aws-secret-access-key') ||
process.env.AWS_SECRET_ACCESS_KEY,
region: core.getInput('aws-region') || process.env.AWS_REGION,
retries: parseInt(core.getInput('retries'), 10),
cluster: core.getInput('ecs-cluster'),
services: JSON.parse(core.getInput('ecs-services')),
verbose: core.getInput('verbose') === 'true',
};

if (!params.accessKeyId || !params.secretAccessKey || !params.region) {
core.setFailed(
'AWS credentials were not found in inputs or environment variables.'
);
return;
}

const ecsConnection = createEcsConnection(params);
params['ecsConnection'] = ecsConnection;

Expand Down

0 comments on commit d352050

Please sign in to comment.