Skip to content

Commit a560eff

Browse files
committed
ci: Use Hadolint linter for Dockerfile, revert workflow to pull_request
Workflows running on pull_request_target events run in the context of the base of the pull request, meaning that the Docker image is built from the base and not from the merge commit. This is not what we want. Revert to pull_request instead. For the linter action that we used, this means that the workflow will fail when running from fork. There is a related issue on the Action's repository, but it seems to get very little activity. Let's switch to something that looks better maintained, and that does not have issues with running from forks. Let's address the reports raised by the new linter, Hadolint. Fixes: 7daff43 ("ci: Run Docker CI job on pull_request_target instead of pull_request") Signed-off-by: Quentin Monnet <[email protected]>
1 parent b0f6c9d commit a560eff

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

.github/workflows/docker.yaml

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: docker
22

33
on:
4-
pull_request_target: {}
4+
pull_request: {}
55
push:
66
branches:
77
- master
@@ -29,8 +29,6 @@ jobs:
2929
docker run --rm --privileged --pid=host bpftool map
3030
3131
- name: Lint Docker image
32-
uses: luke142367/Docker-Lint-Action@5c4c86226f39785a66827bbc2e322600c9afa3a9
32+
uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf
3333
with:
34-
target: Dockerfile
35-
env:
36-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
dockerfile: Dockerfile

Dockerfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# And then use it:
44
# $ docker run --rm -ti --privileged --pid=host bpftool prog
55

6+
# hadolint global ignore=DL3008
7+
68
FROM ubuntu:22.04 as builder
79

810
RUN \
@@ -19,9 +21,9 @@ RUN \
1921
rm -rf /var/lib/apt/lists/*
2022

2123
COPY . /src
22-
RUN cd /src/src && \
23-
make clean && \
24-
make -j $(nproc)
24+
RUN \
25+
make -C /src/src clean && \
26+
make -C /src/src -j "$(nproc)"
2527

2628
FROM ubuntu:22.04
2729
RUN \

0 commit comments

Comments
 (0)