Jobs.jobid.needs not waiting

Hi
I’ve written a workflow in which the final job called batch-completion-notification isuppoed to wait for the other jobs to complete using:

  batch-completion-notification:
    # this runs after all the test jobs have completed
    needs: [run-tests1, run-tests2, run-tests3]

But it finishes first before the others even start - what did I do wrong? Thanks
Here is the full yml

# As coded below, the workflow is triggered when any file is pushed to any branch in the repository
# You can:
# - Change the "push" to use a different event or add other GitHub events
# - Use wildcard with branc names and tages or "paths" or "paths-ignore"
#   to narrow down the to specific branches or tags. 
on:
  push:
    branches:
      - main

env:
  APPLITOOLS_API_KEY: "Zg6peoNJVXKrHc897mAP9klniG3iJevvnWXA102bOc3H8w110"
  APPLITOOLS_BATCH_ID: ${{ github.sha }}
  # APPLITOOLS_SERVER_URL is set to the default Eyes server
  # Change this to your server if you have a dedicated cloud on on prem server.
  APPLITOOLS_SERVER_URL : "eyesapi.applitools.com"
jobs:
  run-tests1:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Log Git SHA
        run: echo "$GITHUB_SHA"
      - name: Setup Java JDK
        uses: actions/setup-java@v1.4.3
        with:
          # The Java version to make available on the path. Takes a whole or semver Java version, or 1.x syntax (e.g. 1.8 => Java 8.x). Early access versions can be specified in the form of e.g. 14-ea, 14.0.0-ea, or 14.0.0-ea.28
          java-version: 1.11
      - name: Change wrapper permissions
        run: chmod +x ./runscripts/run_github_action_classic_runner.sh
      - name: Run test 1
        run: ./runscripts/run_github_action_classic_runner.sh

  run-tests2:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Log Git SHA
        run: echo "$GITHUB_SHA"
      - name: Setup Java JDK
        uses: actions/setup-java@v1.4.3
        with:
          # The Java version to make available on the path. Takes a whole or semver Java version, or 1.x syntax (e.g. 1.8 => Java 8.x). Early access versions can be specified in the form of e.g. 14-ea, 14.0.0-ea, or 14.0.0-ea.28
          java-version: 1.11
      - name: Change wrapper permissions
        run: chmod +x ./runscripts/run_github_action_classic_runner.sh
      - name: Run test 2
        run: ./runscripts/run_github_action_classic_runner.sh
  run-tests3:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Log Git SHA
        run: echo "$GITHUB_SHA"
      - name: Setup Java JDK
        uses: actions/setup-java@v1.4.3
        with:
          # The Java version to make available on the path. Takes a whole or semver Java version, or 1.x syntax (e.g. 1.8 => Java 8.x). Early access versions can be specified in the form of e.g. 14-ea, 14.0.0-ea, or 14.0.0-ea.28
          java-version: 1.11
      - name: Change wrapper permissions
        run: chmod +x ./runscripts/run_github_action_classic_runner.sh
      - name: Run test 3
        run: ./runscripts/run_github_action_classic_runner.sh
        
  batch-completion-notification:
    # this runs after all the test jobs have completed
    needs: [run-tests1, run-tests2, run-tests3]
    runs-on: ubuntu-latest
    steps:
      - name: Update Applitools batch status
        #step 2 after all tests have completed signal the end of the run to the Eyes server.
        uses: wei/curl@v1.1.1
        with:
          args: -d "" -X POST https://${{ env.APPLITOOLS_SERVER_URL }}/api/externals/github/servers/github.com/commit/${{ env.APPLITOOLS_BATCH_ID }}/complete?apiKey=${{ env.APPLITOOLS_API_KEY }}

Update - it turns out that that this only a bug in the UI.
When I start the workflow the job that is supposed to wait shows up with a green tick mark (which I understand to mean done) then the others job show up as busy (yellow circle) and the waiting job still has a green tick mark. Only when the three jobs are complete the job that is waiting to turns to busy - look at the following series of screen captures which were taken sequentially:

Just to add that the text also shows this bug
1 completed and 3 in progress jobs (the complete job is the one that is supposed to wait)
3 completed and 1 in progress jobs
3 completed and 1 in progress jobs (the in progress job is the one that is supposed to wait)

I suppose it’s a UI bug. Others have experienced similar glitches:

@yonatanLehman,

it turns out that that this only a bug in the UI.

I agree this is an UI issue.
To confirm this, you can try like as this:

  1. Execute the “List jobs for a workflow run” API to view the details of all the jobs in the workflow run.

  2. From the response of the API, you can see the start time (started_at) and complete time (completed_at) of each job. In your case, normally the start time of “batch-completion-notification” job should be after the complete time of other three jobs.

1 Like