Skip to content

Commit

Permalink
Merge pull request #3 from yyoshiki41/feature/group-log-lines
Browse files Browse the repository at this point in the history
Grouping log lines
  • Loading branch information
yyoshiki41 authored Jun 6, 2022
2 parents 4278f0a + 1f63f29 commit c9c011f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ runs:
- name: Install AWS CLI
shell: bash
run: |
echo "::group::Install AWS CLI"
if ! [ -x "$(command -v aws)" ]; then
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install --update
awscli --version
fi
echo "::endgroup::"
- name: Register ECS task definition
shell: bash
Expand All @@ -82,6 +84,7 @@ runs:
vpc_configuration: "{subnets=${{ inputs.subnets }},securityGroups=${{ inputs.security-groups }},assignPublicIp=${{ inputs.assign-public-ip }}}"
container_overrides: '{"containerOverrides": [{"name": "${{ inputs.container-name}}", "command": ${{ inputs.command }} }]}'
run: |
echo "::group::Run ECS Task"
if [ '${{ inputs.container-name }}' != '' ] && [ '${{ inputs.command }}' != '' ]; then
task_arn=$(aws ecs run-task \
--region ${{ inputs.region }} \
Expand All @@ -102,11 +105,11 @@ runs:
fi
echo "::set-output name=task_arn::$task_arn"
echo "::set-output name=task_id::${task_arn/*\//}"
echo "::endgroup::"
- name: Wait until a task stopped
shell: bash
run: |
echo '::echo::on'
aws ecs wait tasks-stopped \
--cluster ${{ inputs.cluster }} \
--tasks ${{ steps.run-task.outputs.task_arn }}
Expand All @@ -123,6 +126,8 @@ runs:
shell: bash
id: logs
run: |
echo "::group::Retrieve container logs from CloudWatch logs"
echo '::echo::on'
out=$(ecs-cli logs --timestamps \
--cluster ${{ inputs.cluster }} \
--task-id ${{ steps.run-task.outputs.task_id }} \
Expand All @@ -131,3 +136,4 @@ runs:
out="${out//$'\n'/'%0A'}"
out="${out//$'\r'/'%0D'}"
echo "::set-output name=out::$out"
echo "::endgroup::"

0 comments on commit c9c011f

Please sign in to comment.