Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to cancel workflow #507

Open
c-ameron opened this issue Jul 25, 2023 · 0 comments
Open

Unable to cancel workflow #507

c-ameron opened this issue Jul 25, 2023 · 0 comments

Comments

@c-ameron
Copy link

Hi,

I'm unable to cancel a workflow when I'm using the action. This is for both Code Deploy and a normal ECS service update. I'm running on hosted github actions, I'm also using the input wait-for-service-stability: true. When I click 'cancel workflow' (even multiple times), it looks like the action captures the cancellation and it runs to completion. Instead, I'd like it to immediately cancel the workflow. Ideally it would rollback, however just a cancellation is fine and I can have my own rollback logic.

In my case this rollback was a simple

    - name: Cancel Deployment if job cancelled
      if: cancelled()
      run: |
        deploymentId="$(aws deploy list-deployments --application-name ${{ inputs.application_name }} --deployment-group-name ${{ inputs.ecs_service_name }} --max-items 1 | jq -r .deployments[])"
        deploymentStatus="$(aws deploy get-deployment --deployment-id $deploymentId | jq -r .deploymentInfo.status)"
        if ! [[ $deploymentStatus =~ ^(Succeeded|Failed|Stopped)$ ]]; then
          aws deploy stop-deployment --deployment-id $deploymentId
        fi

Let me know if you need any more details.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant