From fa1c334a30514a2287bf52aa15dd003d4ac3935a Mon Sep 17 00:00:00 2001 From: Peter Leitzen <pleitzen@gitlab.com> Date: Thu, 15 Feb 2024 13:31:35 +0100 Subject: [PATCH] CI: Strip binaries produced by setup-test-env This reduces artifacts size from 321 MB to 208 MB. --- .gitlab/ci/rails.gitlab-ci.yml | 1 + scripts/gitlab_component_helpers.sh | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/.gitlab/ci/rails.gitlab-ci.yml b/.gitlab/ci/rails.gitlab-ci.yml index 235c4b87710de..2f0700454b554 100644 --- a/.gitlab/ci/rails.gitlab-ci.yml +++ b/.gitlab/ci/rails.gitlab-ci.yml @@ -25,6 +25,7 @@ setup-test-env: - section_start "setup-test-env" "Setting up testing environment"; scripts/setup-test-env; section_end "setup-test-env"; - select_gitlab_workhorse_essentials - section_start "gitaly-test-build" "Compiling Gitaly binaries"; scripts/gitaly-test-build; section_end "gitaly-test-build"; # Do not use 'bundle exec' here + - strip_executable_binaries "${TMP_TEST_FOLDER}" artifacts: expire_in: 7d paths: diff --git a/scripts/gitlab_component_helpers.sh b/scripts/gitlab_component_helpers.sh index 98688d3864381..3d9f996e7c034 100644 --- a/scripts/gitlab_component_helpers.sh +++ b/scripts/gitlab_component_helpers.sh @@ -91,6 +91,12 @@ function select_gitlab_workhorse_essentials() { mv ${tmp_path} ${TMP_TEST_FOLDER} } +function strip_executable_binaries() { + local path="$1" + + find "$path" -executable -type f ! -size 0 -print0 | xargs -0 grep -IL . | xargs strip || true +} + # Assets functions function gitlab_assets_archive_doesnt_exist() { archive_doesnt_exist "${GITLAB_ASSETS_PACKAGE_URL}" -- GitLab