Checkout race condition with multiple self hosted runners.

I have two self hosted runners on the same machine with the goal of running my “build” jobs in parallel. Both “build” jobs need the prebuild and test jobs to complete before they begin.

However since I’m never sure which runner will be used for the build_ios and build_android jobs; one of them ends up with no filesystem since checkout does not run in that runner.

Is there a way to check if the checkout action was performed previously in the current runner and if not use it so that the file system is available before attempting to build?


    jobs:
    prebuild:
    runs-on: self-hosted
    steps:
    -uses: actions/checkout@v1
    -name: prebuild
    run: |
    ./prebuild.sh
    test:
    runs-on: self-hosted
    needs: prebuild
    steps:
    -name: test
    run: |
    ./test.sh
    
    build\_ios:
    runs-on: self-hosted
    needs: [prebuild, test]
    steps:
    -name: build_ios
    run: |
    ./build_ios.sh
    
    build\_android:
    runs-on: self-hosted
    needs: [prebuild, test]
    steps:
    -name: build_android
    run: |
    ./build_android.sh

I added the checkout action to all of my jobs.

1 Like