ci: print info about the environment, image size (#5869)

- Add information about container image layers size when printing info
  about the environment.
- Print info about the environment during the CI job.
This commit is contained in:
Marco Ferrari 2024-07-10 14:45:32 +02:00 committed by GitHub
parent ce59f5c323
commit bcf8ca82ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 9 deletions

View file

@ -152,6 +152,10 @@ jobs:
docker load --input /tmp/${{ env.CONTAINER_IMAGE_OUTPUT_IMAGE_NAME }}.tar docker load --input /tmp/${{ env.CONTAINER_IMAGE_OUTPUT_IMAGE_NAME }}.tar
docker image ls -a docker image ls -a
- name: Print environment info
run: |
make info
- name: Update action.yml - name: Update action.yml
run: | run: |
echo "yq version: $(yq --version)" echo "yq version: $(yq --version)"

View file

@ -14,14 +14,6 @@ ifeq ($(INTERACTIVE), 1)
DOCKER_FLAGS += -t DOCKER_FLAGS += -t
endif endif
.PHONY: info
info: ## Gather information about the runtime environment
echo "whoami: $$(whoami)"; \
echo "pwd: $$(pwd)"; \
echo "ls -ahl: $$(ls -ahl)"; \
docker images; \
docker ps
.PHONY: help .PHONY: help
help: ## Show help help: ## Show help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@ -79,13 +71,29 @@ endif
DEV_CONTAINER_URL := "super-linter/dev-container:latest" DEV_CONTAINER_URL := "super-linter/dev-container:latest"
ifeq ($(GITHUB_HEAD_REF),) ifeq ($(GITHUB_HEAD_REF),)
RELEASE_PLEASE_TARGET_BRANCH := "$(shell git branch --show-current)" RELEASE_PLEASE_TARGET_BRANCH := "$(shell git branch --show-current)"
else else
RELEASE_PLEASE_TARGET_BRANCH := "${GITHUB_HEAD_REF}" RELEASE_PLEASE_TARGET_BRANCH := "${GITHUB_HEAD_REF}"
endif endif
.PHONY: info
info: ## Gather information about the runtime environment
echo "whoami: $$(whoami)"; \
echo "pwd: $$(pwd)"; \
echo "IMAGE:" $(IMAGE) \
echo "SUPER_LINTER_TEST_CONTAINER_URL:" $(SUPER_LINTER_TEST_CONTAINER_URL) \
echo "ls -ahl: $$(ls -ahl)"; \
docker images; \
docker ps; \
echo "Container image layers size:"; \
docker history \
--human \
--no-trunc \
--format "{{.Size}} {{.CreatedSince}} {{.CreatedBy}}" \
$(SUPER_LINTER_TEST_CONTAINER_URL) \
| sort --human
.PHONY: check-github-token .PHONY: check-github-token
check-github-token: check-github-token:
@if [ ! -f "${GITHUB_TOKEN_PATH}" ]; then echo "Cannot find the file to load the GitHub access token: $(GITHUB_TOKEN_PATH). Create a readable file there, and populate it with a GitHub personal access token."; exit 1; fi @if [ ! -f "${GITHUB_TOKEN_PATH}" ]; then echo "Cannot find the file to load the GitHub access token: $(GITHUB_TOKEN_PATH). Create a readable file there, and populate it with a GitHub personal access token."; exit 1; fi