ci: Provide artifacts in top-level output dir

.gitlab/ci/build-inside-vm.sh:
Change the build script to provide the build artifacts and metrics in the top-level output directory.
This goes in line with the soon to be used ci-scripts, allowing code sharing amongst several projects.
This commit is contained in:
David Runge 2021-06-30 23:23:21 +02:00
parent a44310b220
commit e0514b1d2e
No known key found for this signature in database
GPG Key ID: 7258734B41C31549

View File

@ -104,7 +104,7 @@ create_zsync_delta() {
} }
create_metrics() { create_metrics() {
local _metrics="${output}/${profile}/metrics.txt" local _metrics="${output}/metrics.txt"
# create metrics # create metrics
print_section_start "metrics" "Creating metrics" print_section_start "metrics" "Creating metrics"
@ -114,19 +114,19 @@ create_metrics() {
iso) iso)
printf 'image_size_mebibytes{image="%s"} %s\n' \ printf 'image_size_mebibytes{image="%s"} %s\n' \
"${profile}" \ "${profile}" \
"$(du -m -- "${output}/${profile}/"*.iso | cut -f1)" "$(du -m -- "${output}/"*.iso | cut -f1)"
printf 'package_count{image="%s"} %s\n' \ printf 'package_count{image="%s"} %s\n' \
"${profile}" \ "${profile}" \
"$(sort -u -- "${tmpdir}/${profile}/iso/"*/pkglist.*.txt | wc -l)" "$(sort -u -- "${tmpdir}/iso/"*/pkglist.*.txt | wc -l)"
if [[ -e "${tmpdir}/${profile}/efiboot.img" ]]; then if [[ -e "${tmpdir}/efiboot.img" ]]; then
printf 'eltorito_efi_image_size_mebibytes{image="%s"} %s\n' \ printf 'eltorito_efi_image_size_mebibytes{image="%s"} %s\n' \
"${profile}" \ "${profile}" \
"$(du -m -- "${tmpdir}/${profile}/efiboot.img" | cut -f1)" "$(du -m -- "${tmpdir}/efiboot.img" | cut -f1)"
fi fi
# shellcheck disable=SC2046 # shellcheck disable=SC2046
# shellcheck disable=SC2183 # shellcheck disable=SC2183
printf 'initramfs_size_mebibytes{image="%s",initramfs="%s"} %s\n' \ printf 'initramfs_size_mebibytes{image="%s",initramfs="%s"} %s\n' \
$(du -m -- "${tmpdir}/${profile}/iso/"*/boot/**/initramfs*.img | \ $(du -m -- "${tmpdir}/iso/"*/boot/**/initramfs*.img | \
awk -v profile="${profile}" \ awk -v profile="${profile}" \
'function basename(file) { 'function basename(file) {
sub(".*/", "", file) sub(".*/", "", file)
@ -138,18 +138,18 @@ create_metrics() {
netboot) netboot)
printf 'netboot_size_mebibytes{image="%s"} %s\n' \ printf 'netboot_size_mebibytes{image="%s"} %s\n' \
"${profile}" \ "${profile}" \
"$(du -m -- "${output}/${profile}/${install_dir}/" | tail -n1 | cut -f1)" "$(du -m -- "${output}/${install_dir}/" | tail -n1 | cut -f1)"
printf 'netboot_package_count{image="%s"} %s\n' \ printf 'netboot_package_count{image="%s"} %s\n' \
"${profile}" \ "${profile}" \
"$(sort -u -- "${tmpdir}/${profile}/iso/"*/pkglist.*.txt | wc -l)" "$(sort -u -- "${tmpdir}/iso/"*/pkglist.*.txt | wc -l)"
;; ;;
bootstrap) bootstrap)
printf 'bootstrap_size_mebibytes{image="%s"} %s\n' \ printf 'bootstrap_size_mebibytes{image="%s"} %s\n' \
"${profile}" \ "${profile}" \
"$(du -m -- "${output}/${profile}/"*.tar*(.gz|.xz|.zst) | cut -f1)" "$(du -m -- "${output}/"*.tar*(.gz|.xz|.zst) | cut -f1)"
printf 'bootstrap_package_count{image="%s"} %s\n' \ printf 'bootstrap_package_count{image="%s"} %s\n' \
"${profile}" \ "${profile}" \
"$(sort -u -- "${tmpdir}/${profile}/"*/bootstrap/root.*/pkglist.*.txt | wc -l)" "$(sort -u -- "${tmpdir}/"*/bootstrap/root.*/pkglist.*.txt | wc -l)"
;; ;;
esac esac
} > "${_metrics}" } > "${_metrics}"
@ -235,25 +235,25 @@ run_mkarchiso() {
create_ephemeral_codesigning_key create_ephemeral_codesigning_key
print_section_start "mkarchiso" "Running mkarchiso" print_section_start "mkarchiso" "Running mkarchiso"
mkdir -p "${output}/${profile}" "${tmpdir}/${profile}" mkdir -p "${output}/" "${tmpdir}/"
GNUPGHOME="${gnupg_homedir}" ./archiso/mkarchiso \ GNUPGHOME="${gnupg_homedir}" ./archiso/mkarchiso \
-D "${install_dir}" \ -D "${install_dir}" \
-c "${codesigning_cert} ${codesigning_key}" \ -c "${codesigning_cert} ${codesigning_key}" \
-g "${pgp_key_id}" \ -g "${pgp_key_id}" \
-o "${output}/${profile}" \ -o "${output}/" \
-w "${tmpdir}/${profile}" \ -w "${tmpdir}/" \
-m "${buildmode}" \ -m "${buildmode}" \
-v "configs/${profile}" -v "configs/${profile}"
print_section_end "mkarchiso" print_section_end "mkarchiso"
if [[ "${buildmode}" =~ "iso" ]]; then if [[ "${buildmode}" =~ "iso" ]]; then
create_zsync_delta "${output}/${profile}/"*.iso create_zsync_delta "${output}/"*.iso
create_checksums "${output}/${profile}/"*.iso create_checksums "${output}/"*.iso
fi fi
if [[ "${buildmode}" == "bootstrap" ]]; then if [[ "${buildmode}" == "bootstrap" ]]; then
create_zsync_delta "${output}/${profile}/"*.tar*(.gz|.xz|.zst) create_zsync_delta "${output}/"*.tar*(.gz|.xz|.zst)
create_checksums "${output}/${profile}/"*.tar*(.gz|.xz|.zst) create_checksums "${output}/"*.tar*(.gz|.xz|.zst)
fi fi
create_metrics create_metrics