hadolint / hadolint-action

GitHub action for Hadolint, A Dockerfile linting tool
MIT License
192 stars 50 forks source link

hadolint-action builds out of turn #86

Open anoronh4 opened 1 month ago

anoronh4 commented 1 month ago

i have a github action workflow where i want to start by maximizing the build space and then running all actions after. so my workflow has :

  dockerfile-validate-build:
    runs-on: ubuntu-latest
    name: dockerfile-build
    needs: [dockerfile-changes]
    if: needs.dockerfile-changes.outputs.docker-images != '[]'
    strategy:
      fail-fast: false
      matrix:
        tags: ["${{ fromJson(needs.dockerfile-changes.outputs.docker-images) }}"]
    steps:
      - name: Maximize build space
        uses: easimon/maximize-build-space@master
        with:
          build-mount-path: /var/lib/docker/
          remove-dotnet: 'true'
          remove-android: 'true'
          remove-haskell: 'true'
          remove-codeql: 'true'
      - name: Restart docker
        run: sudo service docker restart
      - name: Checkout
        uses: actions/checkout@v4
      - name: Hadolint
        uses: hadolint/hadolint-action@v3.1.0
        with:
          dockerfile: containers/${{ matrix.tags }}/Dockerfile
          verbose: true

However, for whatever reason, hadolint builds before any of the other steps. so after docker is restarted, the hadolint step runs and fails Screenshot 2024-06-27 at 4 51 42 PM

It doesn't seem like i can control when hadolint gets built through the order of steps in my workflow. i was wondering why this is happening and how i can control the order of events here?