From 6032a565e3be7dcdd01e4fe26791c84f9222a2e0 Mon Sep 17 00:00:00 2001 From: Alexandre Lissy Date: Tue, 30 Jan 2024 13:07:39 +0000 Subject: [PATCH] Bug 1873359 - Allow snap refresh failure r=jcristau Differential Revision: https://phabricator.services.mozilla.com/D199847 --- .../docker/snap-coreXX-build/snap-tests/tests.sh | 34 +++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/taskcluster/docker/snap-coreXX-build/snap-tests/tests.sh b/taskcluster/docker/snap-coreXX-build/snap-tests/tests.sh index cd7f86862280..8b509e15e87b 100755 --- a/taskcluster/docker/snap-coreXX-build/snap-tests/tests.sh +++ b/taskcluster/docker/snap-coreXX-build/snap-tests/tests.sh @@ -7,7 +7,39 @@ pwd ARTIFACT_DIR=$TASKCLUSTER_ROOT_DIR/builds/worker/artifacts/ mkdir -p "$ARTIFACT_DIR" -sudo snap refresh +# There's a bug in snapd ~2.60.3-2.61 that will make "snap refresh" fail +# https://bugzilla.mozilla.org/show_bug.cgi?id=1873359 +# https://bugs.launchpad.net/snapd/+bug/2048104/comments/13 +# +# So we retrieve the version and we will allow the first "snap refresh" to +# fail for versions < 2.61.1 +SNAP_VERSION=$(snap info snapd --color=never --unicode=never |grep "installed:" | awk '{ print $2 }') +SNAP_MAJOR=$(echo "${SNAP_VERSION}" | cut -d'.' -f1) +SNAP_MINOR=$(echo "${SNAP_VERSION}" | cut -d'.' -f2) +SNAP_RELEASE=$(echo "${SNAP_VERSION}" | cut -d'.' -f3) + +REFRESH_CAN_FAIL=true +if [ "${SNAP_MAJOR}" -ge 2 ]; then + if [ "${SNAP_MAJOR}" -gt 2 ]; then + REFRESH_CAN_FAIL=false + else + if [ "${SNAP_MINOR}" -ge 61 ]; then + if [ "${SNAP_MINOR}" -gt 61 ]; then + REFRESH_CAN_FAIL=false + else + if [ "${SNAP_RELEASE}" -gt 0 ]; then + REFRESH_CAN_FAIL=false + fi + fi + fi + fi +fi + +if [ "${REFRESH_CAN_FAIL}" = "true" ]; then + sudo snap refresh || true +else + sudo snap refresh +fi; sudo snap refresh --hold=24h firefox -- 2.11.4.GIT