ci(bin-image): fix conditional run for skipped job
follow-up https://github.com/moby/moby/pull/46154#issuecomment-1855789619

<!--
Please make sure you've read and understood our contributing guidelines;
https://github.com/moby/moby/blob/master/CONTRIBUTING.md

** Make sure all your commits include a signature generated with `git commit -s` **

For additional information on our contributing process, read our contributing
guide https://docs.docker.com/opensource/code/

If this is a bug fix, make sure your description includes "fixes #xxxx", or
"closes #xxxx"

Please provide the following information:
-->

**- What I did**

When the dco job is skipped, the dependent ones will be skipped as well. To fix this issue we need to apply special conditions to always run dependent jobs but not if canceled or failed.

**- How I did it**

**- How to verify it**

See https://github.com/crazy-max/moby/actions/runs/7209189577

**- Description for the changelog**
<!--
Write a short (one line) summary that describes the changes in this
pull request for inclusion in the changelog:
-->


**- A picture of a cute animal (not mandatory but encouraged)**


.github/workflows/test.yml
name: test

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

on:
  workflow_dispatch:
  push:
    branches:
      - 'master'
      - '[0-9]+.[0-9]+'
    tags:
      - 'v*'
  pull_request:

env:
  GO_VERSION: "1.21.5"

jobs:
  validate-dco:
    uses: ./.github/workflows/.dco.yml

  build-dev:
    runs-on: ubuntu-20.04
    needs:
      - validate-dco
    strategy:
      fail-fast: false
      matrix:
        mode:
          - ""
          - systemd
    steps:
      -
        name: Prepare
        run: |
          if [ "${{ matrix.mode }}" = "systemd" ]; then
            echo "SYSTEMD=true" >> $GITHUB_ENV
          fi
      -
        name: Checkout
        uses: actions/checkout@v3
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      -
        name: Build dev image
        uses: docker/bake-action@v2
        with:
          targets: dev
          set: |
            *.cache-from=type=gha,scope=dev${{ matrix.mode }}
            *.cache-to=type=gha,scope=dev${{ matrix.mode }},mode=max
            *.output=type=cacheonly

  test-prepare:
    uses: ./.github/workflows/.test-prepare.yml
    needs:
      - validate-dco

  test:
    needs:
      - test-prepare
      - build-dev
    uses: ./.github/workflows/.test.yml
    strategy:
      fail-fast: false
      matrix:
        storage: ${{ fromJson(needs.test-prepare.outputs.matrix) }}
    with:
      storage: ${{ matrix.storage }}

  validate-prepare:
    runs-on: ubuntu-20.04
    needs:
      - validate-dco
    outputs:
      matrix: ${{ steps.scripts.outputs.matrix }}
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
      -
        name: Create matrix
        id: scripts
        run: |
          scripts=$(cd ./hack/validate && jq -nc '$ARGS.positional - ["all", "default", "dco"] | map(select(test("[.]")|not)) + ["generate-files"]' --args *)
          echo "matrix=$scripts" >> $GITHUB_OUTPUT
      -
        name: Show matrix
        run: |
          echo ${{ steps.scripts.outputs.matrix }}

  validate:
    runs-on: ubuntu-20.04
    timeout-minutes: 120
    needs:
      - validate-prepare
      - build-dev
    strategy:
      fail-fast: true
      matrix:
        script: ${{ fromJson(needs.validate-prepare.outputs.matrix) }}
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      -
        name: Set up runner
        uses: ./.github/actions/setup-runner
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      -
        name: Build dev image
        uses: docker/bake-action@v2
        with:
          targets: dev
          set: |
            dev.cache-from=type=gha,scope=dev
      -
        name: Validate
        run: |
          make -o build validate-${{ matrix.script }}

  smoke-prepare:
    runs-on: ubuntu-20.04
    needs:
      - validate-dco
    outputs:
      matrix: ${{ steps.platforms.outputs.matrix }}
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
      -
        name: Create matrix
        id: platforms
        run: |
          matrix="$(docker buildx bake binary-smoketest --print | jq -cr '.target."binary-smoketest".platforms')"
          echo "matrix=$matrix" >> $GITHUB_OUTPUT
      -
        name: Show matrix
        run: |
          echo ${{ steps.platforms.outputs.matrix }}

  smoke:
    runs-on: ubuntu-20.04
    needs:
      - smoke-prepare
    strategy:
      fail-fast: false
      matrix:
        platform: ${{ fromJson(needs.smoke-prepare.outputs.matrix) }}
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
      -
        name: Prepare
        run: |
          platform=${{ matrix.platform }}
          echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
      -
        name: Set up QEMU
        uses: docker/setup-qemu-action@v2
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      -
        name: Test
        uses: docker/bake-action@v2
        with:
          targets: binary-smoketest
          set: |
            *.platform=${{ matrix.platform }}

name: test

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

on:
  workflow_dispatch:
  push:
    branches:
      - 'master'
      - '[0-9]+.[0-9]+'
  pull_request:

env:
  GO_VERSION: "1.21.5"

jobs:
  validate-dco:
    uses: ./.github/workflows/.dco.yml

  build-dev:
    runs-on: ubuntu-20.04
    needs:
      - validate-dco
    strategy:
      fail-fast: false
      matrix:
        mode:
          - ""
          - systemd
    steps:
      -
        name: Prepare
        run: |
          if [ "${{ matrix.mode }}" = "systemd" ]; then
            echo "SYSTEMD=true" >> $GITHUB_ENV
          fi
      -
        name: Checkout
        uses: actions/checkout@v3
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      -
        name: Build dev image
        uses: docker/bake-action@v2
        with:
          targets: dev
          set: |
            *.cache-from=type=gha,scope=dev${{ matrix.mode }}
            *.cache-to=type=gha,scope=dev${{ matrix.mode }},mode=max
            *.output=type=cacheonly

  test-prepare:
    uses: ./.github/workflows/.test-prepare.yml
    needs:
      - validate-dco

  test:
    needs:
      - test-prepare
      - build-dev
    uses: ./.github/workflows/.test.yml
    strategy:
      fail-fast: false
      matrix:
        storage: ${{ fromJson(needs.test-prepare.outputs.matrix) }}
    with:
      storage: ${{ matrix.storage }}

  validate-prepare:
    runs-on: ubuntu-20.04
    needs:
      - validate-dco
    outputs:
      matrix: ${{ steps.scripts.outputs.matrix }}
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
      -
        name: Create matrix
        id: scripts
        run: |
          scripts=$(cd ./hack/validate && jq -nc '$ARGS.positional - ["all", "default", "dco"] | map(select(test("[.]")|not)) + ["generate-files"]' --args *)
          echo "matrix=$scripts" >> $GITHUB_OUTPUT
      -
        name: Show matrix
        run: |
          echo ${{ steps.scripts.outputs.matrix }}

  validate:
    runs-on: ubuntu-20.04
    timeout-minutes: 120
    needs:
      - validate-prepare
      - build-dev
    strategy:
      fail-fast: true
      matrix:
        script: ${{ fromJson(needs.validate-prepare.outputs.matrix) }}
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      -
        name: Set up runner
        uses: ./.github/actions/setup-runner
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      -
        name: Build dev image
        uses: docker/bake-action@v2
        with:
          targets: dev
          set: |
            dev.cache-from=type=gha,scope=dev
      -
        name: Validate
        run: |
          make -o build validate-${{ matrix.script }}

  smoke-prepare:
    runs-on: ubuntu-20.04
    needs:
      - validate-dco
    outputs:
      matrix: ${{ steps.platforms.outputs.matrix }}
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
      -
        name: Create matrix
        id: platforms
        run: |
          matrix="$(docker buildx bake binary-smoketest --print | jq -cr '.target."binary-smoketest".platforms')"
          echo "matrix=$matrix" >> $GITHUB_OUTPUT
      -
        name: Show matrix
        run: |
          echo ${{ steps.platforms.outputs.matrix }}

  smoke:
    runs-on: ubuntu-20.04
    needs:
      - smoke-prepare
    strategy:
      fail-fast: false
      matrix:
        platform: ${{ fromJson(needs.smoke-prepare.outputs.matrix) }}
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
      -
        name: Prepare
        run: |
          platform=${{ matrix.platform }}
          echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
      -
        name: Set up QEMU
        uses: docker/setup-qemu-action@v2
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      -
        name: Test
        uses: docker/bake-action@v2
        with:
          targets: binary-smoketest
          set: |
            *.platform=${{ matrix.platform }}

Yes I was thinking it was not necessary as we are tagging on a commit that was already checked anyway