How to check if Job succeeded or failed?
We have a multi-step GitHub action. One of the steps is running a job (“job run”). We’d like to continue to the next GitHub action step only after the job completed successfully.
Is there a recommended(copilot idiomatic) approach to being able to implement such functionality?
Please note that we are using “on.schedule: “none””.
Hey, this is a great feature request for us. It seems like a natural use case for a job status command. Thanks for surfacing this need so we can prioritize it.
In the meantime, can you work around your problem with these AWS CLI commands?
# Grab the ARN of the state machine some way (you can replace this with a variable, like so:
# STATE_MACHINE_ARN=arn:aws:states:$REGION:$ACCOUNT_ID:stateMachine:$COPILOT_APP-$COPILOT_ENV-$COPILOT_JOB
STATE_MACHINE_ARN=$(aws stepfunctions list-state-machines | jq -r '.stateMachines[].stateMachineArn')
# List the last execution of the state machine and parse its status
STATE_MACHINE_EXIT_CODE=$(aws stepfunctions list-executions --state-machine-arn $ARN --max-results 1 | jq -r '.executions[].status')
You can then do something with the STATE_MACHINE_EXIT_CODE variable.
If you have access to the state machine execution ARN, you can use aws stepfunctions describe-execution instead for similar results.
@PedroAlvarado I came across a similar issue for one of my projects and wanted to know if you found any solution to your issue.