Skip to content

Commit 12da497

Browse files
authored
ci: enable dev-dependencies docker build checks (#5871)
- Run Docker build checks when building the dev-dependencies container image and when running the test target. - Run Docker build checks when building the Super-linter container, and not just when running the test target. - Use the correct variable when setting the dev-dependencies container user.
1 parent 6bd7659 commit 12da497

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

‎Makefile‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
all: info docker test ## Run all targets.
55

66
.PHONY: test
7-
test: info validate-container-image-labels docker-build-check test-lib inspec lint-codebase test-default-config-files test-actions-runner-debug test-actions-steps-debug test-runner-debug test-find lint-subset-files test-custom-ssl-cert test-non-default-workdir test-git-flags test-non-default-home-directory test-git-initial-commit test-log-level test-use-find-and-ignore-gitignored-files test-linters-expect-failure-log-level-notice test-bash-exec-library-expect-success test-bash-exec-library-expect-failure test-save-super-linter-output test-save-super-linter-output-custom-path test-linters ## Run the test suite
7+
test: info validate-container-image-labels docker-build-check docker-dev-container-build-check test-lib inspec lint-codebase test-default-config-files test-actions-runner-debug test-actions-steps-debug test-runner-debug test-find lint-subset-files test-custom-ssl-cert test-non-default-workdir test-git-flags test-non-default-home-directory test-git-initial-commit test-log-level test-use-find-and-ignore-gitignored-files test-linters-expect-failure-log-level-notice test-bash-exec-library-expect-success test-bash-exec-library-expect-failure test-save-super-linter-output test-save-super-linter-output-custom-path test-linters ## Run the test suite
88

99
# if this session isn't interactive, then we don't want to allocate a
1010
# TTY, which would fail, but if it is interactive, we do want to attach
@@ -119,7 +119,7 @@ inspec: inspec-check ## Run InSpec tests
119119
&& docker kill $(SUPER_LINTER_TEST_CONTAINER_NAME)
120120

121121
.PHONY: docker
122-
docker: check-github-token ## Build the container image
122+
docker: docker-build-check check-github-token ## Build the container image
123123
DOCKER_BUILDKIT=1 docker buildx build --load \
124124
--build-arg BUILD_DATE=$(BUILD_DATE) \
125125
--build-arg BUILD_REVISION=$(BUILD_REVISION) \
@@ -128,7 +128,7 @@ docker: check-github-token ## Build the container image
128128
--target $(IMAGE) \
129129
-t $(SUPER_LINTER_TEST_CONTAINER_URL) .
130130

131-
.PHONY: docker-build-check ## Run Docker build checks
131+
.PHONY: docker-build-check ## Run Docker build checks against the Super-linter image
132132
docker-build-check:
133133
DOCKER_BUILDKIT=1 docker buildx build --check \
134134
.
@@ -418,8 +418,13 @@ test-save-super-linter-output-custom-path: ## Run super-linter with SAVE_SUPER_L
418418
$(SUPER_LINTER_TEST_CONTAINER_URL) \
419419
"run_test_cases_save_super_linter_output_custom_path"
420420

421+
.PHONY: docker-dev-container-build-check ## Run Docker build checks against the dev-container image
422+
docker-dev-container-build-check:
423+
DOCKER_BUILDKIT=1 docker buildx build --check \
424+
"${CURDIR}/dev-dependencies"
425+
421426
.PHONY: build-dev-container-image
422-
build-dev-container-image: ## Build commit linter container image
427+
build-dev-container-image: docker-dev-container-build-check ## Build commit linter container image
423428
DOCKER_BUILDKIT=1 docker buildx build --load \
424429
--build-arg GID=$(shell id -g) \
425430
--build-arg UID=$(shell id -u) \

‎dev-dependencies/Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ ARG UID=1000
2929
ARG GID=1000
3030
RUN groupadd -g ${GID} -o "${USERNAME}" \
3131
&& useradd -m -u ${UID} -g ${GID} -o -s /bin/bash -l "${USERNAME}"
32-
USER $UNAME
32+
USER $USERNAME

0 commit comments

Comments
 (0)