From 5780ba0e380d619c7e6632edbf6e357dce73289f Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Fri, 16 Feb 2024 22:34:43 +0100 Subject: fix(release): ensure we release split package uploads as one batch Use a central location in common.sh to define the default rsync options. Switch to use batched uploads by targeting a partial directory which is not taken into account by db update. Instead, once all packages that belong to a split package group are uploaded into the .partial directory, all artifacts are moved in one batch into the staging directory of the repo server. This reduced the window of opportunity for a partial release significantly to a tiny window. Component: pkgctl release --- src/offload-build.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/offload-build.in') diff --git a/src/offload-build.in b/src/offload-build.in index 7a8c1fd..b272a74 100644 --- a/src/offload-build.in +++ b/src/offload-build.in @@ -23,7 +23,7 @@ fi repo=extra arch=x86_64 server=build.archlinux.org -rsyncopts=(-e ssh -c -h -L --progress --partial -y) +rsyncopts=("${RSYNC_OPTS[@]}") usage() { cat <<- _EOF_ -- cgit v1.2.3-70-g09d2 From 952f483574db38b4f39960a9dbafc1bbb387ab0b Mon Sep 17 00:00:00 2001 From: Jakub Klinkovský Date: Sun, 21 Jan 2024 20:13:03 +0100 Subject: feat(offload-build): fetch logs after building from the remote server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since logs from offloaded builds are collected in a temporary directory on the remote server, it is rather difficult/error-prone to get to them, because the path changes in each rebuild. Fetching logs from the server into $LOGDEST makes it easier to investigate them and also brings the behavior of offload-build closer to archbuild. Log files are always downloaded, even for failed builds. Component: offload-build Signed-off-by: Jakub Klinkovský Co-authored-by: Levente Polyak --- src/lib/common.sh | 8 ++++++++ src/offload-build.in | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'src/offload-build.in') diff --git a/src/lib/common.sh b/src/lib/common.sh index 7d04c25..641dea5 100644 --- a/src/lib/common.sh +++ b/src/lib/common.sh @@ -354,6 +354,14 @@ is_debug_package() { [[ ${pkgdesc} == "Detached debugging symbols for "* && ${pkgbase}-debug = "${pkgname}" ]] } +# Proxy function to check if a file exists. Using [[ -f ... ]] directly is not +# always wanted because we might want to expand bash globs first. This way we +# can pass unquoted globs to is_globfile() and have them expanded as function +# arguments before being checked. +is_globfile() { + [[ -f $1 ]] +} + join_by() { local IFS="$1" shift diff --git a/src/offload-build.in b/src/offload-build.in index b272a74..f231ed1 100644 --- a/src/offload-build.in +++ b/src/offload-build.in @@ -107,6 +107,7 @@ mapfile -t files < <( cd "$temp" && { bsdtar --strip-components 1 -xvf - && + export LOGDEST="" && script -qefc "'"${archbuild_cmd[@]@Q}"'" /dev/null && printf "%s\n" "" "-> build complete" && printf "\t%s\n" "$temp"/* @@ -120,14 +121,25 @@ mapfile -t files < <( [[ -f "${file}" ]] && printf "%s\n" "${file}" ||: done < <(makepkg --config <(cat "${makepkg_user_config}" "${makepkg_config}" 2>/dev/null) --packagelist) && printf "%s\n" "${temp}/PKGBUILD" + + find "${temp}" -name "*.log" ') if (( ${#files[@]} )); then - printf '%s\n' '' '-> copying files...' + msg 'Downloading files...' rsync "${rsyncopts[@]}" "${files[@]/#/$server:}" "${TEMPDIR}/" || die - mv "${TEMPDIR}"/*.pkg.tar* "${PKGDEST:-${PWD}}/" + + if is_globfile "${TEMPDIR}"/*.log; then + mv "${TEMPDIR}"/*.log "${LOGDEST:-${PWD}}/" + fi + # missing PKGBUILD download means the build failed + if [[ ! -f "${TEMPDIR}/PKGBUILD" ]]; then + error "Build failed, check logs in ${LOGDEST:-${PWD}}" + exit 1 + fi mv "${TEMPDIR}/PKGBUILD" "${PWD}/" + mv "${TEMPDIR}"/*.pkg.tar* "${PKGDEST:-${PWD}}/" else exit 1 fi -- cgit v1.2.3-70-g09d2