release-tarball-build-dist: check exists on server

Previously this job relied on always running on the same jenkins node,
and having the previously built release tarballs in a workspace
directory that does not get removed. It would only skip building a
release tarball if the file already exists locally.

As part of OS#5793 this job needs to be moved away from that jenkins
node. When trying to run the job on a different node, it will build all
release tarballs again which takes unnecessarsily long and actually
fails on libosmocore-0.9.4 due to a missing python2.

This probably happens because the job was refactored at some point and I
didn't realize that the python2 dep is now missing as the previous
tarballs existed.

In general it doesn't make much sense to build previous release tarballs
again and to always keep the legacy environments around for that. Change
the code to check if a tarball exists on the server, and skip building
the tarball in that case.

Related: OS#5793
Related: https://jenkins.osmocom.org/jenkins/view/All%20no%20Gerrit/job/Osmocom-release-tarballs/1281/console
Change-Id: I4b8c149c9cdbe7c613eea5d9be15794de5e5ddce
This commit is contained in:
Oliver Smith 2022-11-30 16:26:38 +01:00
parent c4f160e2c2
commit 757396a61b
1 changed files with 16 additions and 2 deletions

View File

@ -191,6 +191,15 @@ remove_temp_dir() {
fi
}
get_existing_tarballs() {
if ! $SSH_COMMAND releases@ftp.osmocom.org -- \
find web-files -name '*.tar.bz2' \
> "$TEMP"/existing_tarballs; then
echo "ERROR: getting existing tarballs from remote failed!"
exit 1
fi
}
# Clone an Osmocom repository to $TEMP/repos/$repo, clean it, checkout a tag.
# $1: Osmocom repository (may end in subdir, e.g. simtrace2/host)
# $2: tag (optional, default: master)
@ -318,13 +327,15 @@ create_move_tarball() {
upload() {
cd _release_tarballs
rsync -avz --delete -e "$SSH_COMMAND" . releases@ftp.osmocom.org:web-files/
rsync -avz -e "$SSH_COMMAND" . releases@ftp.osmocom.org:web-files/
}
remove_temp_dir
mkdir -p "$TEMP/repos"
echo "Temp dir: $TEMP"
get_existing_tarballs
for repo in $OSMO_RELEASE_REPOS; do
echo "$repo"
tags="$(osmo_git_last_commits_tags "$repo" "all" | cut -d / -f 3)"
@ -342,7 +353,10 @@ for repo in $OSMO_RELEASE_REPOS; do
echo " $tarball (ignored)"
continue
elif [ -e "$OUTPUT/$repo/$tarball" ]; then
echo " $tarball (exists)"
echo " $tarball (exists locally)"
continue
elif grep -q "^web-files/$repo/$tarball$" "$TEMP"/existing_tarballs; then
echo " $tarball (exists on server)"
continue
fi