hadolint_dockerfiles.yml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. name: hadolint dockerfiles
  4. on:
  5. # will be triggered on PR events
  6. pull_request:
  7. types:
  8. - opened
  9. - synchronize
  10. paths:
  11. - "**/Dockerfile*"
  12. - ".github/workflows/hadolint_dockerfiles.yml"
  13. push:
  14. branches:
  15. - main
  16. - "dev/**"
  17. paths:
  18. - "**/Dockerfile*"
  19. - ".github/workflows/hadolint_dockerfiles.yml"
  20. # allow to be triggered manually
  21. workflow_dispatch:
  22. # Cancel any in-flight jobs for the same PR/branch so there's only one active
  23. # at a time
  24. concurrency:
  25. group: ${{ github.workflow }}-${{ github.ref }}
  26. cancel-in-progress: true
  27. jobs:
  28. run-hadolint-on-dockerfiles:
  29. runs-on: ubuntu-22.04
  30. steps:
  31. - name: Checkout repository
  32. uses: actions/checkout@v4
  33. # on default, hadolint will fail on warnings and errors
  34. - name: Run hadolint on dockerfiles
  35. run: |
  36. docker pull hadolint/hadolint:latest-debian
  37. find . -name "*Dockerfile*" | while read dockerfile; do
  38. echo "run hadolint on $dockerfile:"
  39. docker run --rm -i hadolint/hadolint:latest-debian hadolint - <"$dockerfile"
  40. echo "successful"
  41. done