turnstyle icon indicating copy to clipboard operation
turnstyle copied to clipboard

Clarification for abort-after-seconds

Open ltamrazov opened this issue 4 years ago • 2 comments

Hi, I wanted to clarify how this feature works. I tried to do abort-after-seconds: 1 hoping to bail right away if there is already a job in progress, but it seemed to wait much longer ~42 seconds before I canceled the job.

I then though that maybe it needs to work with poll-interval-seconds, and also set that to 1. This time the job resumed although there was already a run in progress so it should have stopped. Screenshot:

Screen Shot 2020-11-21 at 6 44 31 PM

Similarly for the second run that I expected to fail: Screen Shot 2020-11-21 at 6 46 47 PM

Thank you!

ltamrazov avatar Nov 21 '20 23:11 ltamrazov

This is the workflow:

name: release

on:
  pull_request:
    branches: [ master ]

jobs:
  cancel-workflows:
    runs-on: ubuntu-latest
    steps:
      - name: Block concurrent deploys
        uses: softprops/turnstyle@v1
        with:
            abort-after-seconds: 1
            poll-interval-seconds: 1
        env:
            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  
  another-job:
    runs-on: ubuntu-latest
    needs: [cancel-previous-workflows]
    steps:
      - name: sleep
        run: sleep 30

ltamrazov avatar Nov 22 '20 03:11 ltamrazov

Further testing seems like it only works when its on the same job like:

jobs:
  cancel-workflows:
    runs-on: ubuntu-latest
    steps:
      - name: Block concurrent deploys
        uses: softprops/turnstyle@v1
        with:
            abort-after-seconds: 1
            poll-interval-seconds: 1
        env:
            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: sleep
        run: sleep 180

Not sure if that's intentional?

ltamrazov avatar Nov 22 '20 04:11 ltamrazov