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.
This commit is contained in:
Marco Ferrari 2024-07-11 08:08:23 +02:00 committed by GitHub
parent 6bd76596f3
commit 12da4973c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 5 deletions

View file

@ -4,7 +4,7 @@
all: info docker test ## Run all targets. all: info docker test ## Run all targets.
.PHONY: test .PHONY: test
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 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
# if this session isn't interactive, then we don't want to allocate a # if this session isn't interactive, then we don't want to allocate a
# TTY, which would fail, but if it is interactive, we do want to attach # TTY, which would fail, but if it is interactive, we do want to attach
@ -119,7 +119,7 @@ inspec: inspec-check ## Run InSpec tests
&& docker kill $(SUPER_LINTER_TEST_CONTAINER_NAME) && docker kill $(SUPER_LINTER_TEST_CONTAINER_NAME)
.PHONY: docker .PHONY: docker
docker: check-github-token ## Build the container image docker: docker-build-check check-github-token ## Build the container image
DOCKER_BUILDKIT=1 docker buildx build --load \ DOCKER_BUILDKIT=1 docker buildx build --load \
--build-arg BUILD_DATE=$(BUILD_DATE) \ --build-arg BUILD_DATE=$(BUILD_DATE) \
--build-arg BUILD_REVISION=$(BUILD_REVISION) \ --build-arg BUILD_REVISION=$(BUILD_REVISION) \
@ -128,7 +128,7 @@ docker: check-github-token ## Build the container image
--target $(IMAGE) \ --target $(IMAGE) \
-t $(SUPER_LINTER_TEST_CONTAINER_URL) . -t $(SUPER_LINTER_TEST_CONTAINER_URL) .
.PHONY: docker-build-check ## Run Docker build checks .PHONY: docker-build-check ## Run Docker build checks against the Super-linter image
docker-build-check: docker-build-check:
DOCKER_BUILDKIT=1 docker buildx build --check \ DOCKER_BUILDKIT=1 docker buildx build --check \
. .
@ -418,8 +418,13 @@ test-save-super-linter-output-custom-path: ## Run super-linter with SAVE_SUPER_L
$(SUPER_LINTER_TEST_CONTAINER_URL) \ $(SUPER_LINTER_TEST_CONTAINER_URL) \
"run_test_cases_save_super_linter_output_custom_path" "run_test_cases_save_super_linter_output_custom_path"
.PHONY: docker-dev-container-build-check ## Run Docker build checks against the dev-container image
docker-dev-container-build-check:
DOCKER_BUILDKIT=1 docker buildx build --check \
"${CURDIR}/dev-dependencies"
.PHONY: build-dev-container-image .PHONY: build-dev-container-image
build-dev-container-image: ## Build commit linter container image build-dev-container-image: docker-dev-container-build-check ## Build commit linter container image
DOCKER_BUILDKIT=1 docker buildx build --load \ DOCKER_BUILDKIT=1 docker buildx build --load \
--build-arg GID=$(shell id -g) \ --build-arg GID=$(shell id -g) \
--build-arg UID=$(shell id -u) \ --build-arg UID=$(shell id -u) \

View file

@ -29,4 +29,4 @@ ARG UID=1000
ARG GID=1000 ARG GID=1000
RUN groupadd -g ${GID} -o "${USERNAME}" \ RUN groupadd -g ${GID} -o "${USERNAME}" \
&& useradd -m -u ${UID} -g ${GID} -o -s /bin/bash -l "${USERNAME}" && useradd -m -u ${UID} -g ${GID} -o -s /bin/bash -l "${USERNAME}"
USER $UNAME USER $USERNAME