Skip to content

Commit 5d6dc93

Browse files
committed
Avoid need for Mac runner to run hadolint
Using the Docker version of hadolint allows the job to use `ubuntu-slim`.
1 parent 8bbc2a4 commit 5d6dc93

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

.github/workflows/ci.yaml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,9 @@ on:
4444
default: true
4545

4646
env:
47-
# Default Python version to use.
47+
# Python version to use for actions/setup-python.
4848
python-version: '3.13'
49-
# Add xtrace to SHELLOPTS for all Bash scripts when doing debug runs.
5049
SHELLOPTS: ${{inputs.debug && 'xtrace'}}
51-
# Don't bother showing progress bars for pip commands.
5250
PIP_PROGRESS_BAR: 'off'
5351

5452
concurrency:
@@ -104,8 +102,7 @@ jobs:
104102
105103
docker-lint:
106104
name: Dockerfile lint checks
107-
# This uses a Mac runner because hadolint isn't available via Linux apt.
108-
runs-on: macos-15
105+
runs-on: ubuntu-slim
109106
timeout-minutes: 15
110107
steps:
111108
- name: Check out a copy of the git repository
@@ -119,18 +116,18 @@ jobs:
119116
with:
120117
files: '**/Dockerfile'
121118

122-
# Note: there is a hadolint GitHub Actions available, but it only accepts
123-
# one Dockerfile to check. We have > 1 file to check, so we need the CLI.
124-
- name: Install hadolint
125-
if: steps.changes.outputs.any_changed == 'true'
126-
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install hadolint
127-
128119
- name: Run hadolint on Dockerfiles that have been changed
129120
if: steps.changes.outputs.any_changed == 'true'
121+
env:
122+
hadolint_version: 'sha256:e9dbf5113239ef2bf696d20c8f28d3019a47c26a38c98b89344d3e2846c4d5f8'
130123
run: |
131124
echo '::add-matcher::.github/problem-matchers/hadolint.json'
132-
hadolint --version
133-
hadolint ${{steps.changes.outputs.all_changed_files}}
125+
for file in ${{steps.changes.outputs.all_changed_files}}; do
126+
echo "Checking ${file} ..."
127+
docker run --rm -i -v "${PWD}"/.hadolint.yaml:/.config/hadolint.yaml \
128+
ghcr.io/hadolint/hadolint@${{env.hadolint_version}} < "${file}"
129+
done
130+
echo 'Done ...'
134131
135132
shell-lint:
136133
name: Shell script lint checks

0 commit comments

Comments
 (0)