CI: Consider stripping precompiled binaries
Problem
The CI job setup-test-env
produces an artifact which contains precompiled binaries to be used by (almost) all other CI jobs in our GitLab pipeline.
As of now, this artifact is 321 MB large and contains binaries which are not stripped (containing symbols for debugging purposes):
tmp/tests/gitlab-workhorse/gitlab-zip-cat: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=330280079cd37e32b5236066bf0236502d42bd3d, with debug_info, not stripped
tmp/tests/gitlab-workhorse/gitlab-zip-metadata: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=bec5e1cba1d4dbb9f98a95951db112ce3c4fbee7, with debug_info, not stripped
tmp/tests/gitlab-workhorse/gitlab-workhorse: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=e40b9ea802b3f7f7fe83d86fa40bdce5ff9a9576, with debug_info, not stripped
tmp/tests/gitlab-workhorse/gitlab-resize-image: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=6c7a6a4a72ba22128d88f6ede06cdfb390e4d21e, with debug_info, not stripped
tmp/tests/gitlab-elasticsearch-indexer/bin/gitlab-elasticsearch-indexer: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=86ab77016ee90c42176b5b1cfce19e87be238307, for GNU/Linux 3.2.0, with debug_info, not stripped
tmp/tests/gitaly/_build/bin/gitaly-git-http-backend-v2.43: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a409aa8428631087e8baa7c4ae0ed88be855e014, for GNU/Linux 3.2.0, with debug_info, not stripped
tmp/tests/gitaly/_build/bin/praefect: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=c3521cc3739d86a8e41623e4843411b162b859a1, with debug_info, not stripped
tmp/tests/gitaly/_build/bin/gitaly-git-remote-http-v2.43: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=59da7592a222c1ccbf6219e68586b17dc09ac988, for GNU/Linux 3.2.0, with debug_info, not stripped
tmp/tests/gitaly/_build/bin/gitaly-lfs-smudge: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=3ad48891822bb215b75e1aafad172553a4da6194, with debug_info, not stripped
tmp/tests/gitaly/_build/bin/gitaly-ssh: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=898f9878308f1bb400dfb386c987b7bd99efc5b6, with debug_info, not stripped
tmp/tests/gitaly/_build/bin/gitaly-debug: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=2a58534bea6bfb8ce2d12364a2fa511079eb50b8, with debug_info, not stripped
tmp/tests/gitaly/_build/bin/gitaly-hooks: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=0c98ec633e915edae571b3d4495970f21416f893, with debug_info, not stripped
tmp/tests/gitaly/_build/bin/gitaly-gpg: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a5735872126e9acac32982afa3b61ea031e43f10, with debug_info, not stripped
tmp/tests/gitaly/_build/bin/gitaly-blackbox: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=b810330903da09fa9b889bddf337b85814d742fc, with debug_info, not stripped
tmp/tests/gitaly/_build/bin/gitaly-wrapper: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=253be4cccb1270f05f6f6a40f8b70861ce9dc5af, with debug_info, not stripped
tmp/tests/gitaly/_build/bin/gitaly: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=578101505c6ce56276e61e7fd9b40cb21ee59e8b, with debug_info, not stripped
tmp/tests/gitaly/_build/bin/gitaly-backup: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=913b7e6c9a2a3c5ad270dfea62f2ea05ea71a1d9, with debug_info, not stripped
tmp/tests/gitaly/_build/bin/gitaly-git-v2.43: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=6423b71d7c598b0df516ac668b718f97944d467e, for GNU/Linux 3.2.0, with debug_info, not stripped
Proposed solution
To reduce download time of artifacts we could strip all binaries reducing the artifact to ~208 MB (from 321 MB):
tmp/tests/gitlab-workhorse/gitlab-zip-cat: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=330280079cd37e32b5236066bf0236502d42bd3d, stripped
tmp/tests/gitlab-workhorse/gitlab-zip-metadata: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=bec5e1cba1d4dbb9f98a95951db112ce3c4fbee7, stripped
tmp/tests/gitlab-workhorse/gitlab-workhorse: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=e40b9ea802b3f7f7fe83d86fa40bdce5ff9a9576, stripped
tmp/tests/gitlab-workhorse/gitlab-resize-image: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=6c7a6a4a72ba22128d88f6ede06cdfb390e4d21e, stripped
tmp/tests/gitlab-elasticsearch-indexer/bin/gitlab-elasticsearch-indexer: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=86ab77016ee90c42176b5b1cfce19e87be238307, for GNU/Linux 3.2.0, stripped
tmp/tests/gitaly/_build/bin/gitaly-git-http-backend-v2.43: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a409aa8428631087e8baa7c4ae0ed88be855e014, for GNU/Linux 3.2.0, stripped
tmp/tests/gitaly/_build/bin/praefect: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=c3521cc3739d86a8e41623e4843411b162b859a1, stripped
tmp/tests/gitaly/_build/bin/gitaly-git-remote-http-v2.43: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=59da7592a222c1ccbf6219e68586b17dc09ac988, for GNU/Linux 3.2.0, stripped
tmp/tests/gitaly/_build/bin/gitaly-lfs-smudge: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=3ad48891822bb215b75e1aafad172553a4da6194, stripped
tmp/tests/gitaly/_build/bin/gitaly-ssh: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=898f9878308f1bb400dfb386c987b7bd99efc5b6, stripped
tmp/tests/gitaly/_build/bin/gitaly-debug: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=2a58534bea6bfb8ce2d12364a2fa511079eb50b8, stripped
tmp/tests/gitaly/_build/bin/gitaly-hooks: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=0c98ec633e915edae571b3d4495970f21416f893, stripped
tmp/tests/gitaly/_build/bin/gitaly-gpg: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a5735872126e9acac32982afa3b61ea031e43f10, stripped
tmp/tests/gitaly/_build/bin/gitaly-blackbox: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=b810330903da09fa9b889bddf337b85814d742fc, stripped
tmp/tests/gitaly/_build/bin/gitaly-wrapper: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=253be4cccb1270f05f6f6a40f8b70861ce9dc5af, stripped
tmp/tests/gitaly/_build/bin/gitaly: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=578101505c6ce56276e61e7fd9b40cb21ee59e8b, stripped
tmp/tests/gitaly/_build/bin/gitaly-backup: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=913b7e6c9a2a3c5ad270dfea62f2ea05ea71a1d9, stripped
tmp/tests/gitaly/_build/bin/gitaly-git-v2.43: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=6423b71d7c598b0df516ac668b718f97944d467e, for GNU/Linux 3.2.0, stripped
This would lower of the duration of download this required artifacts by other CI jobs.
Improvements
As a result of stripping binaries we able to reduce the amount of time spent downloading artifacts from 6214s to 5634s. The average duration downloading an artifact went down from 32s to 29s.
Per spec the duration of downloading artifacts went down from 48s to 40s.
See #442029 (comment 1775193538)
Downsides
When binaries are stripped debugging a binary becomes much harder due to lack of symbols.
We could consider adding a label ~pipeline:binaries-not-stripped
to avoid stripping by default.
See https://docs.gitlab.com/ee/development/pipelines/performance.html#stripped-binaries