File tree Expand file tree Collapse file tree 7 files changed +62
-1
lines changed Expand file tree Collapse file tree 7 files changed +62
-1
lines changed Original file line number Diff line number Diff line change 1717# Build the manager binary
1818# Run this with docker build --build-arg builder_image=<golang:x.y.z>
1919ARG builder_image
20+
21+ # Ignore Hadolint rule "Always tag the version of an image explicitly."
22+ # It's an invalid finding since the image is explicitly set in the Makefile.
23+ # https://github.com/hadolint/hadolint/wiki/DL3006
24+ # hadolint ignore=DL3006
2025FROM ${builder_image} as builder
2126WORKDIR /workspace
2227
Original file line number Diff line number Diff line change @@ -111,6 +111,9 @@ GO_APIDIFF_BIN := go-apidiff
111111GO_APIDIFF := $(abspath $(TOOLS_BIN_DIR ) /$(GO_APIDIFF_BIN ) -$(GO_APIDIFF_VER ) )
112112GO_APIDIFF_PKG := github.com/joelanford/go-apidiff
113113
114+ HADOLINT_VER := v2.10.0
115+ HADOLINT_FAILURE_THRESHOLD = warning
116+
114117KPROMO_VER := v3.4.4
115118KPROMO_BIN := kpromo
116119KPROMO := $(abspath $(TOOLS_BIN_DIR ) /$(KPROMO_BIN ) -$(KPROMO_VER ) )
@@ -446,6 +449,11 @@ lint: $(GOLANGCI_LINT) ## Lint the codebase
446449 $(GOLANGCI_LINT ) run -v $(GOLANGCI_LINT_EXTRA_ARGS )
447450 cd $(TEST_DIR ) ; $(GOLANGCI_LINT ) run -v $(GOLANGCI_LINT_EXTRA_ARGS )
448451 cd $(TOOLS_DIR ) ; $(GOLANGCI_LINT ) run -v $(GOLANGCI_LINT_EXTRA_ARGS )
452+ ./scripts/ci-lint-dockerfiles.sh $(HADOLINT_VER ) $(HADOLINT_FAILURE_THRESHOLD )
453+
454+ .PHONY : lint-dockerfiles
455+ lint-dockerfiles :
456+ ./scripts/ci-lint-dockerfiles.sh $(HADOLINT_VER ) $(HADOLINT_FAILURE_THRESHOLD )
449457
450458.PHONY : lint-fix
451459lint-fix : $(GOLANGCI_LINT ) # # Lint the codebase and run auto-fixers if supported by the linter
Original file line number Diff line number Diff line change 1717# Build the clusterctl binary
1818# Run this with docker build --build-arg builder_image=<golang:x.y.z>
1919ARG builder_image
20+
21+ # Ignore Hadolint rule "Always tag the version of an image explicitly."
22+ # It's an invalid finding since the image is explicitly set in the Makefile.
23+ # https://github.com/hadolint/hadolint/wiki/DL3006
24+ # hadolint ignore=DL3006
2025FROM ${builder_image} as builder
2126WORKDIR /workspace
2227
Original file line number Diff line number Diff line change 3131
3232FROM maven:3-jdk-8
3333
34- RUN apt-get update && apt-get install -y --no-install-recommends graphviz fonts-symbola fonts-wqy-zenhei && rm -rf /var/lib/apt/lists/*
34+ RUN apt-get update && apt-get install -y --no-install-recommends graphviz=2.42.2-5 fonts-symbola=2.60-1.1 fonts-wqy-zenhei=0.9.45-8 && rm -rf /var/lib/apt/lists/*
3535RUN wget -O /plantuml.jar http://sourceforge.net/projects/plantuml/files/plantuml.1.2019.6.jar/download
3636
3737# By default, java writes a 'hsperfdata_<username>' directory in the work dir.
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Copyright 2022 The Kubernetes Authors.
4+ #
5+ # Licensed under the Apache License, Version 2.0 (the "License");
6+ # you may not use this file except in compliance with the License.
7+ # You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing, software
12+ # distributed under the License is distributed on an "AS IS" BASIS,
13+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ # See the License for the specific language governing permissions and
15+ # limitations under the License.
16+
17+ set -o errexit
18+ set -o nounset
19+ set -o pipefail
20+
21+ HADOLINT_VER=${1:- latest}
22+ HADOLINT_FAILURE_THRESHOLD=${2:- warning}
23+
24+ FILES=$( find -- * -name Dockerfile)
25+ while read -r file; do
26+ echo " Linting: ${file} "
27+ # Configure the linter to fail for warnings and errors. Can be set to: error | warning | info | style | ignore | none
28+ docker run --rm -i ghcr.io/hadolint/hadolint:" ${HADOLINT_VER} " hadolint --failure-threshold " ${HADOLINT_FAILURE_THRESHOLD} " - < " ${file} "
29+ done <<< " ${FILES}"
Original file line number Diff line number Diff line change 1717# Build the extension binary
1818# Run this with docker build --build-arg builder_image=<golang:x.y.z>
1919ARG builder_image
20+
21+ # Ignore Hadolint rule "Always tag the version of an image explicitly."
22+ # It's an invalid finding since the image is explicitly set in the Makefile.
23+ # https://github.com/hadolint/hadolint/wiki/DL3006
24+ # hadolint ignore=DL3006
2025FROM ${builder_image} as builder
2126WORKDIR /workspace
2227
Original file line number Diff line number Diff line change 1616
1717# Run this with docker build --build-arg builder_image=<golang:x.y.z>
1818ARG builder_image
19+
20+ # Ignore Hadolint rule "Always tag the version of an image explicitly."
21+ # It's an invalid finding since the image is explicitly set in the Makefile.
22+ # https://github.com/hadolint/hadolint/wiki/DL3006
23+ # hadolint ignore=DL3006
1924FROM ${builder_image} as builder
2025
2126# Run this with docker build --build-arg goproxy=$(go env GOPROXY) to override the goproxy
@@ -58,6 +63,10 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
5863 CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -trimpath -a -o /workspace/manager main.go
5964
6065# NOTE: CAPD can't use non-root because docker requires access to the docker socket
66+
67+ # Ignore Hadolint rule "Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag."
68+ # https://github.com/hadolint/hadolint/wiki/DL3007
69+ # hadolint ignore=DL3007
6170FROM gcr.io/distroless/static:latest
6271
6372WORKDIR /
You can’t perform that action at this time.
0 commit comments