diff --git a/.gitea/workflows/verifica.yml b/.gitea/workflows/verifica.yml index 862b077..93885f0 100644 --- a/.gitea/workflows/verifica.yml +++ b/.gitea/workflows/verifica.yml @@ -282,7 +282,9 @@ jobs: mv "$CONFIG/config.json.nuovo" "$CONFIG/config.json" NOMI=("$IMAGE:sha-${GITHUB_SHA::7}") # :main solo se main è ancora a questo commit: un'esecuzione arrivata in ritardo non lo riporta indietro. - CIMA=$(git ls-remote origin refs/heads/main 2> /dev/null | cut -f1) + # Il passo gira con «bash -e -o pipefail»: senza «|| CIMA=""» un errore di ls-remote chiuderebbe il passo + # prima dell'avviso, e non uscirebbe nemmeno la :sha-. + CIMA=$(git ls-remote origin refs/heads/main 2> /dev/null | cut -f1) || CIMA="" if [ "$CIMA" = "$GITHUB_SHA" ]; then NOMI+=("$IMAGE:main") elif [ -z "$CIMA" ]; then diff --git a/tests/Febe.Tests/Packaging/PipelineTests.cs b/tests/Febe.Tests/Packaging/PipelineTests.cs index 0f11e54..dae448b 100644 --- a/tests/Febe.Tests/Packaging/PipelineTests.cs +++ b/tests/Febe.Tests/Packaging/PipelineTests.cs @@ -95,6 +95,7 @@ public sealed partial class PipelineTests StringAssert.Contains(publish, "\"$IMAGE:sha-${GITHUB_SHA::7}\""); StringAssert.Contains(publish, "\"$IMAGE:main\""); StringAssert.Contains(publish, "bash .gitea/scripts/costruisci-immagine.sh pubblica"); + StringAssert.Contains(publish, "| cut -f1) || CIMA=\"\"", "under bash -e an unreadable main must reach the warning and still publish :sha-"); Assert.DoesNotContain(":latest", Code(Workflow("verifica.yml")), ":latest belongs to the release"); // Built with buildx, tried without a network and scanned before anything is published; always cleaned up.