Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornl6720 <nl6720@gmail.com>2021-04-02 12:23:18 +0300
committernl6720 <nl6720@gmail.com>2021-04-30 19:44:37 +0300
commit0ed1c61f1fc3708722fc8593ca8e31b4bc8946d1 (patch)
treeaaaf94a7d6d6a487cf7bc7788cd5fb8ae4574b98
parent8bf95d37d3c7d50cd6c452a57d0706ced1db6f89 (diff)
Add package count, El Torito EFI image size and initramfs image sizes to GitLab metrics
Metrics are now collected in build-inside-vm.sh since the files in question are in the work directory. Implements #101 and #111.
-rw-r--r--.gitlab-ci.yml2
-rwxr-xr-x.gitlab/ci/build-inside-vm.sh22
2 files changed, 23 insertions, 1 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 95d688e..921bc07 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -23,7 +23,7 @@ shellcheck:
script:
- ./.gitlab/ci/build-host.sh
after_script:
- - echo "image_size_mebibytes{image=\"${PROFILE}\"} $(du -m output/${PROFILE}/*iso)" > metrics.txt
+ - cp -- "output/${PROFILE}/job-metrics" metrics.txt
parallel:
matrix:
- PROFILE: [baseline, releng]
diff --git a/.gitlab/ci/build-inside-vm.sh b/.gitlab/ci/build-inside-vm.sh
index 8e433b1..ca404bb 100755
--- a/.gitlab/ci/build-inside-vm.sh
+++ b/.gitlab/ci/build-inside-vm.sh
@@ -36,6 +36,27 @@ create_zsync_delta() {
fi
}
+create_metrics() {
+ # create metrics
+ {
+ printf 'image_size_mebibytes{image="%s"} %s\n' "${1}" "$(du -m "${output}/${1}/"*.iso | cut -f1)"
+ printf 'package_count{image="%s"} %s\n' "${1}" "$(sort -u "${tmpdir}/${1}/iso/"*/pkglist.*.txt | wc -l)"
+ if [[ -e "${tmpdir}/${1}/efiboot.img" ]]; then
+ printf 'eltorito_efi_image_size_mebibytes{image="%s"} %s\n' \
+ "${1}" "$(du -m "${tmpdir}/${1}/efiboot.img" | cut -f1)"
+ fi
+ # shellcheck disable=SC2046
+ # shellcheck disable=SC2183
+ printf 'initramfs_size_mebibytes{image="%s",initramfs="%s"} %s\n' \
+ $(du -m "${tmpdir}/${1}/iso/"*/boot/**/initramfs*.img | awk -v profile="${1}" '
+ function basename(file) {
+ sub(".*/", "", file)
+ return file
+ }
+ { print profile, basename($2), $1 }')
+ } > "${output}/${1}/job-metrics"
+}
+
run_mkarchiso() {
# run mkarchiso
# $1: template name
@@ -43,6 +64,7 @@ run_mkarchiso() {
./archiso/mkarchiso -o "${output}/${1}" -w "${tmpdir}/${1}" -v "configs/${1}"
create_checksums "${output}/${1}/"*.iso
create_zsync_delta "${output}/${1}/"*.iso
+ create_metrics "${1}"
}
trap cleanup EXIT