From bcf8ca82ad571bb0a04f028193b3f56486cfbeb4 Mon Sep 17 00:00:00 2001 From: Marco Ferrari Date: Wed, 10 Jul 2024 14:45:32 +0200 Subject: [PATCH] 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. --- .github/workflows/ci.yml | 4 ++++ Makefile | 26 +++++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f83e8638..884d304c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -152,6 +152,10 @@ jobs: docker load --input /tmp/${{ env.CONTAINER_IMAGE_OUTPUT_IMAGE_NAME }}.tar docker image ls -a + - name: Print environment info + run: | + make info + - name: Update action.yml run: | echo "yq version: $(yq --version)" diff --git a/Makefile b/Makefile index a0b764e1..7a9c994a 100644 --- a/Makefile +++ b/Makefile @@ -14,14 +14,6 @@ ifeq ($(INTERACTIVE), 1) DOCKER_FLAGS += -t 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 help: ## Show help @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" - ifeq ($(GITHUB_HEAD_REF),) RELEASE_PLEASE_TARGET_BRANCH := "$(shell git branch --show-current)" else RELEASE_PLEASE_TARGET_BRANCH := "${GITHUB_HEAD_REF}" 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 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