Skip to content

Commit e039198

Browse files
BB2-4892 fix scheduled django management commands (#1629)
Fix scheduled django management commands that fail in prod by allowing the commands to run longer. Also, update the name of tasks and steps. * loop `aws ecs wait tasks-stopped` to overcome its 10 minute limit * fix bash syntax * print out exit code for debugging * rename job and steps to be more general These aren't just migration commands, so updating to reflect that. * update to use until loop * redirect stderr to /dev/null, since a timeout error is sometimes expected Expected if the task takes longer than 10 minutes to complete.
1 parent 9058ab4 commit e039198

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

.github/workflows/run-manage-command.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ permissions:
5454
contents: read
5555

5656
jobs:
57-
migrate:
57+
manage-command:
5858
name: Run "${{ inputs.custom_command || inputs.command }}" on ${{ inputs.environment }}
5959
runs-on:
6060
- codebuild-bb-${{ (inputs.environment || 'test') == 'test' && 'test' || 'prod' }}-web-server-${{ github.run_id }}-${{ github.run_attempt }}
@@ -99,7 +99,7 @@ jobs:
9999
echo "resolved=${CMD}" >> "$GITHUB_OUTPUT"
100100
echo "Running: manage.py ${CMD}"
101101
102-
- name: Run migration task
102+
- name: Run task
103103
id: run-task
104104
run: |
105105
TASK_ARN=$(aws ecs run-task \
@@ -125,9 +125,11 @@ jobs:
125125
- name: Wait for task to complete
126126
run: |
127127
echo "Waiting for task to finish..."
128-
aws ecs wait tasks-stopped \
129-
--cluster "${{ steps.network.outputs.cluster }}" \
130-
--tasks "${{ steps.run-task.outputs.task_arn }}"
128+
until aws ecs wait tasks-stopped \
129+
--cluster "${{ steps.network.outputs.cluster }}" \
130+
--tasks "${{ steps.run-task.outputs.task_arn }}" 2>/dev/null; do
131+
echo "..."
132+
done
131133
132134
# Match by container name so sidecar containers don't affect the result
133135
EXIT_CODE=$(aws ecs describe-tasks \

0 commit comments

Comments
 (0)