Skip to content

Commit

Permalink
fixup! WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
IamAbbey committed Jul 31, 2024
1 parent e764cfa commit 0afb7c1
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,42 +79,42 @@ runs:
aws_secret_access_key: ${{ inputs.aws_secret_access_key }}
aws_region: ${{ inputs.aws_region }}

- name: Run migrations
id: run-migrations
shell: bash
run: |
NETWORK_CONFIG=$(
aws ecs describe-services \
--cluster ${{ inputs.environment }} \
--services ${{ inputs.ecr_repository }}-${{ inputs.environment }} \
| jq -r '.services[0] | .networkConfiguration.awsvpcConfiguration'
)
SUBNET=$(echo $NETWORK_CONFIG | jq -r '.subnets')
SECURITY_GROUPS=$(echo $NETWORK_CONFIG | jq -r '.securityGroups')
MIGRATION_TASK_ARN=$(
aws ecs run-task \
--cluster ${{ inputs.environment }} \
--count 1 \
--launch-type "FARGATE" \
--network-configuration "{ \"awsvpcConfiguration\": { \"subnets\": $SUBNET, \"securityGroups\": $SECURITY_GROUPS, \"assignPublicIp\": \"DISABLED\" } }" \
--override '{ "containerOverrides": [ { "name": "local-exec", "command": ["python manage.py migrate"] } ] }' \
--task-definition "${{ steps.deploy-local-task-definition.outputs.latest-task-definition-arn }}" \
| jq -r '.tasks[0] | .taskArn'
)
echo $MIGRATION_TASK_ARN
echo "migration-task-arn=$MIGRATION_TASK_ARN" >> $GITHUB_OUTPUT
- name: Wait for migrations to finish
shell: bash
working-directory: ${{ github.action_path }}
run: |
poetry run actions_helper wait-for-task-stopped \
--cluster ${{ inputs.environment }} \
--task "${{ steps.run-migrations.outputs.migration-task-arn }}"
# - name: Run migrations
# id: run-migrations
# shell: bash
# run: |
# NETWORK_CONFIG=$(
# aws ecs describe-services \
# --cluster ${{ inputs.environment }} \
# --services ${{ inputs.ecr_repository }}-${{ inputs.environment }} \
# | jq -r '.services[0] | .networkConfiguration.awsvpcConfiguration'
# )
#
# SUBNET=$(echo $NETWORK_CONFIG | jq -r '.subnets')
# SECURITY_GROUPS=$(echo $NETWORK_CONFIG | jq -r '.securityGroups')
#
# MIGRATION_TASK_ARN=$(
# aws ecs run-task \
# --cluster ${{ inputs.environment }} \
# --count 1 \
# --launch-type "FARGATE" \
# --network-configuration "{ \"awsvpcConfiguration\": { \"subnets\": $SUBNET, \"securityGroups\": $SECURITY_GROUPS, \"assignPublicIp\": \"DISABLED\" } }" \
# --override '{ "containerOverrides": [ { "name": "local-exec", "command": ["python manage.py migrate"] } ] }' \
# --task-definition "${{ steps.deploy-local-task-definition.outputs.latest-task-definition-arn }}" \
# | jq -r '.tasks[0] | .taskArn'
# )
#
# echo $MIGRATION_TASK_ARN
# echo "migration-task-arn=$MIGRATION_TASK_ARN" >> $GITHUB_OUTPUT
#
#
# - name: Wait for migrations to finish
# shell: bash
# working-directory: ${{ github.action_path }}
# run: |
# poetry run actions_helper wait-for-task-stopped \
# --cluster ${{ inputs.environment }} \
# --task "${{ steps.run-migrations.outputs.migration-task-arn }}"

# Service is managed by Pulumi, only desired count and task definition should be updated here
- name: Update service
Expand Down

0 comments on commit 0afb7c1

Please sign in to comment.