Author SHA1 Message Date
Alby96andClaude Opus 5.5 8d1b344366 Revisione: il browser che non risponde nemmeno alla navigazione viene comunque in primo piano (#67)
verifica / installatore (push) Waiting for needed jobs
verifica / immagine (push) Waiting for needed jobs
verifica / controlli (push) Successful in 18s
verifica / prove (push) Waiting to run
Con la correzione #67 un browser che resta muto per tutta l'attesa conta come a riposo, e Febe prova ad aprire la
pagina iniziale. Un browser che si sta ancora riavviando dopo «Scollega» rifiuta però anche Page.navigate: l'errore
risaliva fino all'API e Alberto vedeva, dopo dieci secondi, un errore interno al posto della finestra. Ora quella
navigazione mancata si annota nel registro («non aperta (il browser non risponde)») e la finestra viene in primo
piano come prima. Nuova prova con un browser che non risponde a nulla, per «Usa il browser» e «Apri il browser».

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 12:28:37 +01:00
Alby96andClaude Opus 5.5 8edb706e06 Correzione: il browser che non risponde ancora si aspetta, poi si apre l'accesso (#67)
verifica / controlli (push) Successful in 19s
verifica / prove (push) Successful in 20m6s
verifica / installatore (push) Successful in 2m10s
verifica / immagine (push) Canceled after 0s
Subito dopo «Scollega» il browser riparte con il profilo vuoto e, sotto carico,
può non dire ancora quale pagina mostra. Febe prendeva l'indirizzo sconosciuto
per una pagina di Alberto e lasciava la finestra bianca (about:blank), contro
la #52. Decisione di Alberto del 29 novembre 2026: quando l'indirizzo è
sconosciuto si richiede al browser ogni 200 ms, al massimo per 10 secondi
(AddressWait); se resta muto la pagina conta come quella di riposo e si apre
la pagina iniziale (l'accesso, senza sessione). Una pagina nota che Alberto
usa non si tocca mai; l'attesa finisce con la richiesta.

Il finto browser delle prove può restare muto (Silent): quattro prove nuove
per la risposta tardiva, il silenzio oltre l'attesa, la pagina di Alberto
lasciata com'è e l'annullamento durante l'attesa.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 11:57:57 +01:00
24 changed files with 736 additions and 509 deletions

No files matched your search

+6 -5
View File
@@ -1,9 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Prepares the Debian container of the «prove» job (debian:trixie, plain Debian 13: no JavaScript action, hence no # Prepara il contenitore Debian del lavoro «prove» (debian:trixie, Debian 13 senza nient'altro: nessuna azione
# Node) so that no test is skipped: the distribution's real Chromium (on Ubuntu it is a snap, which does not work in # JavaScript, quindi niente Node) perché nessuna prova si salti: Chromium vero della distribuzione (su Ubuntu è uno
# containers) with its languages, Xvfb, the it_IT.UTF-8 locale, time zones and the same fonts as the Febe image; ICU, # snap, che nei contenitori non va) con le sue lingue, Xvfb, la lingua it_IT.UTF-8, fusi orari e gli stessi caratteri
# OpenSSL, zlib and libstdc++ for the .NET SDK (dotnet.sh). git, curl and the certificates are installed by the step # dell'immagine di Febe; ICU, OpenSSL, zlib e libstdc++ per l'SDK .NET (dotnet.sh). git, curl e i certificati li
# before the sources. setpriv, getent and the nobody user (65534) come with Debian (tests of the container start). # installa il passo prima dei sorgenti. setpriv, getent e l'utente nobody (65534) vengono con Debian (prove
# dell'avvio del contenitore).
# #
# .gitea/scripts/ambiente-prove.sh # .gitea/scripts/ambiente-prove.sh
set -euo pipefail set -euo pipefail
+12 -12
View File
@@ -1,20 +1,20 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# CI artifacts, instead of actions/upload-artifact (a JavaScript action, which needs Node): the files go to the Gitea # Artefatti della CI, al posto di actions/upload-artifact (un'azione JavaScript, che vuole Node): i file vanno nel
# package registry, generic package febe-ci, one version per run: # registro dei pacchetti di Gitea, pacchetto generico febe-ci, una versione per esecuzione:
# #
# <versione>-ci.<numero> from the verifica workflow (like Febe-Setup-<versione>-ci.<numero>.exe) # <versione>-ci.<numero> dal flusso verifica (come Febe-Setup-<versione>-ci.<numero>.exe)
# <versione>-rilascio.<numero> from the rilascio workflow # <versione>-rilascio.<numero> dal flusso rilascio
# #
# with <versione> from Directory.Build.props and <numero> the run number (NUMERO). They are downloaded from the package # con <versione> da Directory.Build.props e <numero> il numero dell'esecuzione (NUMERO). Si scaricano dalla pagina del
# page on Gitea (owner ▸ Packages ▸ febe-ci). The Monday cleanup (full pulizia-docker.sh) removes the versions created # pacchetto su Gitea (proprietario ▸ Pacchetti ▸ febe-ci). La pulizia del lunedì (pulizia-docker.sh completa) toglie le
# more than 14 days earlier, as the artifact expiry used to do. # versioni create più di 14 giorni prima, come faceva la scadenza degli artefatti.
# #
# .gitea/scripts/artefatti.sh verifica|rilascio <file>... # .gitea/scripts/artefatti.sh verifica|rilascio <file>...
# #
# Variables: REGISTRY_TOKEN (token with «package: read and write», only in the curl header, never printed), GITEA_URL # Variabili: REGISTRY_TOKEN (token con «package: read and write», solo nell'intestazione di curl, mai stampato), GITEA_URL
# (the server address, gitea.server_url), PROPRIETARIO, NUMERO. Without REGISTRY_TOKEN a warning and no file uploaded: # (l'indirizzo del server, gitea.server_url), PROPRIETARIO, NUMERO. Senza REGISTRY_TOKEN un avviso e nessun file
# the job stays green, as for the image. A missing file or a refusal by the registry fails the step. A file with the # caricato: il lavoro resta verde, come per l'immagine. Un file che manca o un rifiuto del registro fanno fallire il
# same name already uploaded (a new attempt of the same run) is replaced. # passo. Un file con lo stesso nome già caricato (un nuovo tentativo della stessa esecuzione) si sostituisce.
set -euo pipefail set -euo pipefail
flusso="${1:-}" flusso="${1:-}"
@@ -46,7 +46,7 @@ proprietario="${PROPRIETARIO:?Manca PROPRIETARIO.}"
base="${GITEA_URL:?Manca GITEA_URL.}" base="${GITEA_URL:?Manca GITEA_URL.}"
base="${base%/}/api/packages/$proprietario/generic/febe-ci/$versione" base="${base%/}/api/packages/$proprietario/generic/febe-ci/$versione"
# One call to the registry: the HTTP code, 000 if Gitea does not answer. The token is only in the curl header. # Una chiamata al registro: il codice HTTP, 000 se Gitea non risponde. Il token sta solo nell'intestazione di curl.
chiedi() { chiedi() {
local codice local codice
codice=$(curl -sS --max-time 900 -H "Authorization: token $REGISTRY_TOKEN" -o /dev/null -w '%{http_code}' "$@") || true codice=$(curl -sS --max-time 900 -H "Authorization: token $REGISTRY_TOKEN" -o /dev/null -w '%{http_code}' "$@") || true
+14 -14
View File
@@ -1,18 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Quick checks before building (the «controlli» job of the CI): a few seconds, and they stop at once the errors that # Controlli veloci prima di compilare (lavoro «controlli» della CI): pochi secondi, e fermano subito gli errori che
# would otherwise be found after half an hour of tests. They can also be run by hand, from the repository root: # altrimenti si scoprirebbero dopo mezz'ora di prove. Si lanciano anche a mano, dalla radice del repository:
# #
# bash .gitea/scripts/controlli.sh # bash .gitea/scripts/controlli.sh
# #
# 1. every shell script of the repository is valid syntax (bash -n; sh -n for the sh ones) and has Unix line # 1. ogni script di shell del repository è sintassi valida (bash -n; sh -n per quelli in sh) e ha le righe Unix, come
# endings, like the awk programs of the CI; # i programmi awk della CI;
# 2. the CI workflows read as block YAML: no tabs nor Windows line endings, two-space indentation outside text # 2. i flussi della CI si leggono come YAML a blocchi: niente tabulazioni né righe Windows, rientri di due spazi fuori
# blocks, «on:» and «jobs:» present; and they are made of commands only: no «uses:», that is no action # dai blocchi di testo, «on:» e «jobs:» presenti; e sono fatti solo di comandi: nessun «uses:», cioè nessuna
# (JavaScript actions need Node, and the Febe CI is written in house: decision of 18 November 2026); # azione (le azioni JavaScript vogliono Node, e la CI di Febe è scritta in casa: decisione del 18 novembre 2026);
# 3. no file contains conflict markers left over from a merge; # 3. nessun file contiene segni di conflitto rimasti da un'unione;
# 4. the version in Directory.Build.props has the form x.y.z[-something], the one installer/costruisci.sh accepts; # 4. la versione di Directory.Build.props è nella forma x.y.z[-qualcosa], quella che installer/costruisci.sh accetta;
# 5. every project listed in Febe.slnx exists; # 5. ogni progetto elencato in Febe.slnx esiste;
# 6. every JSON file of the repository parses (configurations, cleaned samples, Chromium policies), with json.awk. # 6. ogni file JSON del repository si legge (configurazioni, campioni ripuliti, criteri di Chromium), con json.awk.
set -uo pipefail set -uo pipefail
radice="$(git rev-parse --show-toplevel)" || exit 2 radice="$(git rev-parse --show-toplevel)" || exit 2
@@ -51,8 +51,8 @@ while IFS= read -r -d '' flusso; do
if grep -n $'\t' "$flusso" > /dev/null; then if grep -n $'\t' "$flusso" > /dev/null; then
errore "$flusso contiene tabulazioni: in YAML il rientro si fa con gli spazi." errore "$flusso contiene tabulazioni: in YAML il rientro si fa con gli spazi."
fi fi
# A text block («run: |», «>-») holds all the lines indented more than its key; outside, indentation goes two # Un blocco di testo («run: |», «>-») tiene tutte le righe più rientrate della sua chiave; fuori, i rientri sono di
# spaces at a time and no line calls an action. # due spazi in due e nessuna riga chiama un'azione.
if rilievi=$(awk ' if rilievi=$(awk '
FNR == 1 { blocco = -1; on = 0; jobs = 0 } FNR == 1 { blocco = -1; on = 0; jobs = 0 }
{ {
@@ -104,7 +104,7 @@ done < <(sed -n 's:.*<Project Path="\([^"]*\)".*:\1:p' Febe.slnx)
echo " $(grep -c '<Project Path=' Febe.slnx) progetti" echo " $(grep -c '<Project Path=' Febe.slnx) progetti"
echo "== File JSON" echo "== File JSON"
# A single process for all files; prints the files that do not parse, one per line, with the reason and the line. # Un solo processo per tutti i file; stampa i file che non si leggono, uno per riga, con il motivo e la riga.
mapfile -d '' json < <(git ls-files -z -- '*.json') mapfile -d '' json < <(git ls-files -z -- '*.json')
if ((${#json[@]} > 0)); then if ((${#json[@]} > 0)); then
if ! guasti=$(awk -f .gitea/scripts/json.awk -f .gitea/scripts/json-valido.awk "${json[@]}"); then if ! guasti=$(awk -f .gitea/scripts/json.awk -f .gitea/scripts/json-valido.awk "${json[@]}"); then
+30 -30
View File
@@ -1,29 +1,29 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Builds the Febe Docker image with the buildx builder of the run (docker-container), always with the same arguments # Costruzione dell'immagine Docker di Febe con il builder buildx dell'esecuzione (docker-container), sempre con gli
# and the same labels: the build that is published comes entirely from the cache of the one that was tested and # stessi argomenti e le stesse etichette: la costruzione che si pubblica esce intera dalla cache di quella che si è
# scanned, so the layers are the same. # provata e scansionata, quindi gli strati sono gli stessi.
# #
# costruisci-immagine.sh builder <registro> the buildx builder of the run (BUILDER), with the # costruisci-immagine.sh builder <registro> il builder buildx dell'esecuzione (BUILDER), con il
# docker-container driver and the buildkit configuration # driver docker-container e la configurazione di
# that says the home registry answers in HTTP (instead # buildkit che dice che il registro di casa risponde in
# of docker/setup-buildx-action, a JavaScript action); # HTTP (al posto di docker/setup-buildx-action, un'azione
# pulizia-docker.sh esecuzione removes it # JavaScript); lo toglie pulizia-docker.sh esecuzione
# costruisci-immagine.sh archivio <file.tar> <nome locale> archive of the image, for docker load and for Trivy # costruisci-immagine.sh archivio <file.tar> <nome locale> archivio dell'immagine, per docker load e per Trivy
# costruisci-immagine.sh pubblica <nome:etichetta>... push to the REGISTRY registry by buildx, with # costruisci-immagine.sh pubblica <nome:etichetta>... spinta sul registro REGISTRY da buildx, con
# REGISTRO_UTENTE and REGISTRO_TOKEN in a client # REGISTRO_UTENTE e REGISTRO_TOKEN in una configurazione
# configuration of its own, removed at the end; the # del client solo sua, tolta alla fine; il demone non
# daemon never talks to the registry (it would try HTTPS) # parla mai con il registro (proverebbe HTTPS)
# #
# The image is a plain manifest, without attestations (--provenance=false --sbom=false). With the attestations, which # L'immagine è un manifest semplice, senza attestazioni (--provenance=false --sbom=false). Con le attestazioni, che
# buildx adds by itself, it would be an index: Gitea keeps every child manifest as a version of its own, sha256:… # buildx aggiunge da sé, sarebbe un indice: Gitea tiene ogni manifest figlio come una versione a sé, sha256:… senza
# without a tag, with the configuration and the layers, and removing a :sha- tag from the registry would remove only # etichetta, con la configurazione e gli strati, e togliere dal registro un'etichetta :sha- toglierebbe solo l'indice.
# the index. With a plain manifest the layers belong to the tag's version, and the registry cleanup really frees them. # Con un manifest semplice gli strati stanno nella versione dell'etichetta, e la pulizia del registro li libera davvero.
# #
# Required variables: BUILDER, VERSIONE, GIT_COMMIT, FLUSSO (verifica or rilascio), ESECUZIONE (gitea.run_id). # Variabili richieste: BUILDER, VERSIONE, GIT_COMMIT, FLUSSO (verifica o rilascio), ESECUZIONE (gitea.run_id).
# The febe.ci.* labels say which workflow, run, branch and commit built the image. They are not used by the cleanup: # Le etichette febe.ci.* dicono quale flusso, esecuzione, ramo e commit hanno costruito l'immagine. Non servono alla
# they are also in the published images and Docker copies them into every container created from those, even in a # pulizia: stanno anche nelle immagini pubblicate e Docker le copia in ogni contenitore creato da quelle, anche in un
# real Febe. That is why febe.ci.prova, the mark of test containers only (prova-immagine.sh), is never set here: # Febe vero. Per questo qui non si mette mai febe.ci.prova, il segno dei soli contenitori di prova (prova-immagine.sh):
# PipelineTests checks it. # lo controlla PipelineTests.
set -euo pipefail set -euo pipefail
modo="${1:?Indica il modo: builder, archivio o pubblica.}" modo="${1:?Indica il modo: builder, archivio o pubblica.}"
@@ -32,11 +32,11 @@ cd "$(git rev-parse --show-toplevel)"
if [[ "$modo" == builder ]]; then if [[ "$modo" == builder ]]; then
registro="${1:?Indica il registro, per esempio 192.168.30.23:3000.}" registro="${1:?Indica il registro, per esempio 192.168.30.23:3000.}"
# Only a host name (or an address) with the port: the value ends up in a TOML file. # Solo un nome di host (o un indirizzo) con la porta: il valore finisce in un file TOML.
[[ "$registro" =~ ^[A-Za-z0-9.-]+(:[0-9]+)?$ ]] || { echo "Registro non valido: «$registro»." >&2; exit 2; } [[ "$registro" =~ ^[A-Za-z0-9.-]+(:[0-9]+)?$ ]] || { echo "Registro non valido: «$registro»." >&2; exit 2; }
configurazione="${RUNNER_TEMP:-/tmp}/buildkitd-${BUILDER:?}.toml" configurazione="${RUNNER_TEMP:-/tmp}/buildkitd-${BUILDER:?}.toml"
printf '[registry."%s"]\n http = true\n insecure = true\n' "$registro" > "$configurazione" printf '[registry."%s"]\n http = true\n insecure = true\n' "$registro" > "$configurazione"
# --buildkitd-config since buildx 0.13; before, it was called --config. # --buildkitd-config da buildx 0.13; prima si chiamava --config.
opzione=--buildkitd-config opzione=--buildkitd-config
aiuto=$(docker buildx create --help 2> /dev/null) || true aiuto=$(docker buildx create --help 2> /dev/null) || true
[[ "$aiuto" == *--buildkitd-config* ]] || opzione=--config [[ "$aiuto" == *--buildkitd-config* ]] || opzione=--config
@@ -69,11 +69,11 @@ case "$modo" in
etichette+=(-t "$nome") etichette+=(-t "$nome")
done done
# The credentials in a client configuration entirely our own, only for this push and then removed: the runner's # Le credenziali in una configurazione del client tutta nostra, solo per questa spinta e poi tolta: quella del
# one is never touched (no jq to modify it, no credential left in its folder). buildx passes them to the builder; # runner non si tocca mai (niente jq per modificarla, nessuna credenziale che resti nella sua cartella). buildx le
# the daemon is not involved (it would try HTTPS). From the original client we keep the plugins, the contexts and # passa al builder; il demone non c'entra (proverebbe HTTPS). Del client originale restano i plugin, i contesti e
# the current context; the buildx builders are found through BUILDX_CONFIG. The name is fixed for the run, so the # il contesto corrente; i builder buildx li trova con BUILDX_CONFIG. Il nome è fisso per l'esecuzione, così il passo
# «Pulizia (sempre)» step removes it even after an interruption that skips the trap. # «Pulizia (sempre)» la toglie anche dopo un'interruzione che salta la trap.
originale="${DOCKER_CONFIG:-$HOME/.docker}" originale="${DOCKER_CONFIG:-$HOME/.docker}"
configurazione="${RUNNER_TEMP:-/tmp}/febe-docker-${ESECUZIONE}" configurazione="${RUNNER_TEMP:-/tmp}/febe-docker-${ESECUZIONE}"
rm -rf "$configurazione" rm -rf "$configurazione"
@@ -88,7 +88,7 @@ case "$modo" in
[[ "$contesto" =~ ^[A-Za-z0-9][A-Za-z0-9_.+-]*$ ]] || contesto="" [[ "$contesto" =~ ^[A-Za-z0-9][A-Za-z0-9_.+-]*$ ]] || contesto=""
fi fi
credenziali=$(printf '%s:%s' "$REGISTRO_UTENTE" "$REGISTRO_TOKEN" | base64 -w0) credenziali=$(printf '%s:%s' "$REGISTRO_UTENTE" "$REGISTRO_TOKEN" | base64 -w0)
# Only base64 characters, and the registry checked above: the JSON is written without any need for escapes. # Solo caratteri di base64, e il registro controllato sopra: il JSON si scrive senza bisogno di escape.
[[ "$credenziali" =~ ^[A-Za-z0-9+/]+=*$ ]] || { echo "Credenziali del registro non codificabili." >&2; exit 2; } [[ "$credenziali" =~ ^[A-Za-z0-9+/]+=*$ ]] || { echo "Credenziali del registro non codificabili." >&2; exit 2; }
( (
umask 077 umask 077
+13 -13
View File
@@ -1,19 +1,19 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Installs the .NET SDK for a CI job, instead of actions/setup-dotnet (a JavaScript action, which needs Node). Like # Installa l'SDK .NET per un lavoro della CI, al posto di actions/setup-dotnet (un'azione JavaScript, che vuole Node).
# that action it takes the newest SDK of the channel (default 10.0, like «10.0.x»), but it verifies it: the version # Come quella prende l'ultimo SDK del canale (predefinito 10.0, come «10.0.x»), ma lo verifica: la versione e
# and the SHA-512 hash of the archive come from Microsoft's release metadata (read with json.awk and dotnet-sdk.awk, # l'impronta SHA-512 dell'archivio vengono dai metadati dei rilasci di Microsoft (letti con json.awk e dotnet-sdk.awk,
# POSIX awk), the archive from builds.dotnet.microsoft.com, and it is installed only if the hash matches. Never an # awk POSIX), l'archivio da builds.dotnet.microsoft.com, e si installa solo se l'impronta coincide. Mai uno script di
# install script downloaded on the fly. # installazione scaricato al volo.
# #
# .gitea/scripts/dotnet.sh [canale] # .gitea/scripts/dotnet.sh [canale]
# #
# Where: in the runner's tool cache (RUNNER_TOOL_CACHE, the act-toolcache volume that act_runner mounts in every job, # Dove: nella cache degli strumenti del runner (RUNNER_TOOL_CACHE, il volume act-toolcache che act_runner monta in ogni
# containers included), in febe-dotnet/<versione>; without it, in the job's temporary folder. A version already # lavoro, anche nei contenitori), in febe-dotnet/<versione>; senza, nella cartella temporanea del lavoro. Una versione
# installed and verified is not downloaded again; older versions in febe-dotnet are removed. Adds dotnet to the PATH # già installata e verificata non si riscarica; le versioni più vecchie di febe-dotnet si tolgono. Aggiunge dotnet al
# of the following steps (GITHUB_PATH) and writes DOTNET_ROOT (GITHUB_ENV); outside the CI it only prints the folder. # PATH dei passi seguenti (GITHUB_PATH) e scrive DOTNET_ROOT (GITHUB_ENV); fuori dalla CI stampa solo la cartella.
# Needs curl, tar, sha512sum and awk. In the Debian container of the tests the SDK's system libraries (ICU, OpenSSL) # Serve curl, tar, sha512sum e awk. Nel contenitore Debian delle prove le librerie di sistema dell'SDK (ICU, OpenSSL)
# are installed by ambiente-prove.sh; on the runner image ICU is not guaranteed, and the jobs that run there # le installa ambiente-prove.sh; sull'immagine del runner ICU non è garantito, e i lavori che ci girano (installatore,
# (installatore, windows, release) use DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true. # windows, release) usano DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true.
set -euo pipefail set -euo pipefail
canale="${1:-10.0}" canale="${1:-10.0}"
@@ -56,7 +56,7 @@ else
mv "$temporanea/sdk" "$cartella" mv "$temporanea/sdk" "$cartella"
fi fi
# The earlier versions, which no job will use any more (the CI runs one job at a time), and interrupted downloads. # Le versioni precedenti, che nessun lavoro userà più (la CI fa un lavoro alla volta), e gli scarichi interrotti.
for vecchia in "$radice"/* "$radice"/.scarico-*; do for vecchia in "$radice"/* "$radice"/.scarico-*; do
[[ -d "$vecchia" && "$vecchia" != "$cartella" && "$vecchia" != "$temporanea" ]] || continue [[ -d "$vecchia" && "$vecchia" != "$cartella" && "$vecchia" != "$temporanea" ]] || continue
rm -rf "$vecchia" rm -rf "$vecchia"
+8 -8
View File
@@ -1,14 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# JSON for the CI steps, without third-party programs (no jq, no Node; decision of Alberto of 18 November 2026): # JSON per i passi della CI, senza programmi di terzi (niente jq, niente Node; decisione di Alberto del 18 novembre
# reads with json.awk and json-campi.awk, writes strings with json-stringa.awk. POSIX awk, no network. # 2026): legge con json.awk e json-campi.awk, scrive le stringhe con json-stringa.awk. awk POSIX, niente rete.
# #
# json.sh campi <percorso> <campo,campo...> <file.json>... for each object at that place, one line with the fields # json.sh campi <percorso> <campo,campo...> <file.json>... per ogni oggetto a quel posto, una riga con i campi
# separated by a TAB (json-campi.awk): empty path for # separati da un TAB (json-campi.awk): percorso vuoto
# the root object, «*» for every element of a list, # per l'oggetto radice, «*» per ogni elemento di un
# for example «Results/*/Vulnerabilities/*» # elenco, per esempio «Results/*/Vulnerabilities/*»
# json.sh stringa <testo> the text as a JSON string, quotes included # json.sh stringa <testo> il testo come stringa JSON, virgolette comprese
# #
# A file that is not valid JSON: no output, the reason on stderr, exit status 2. PipelineTests tests it. # Un file che non è JSON valido: niente in uscita, il motivo su stderr, uscita 2. Lo provano le PipelineTests.
set -euo pipefail set -euo pipefail
qui="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" qui="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+21 -21
View File
@@ -1,21 +1,21 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Test of the image just built, on the runner's Docker daemon. Every container runs WITHOUT NETWORK (--network none): # Prova dell'immagine appena costruita, sul demone Docker del runner. Ogni contenitore gira SENZA RETE
# Febe cannot reach any site, let alone Instagram (rule 1), and the health check goes through the container's # (--network none): Febe non può raggiungere alcun sito, tanto meno Instagram (regola 1), e il controllo di salute
# internal network. # passa dalla rete interna del contenitore.
# Every container carries the label febe.ci.prova=<esecuzione>, set here with «docker run --label» and never in an # Ogni contenitore porta l'etichetta febe.ci.prova=<esecuzione>, messa qui con «docker run --label» e mai in
# image: it is the mark by which pulizia-docker.sh recognises a test container, together with the name # un'immagine: è il segno con cui pulizia-docker.sh riconosce un contenitore di prova, insieme al nome
# febe-prova-<esecuzione>. The febe.ci.* labels of the image are not enough: Docker copies them into every container, # febe-prova-<esecuzione>. Le etichette febe.ci.* dell'immagine non bastano: Docker le copia in ogni contenitore, anche
# even into a real Febe started from a published image. # in un Febe vero avviato da un'immagine pubblicata.
# #
# .gitea/scripts/prova-immagine.sh <immagine> [esecuzione] # .gitea/scripts/prova-immagine.sh <immagine> [esecuzione]
# #
# 1. the distribution's Chromium answers and the Febe policies (no saved passwords) are in place; # 1. Chromium della distribuzione risponde e i criteri di Febe (niente password salvate) sono al loro posto;
# 2. the it_IT.UTF-8 locale is generated; # 2. la lingua it_IT.UTF-8 è generata;
# 3. the container starts as the guide says (Febe's seccomp profile, interface password, default PUID/PGID), the # 3. il contenitore parte come dice la guida (profilo seccomp di Febe, password dell'interfaccia, PUID/PGID
# image's health check becomes «healthy» and «febe --controllo-salute» answers; # predefiniti), il controllo di salute dell'immagine diventa «healthy» e «febe --controllo-salute» risponde;
# 4. process 1 is Febe (no tini) and no orphan processes are left in the container to be reaped; # 4. il processo 1 è Febe (niente tini) e nel contenitore non restano processi orfani da raccogliere;
# 5. on stop it stops by itself, within the 30 seconds the guide allows. # 5. allo stop si ferma da solo, entro i 30 secondi che la guida concede.
# The password is random, lives only in the Docker client's environment and is never printed. # La password è casuale, vive solo nell'ambiente del client Docker e non si stampa mai.
set -euo pipefail set -euo pipefail
immagine="${1:?Indica quale immagine provare.}" immagine="${1:?Indica quale immagine provare.}"
@@ -24,8 +24,8 @@ radice="$(git rev-parse --show-toplevel)"
etichette=(--label "febe.ci.prova=$esecuzione") etichette=(--label "febe.ci.prova=$esecuzione")
nome="febe-prova-$esecuzione" nome="febe-prova-$esecuzione"
# Removes the test container of this run (also the one of an earlier attempt), but only if it carries the test mark: # Toglie il contenitore di prova di questa esecuzione (anche quello di un tentativo precedente), ma solo se porta il
# a container with the same name and without the mark stays, and «docker run --name» stops. # segno della prova: un contenitore con lo stesso nome e senza segno resta, e «docker run --name» si ferma.
togli() { togli() {
local segno local segno
segno=$(docker container inspect -f '{{index .Config.Labels "febe.ci.prova"}}' "$nome" 2> /dev/null) || return 0 segno=$(docker container inspect -f '{{index .Config.Labels "febe.ci.prova"}}' "$nome" 2> /dev/null) || return 0
@@ -52,7 +52,7 @@ docker run -d --name "$nome" --network none "${etichette[@]}" \
--stop-timeout 30 -e FEBE_PASSWORD "$immagine" > /dev/null --stop-timeout 30 -e FEBE_PASSWORD "$immagine" > /dev/null
unset FEBE_PASSWORD unset FEBE_PASSWORD
# The image's first health check comes 30 seconds after the start (HEALTHCHECK --interval=30s): up to 3 minutes. # Il primo controllo di salute dell'immagine arriva 30 secondi dopo l'avvio (HEALTHCHECK --interval=30s): fino a 3 minuti.
stato="" stato=""
for _ in $(seq 1 36); do for _ in $(seq 1 36); do
if [[ "$(docker inspect -f '{{.State.Running}}' "$nome")" != "true" ]]; then if [[ "$(docker inspect -f '{{.State.Running}}' "$nome")" != "true" ]]; then
@@ -77,16 +77,16 @@ fi
echo "salute: healthy, e febe --controllo-salute risponde" echo "salute: healthy, e febe --controllo-salute risponde"
echo "== Processo 1 e processi orfani" echo "== Processo 1 e processi orfani"
# Without tini process 1 is Febe, and the .NET runtime as process 1 also reaps the orphaned children of Chromium. # Senza tini il processo 1 è Febe, e il runtime .NET da processo 1 raccoglie anche i figli di Chromium rimasti orfani.
# A process that has just ended may stay a «zombie» for an instant: only one that stays so for 10 seconds counts. # Un processo appena finito può restare «zombie» per un istante: conta solo uno che resta tale per 10 secondi.
primo="$(docker exec "$nome" cat /proc/1/comm)" primo="$(docker exec "$nome" cat /proc/1/comm)"
if [[ "$primo" != "febe" ]]; then if [[ "$primo" != "febe" ]]; then
echo "Il processo 1 del contenitore è «$primo» invece di febe. Registro:" >&2 echo "Il processo 1 del contenitore è «$primo» invece di febe. Registro:" >&2
docker logs --tail 80 "$nome" >&2 || true docker logs --tail 80 "$nome" >&2 || true
exit 1 exit 1
fi fi
# The ids of the zombie processes that are children of process 1, sorted: the ones it has to reap (orphans end up # I numeri dei processi zombie figli del processo 1, ordinati: quelli che tocca a lui raccogliere (gli orfani finiscono
# there). One that vanishes while being read does not count. # lì). Uno sparito durante la lettura non conta.
orfani_zombie='for f in /proc/[0-9]*/status; do orfani_zombie='for f in /proc/[0-9]*/status; do
awk '\''$1 == "State:" { z = $2 } $1 == "Pid:" { p = $2 } $1 == "PPid:" { q = $2 } END { if (z == "Z" && q == 1) print p }'\'' "$f" 2> /dev/null awk '\''$1 == "State:" { z = $2 } $1 == "Pid:" { p = $2 } $1 == "PPid:" { q = $2 } END { if (z == "Z" && q == 1) print p }'\'' "$f" 2> /dev/null
done' done'
+159 -158
View File
@@ -1,70 +1,71 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Cleanup of the runner's Docker daemon and of the container registry. The daemon is the same one that builds # Pulizia del demone Docker del runner e del registro dei container. Il demone è lo stesso che costruisce Encelado,
# Encelado, Mimante and Alberto's other projects (and very probably the one of the Unraid applications), and a real # Mimante e gli altri progetti di Alberto (e molto probabilmente quello delle applicazioni di Unraid), e ci può girare
# Febe may run on it too. Since 21 October 2026 (decision of Alberto) the cleanup also removes what nobody needs any # anche un Febe vero. Dal 21 ottobre 2026 (decisione di Alberto) la pulizia toglie anche ciò che non serve più a
# more, of any project: the images no container uses, the build cache, the leftovers of act_runner. Never a # nessuno, di qualunque progetto: le immagini che nessun contenitore usa, la cache di costruzione, i resti di
# container, a volume or a network that does not belong to the CI. # act_runner. Mai un contenitore, un volume o una rete che non sia della CI.
# #
# Of the Febe CI, what can be proven to be its own is removed. The labels febe.ci.workflow, febe.ci.run, febe.ci.ref # Della CI di Febe si toglie ciò che si può provare suo. Le etichette febe.ci.workflow, febe.ci.run, febe.ci.ref e
# and febe.ci.commit say where an image comes from, but they do NOT choose what to remove: they are also in the # febe.ci.commit dicono da dove viene un'immagine, ma NON scelgono che cosa togliere: stanno anche nelle immagini
# published images (:main, :sha-, :X.Y.Z, :latest), and Docker copies them into every container created from those, # pubblicate (:main, :sha-, :X.Y.Z, :latest), e Docker le copia in ogni contenitore creato da quelle, quindi le porta
# so a real Febe carries them too. What is removed is recognised like this: # anche un Febe vero. Ciò che si toglie si riconosce così:
# - test containers: the label febe.ci.prova=<esecuzione>, which only prova-immagine.sh sets with # - contenitori di prova: l'etichetta febe.ci.prova=<esecuzione>, che mette solo prova-immagine.sh con
# «docker run --label» and which no image carries (PipelineTests checks it), AND the exact name # «docker run --label» e che nessuna immagine porta (lo controlla PipelineTests), E il nome esatto
# febe-prova-<the same run> (the other test containers, without a name, run with --rm and Docker removes them by # febe-prova-<la stessa esecuzione> (gli altri contenitori della prova, senza nome, girano con --rm e Docker li
# itself as soon as they end); # toglie da sé appena finiscono);
# - tested images: the local name febe-ci:<esecuzione>, removed by name, never by id and never with -f. If the same # - immagini provate: il nome locale febe-ci:<esecuzione>, tolto per nome, mai per identificativo e mai con -f. Se la
# image also has a registry name, only febe-ci:<esecuzione> is removed; if a container uses it, it stays; # stessa immagine ha anche un nome del registro, si toglie solo febe-ci:<esecuzione>; se un contenitore la usa, resta;
# - buildx builders: the container buildx_buildkit_febe-ci-<esecuzione>0, with the moby/buildkit image, and its # - builder buildx: il contenitore buildx_buildkit_febe-ci-<esecuzione>0, con l'immagine moby/buildkit, e il suo
# …_state volume, which hold the build cache of that run; # volume …_state, che contengono la cache di costruzione di quell'esecuzione;
# - the febe:ci image left by the old verification workflow (before 20 October 2026), if nobody uses it. # - l'immagine febe:ci lasciata dal vecchio flusso di verifica (prima del 20 ottobre 2026), se nessuno la usa.
# Of act_runner, the leftovers of the jobs are removed: act_runner names everything it creates for a job # Di act_runner si tolgono i resti dei lavori: act_runner chiama tutto ciò che crea per un lavoro
# GITEA-ACTIONS-TASK-<task number>… (the job container, its volumes <nome> and <nome>-env, its network # GITEA-ACTIONS-TASK-<numero del compito>… (il contenitore del lavoro, i suoi volumi <nome> e <nome>-env, la sua rete
# <nome>-<lavoro>-network). Only stopped containers, and volumes and networks no container uses, older than 90 # <nome>-<lavoro>-network). Solo i contenitori fermi e i volumi e le reti che nessun contenitore usa, più vecchi di 90
# minutes: a job that starts creates them and uses them at once. The act-toolcache volume (the tool cache, shared # minuti: un lavoro che parte li crea e li usa subito. Il volume act-toolcache (la cache degli strumenti, condivisa fra
# among the jobs) stays. # i lavori) resta.
# #
# pulizia-docker.sh esecuzione <id> everything the run <id> created (at the start and at the end of its # pulizia-docker.sh esecuzione <id> tutto ciò che ha creato l'esecuzione <id> (all'inizio e alla fine del suo
# «immagine» job, always) # lavoro «immagine», sempre)
# pulizia-docker.sh penzolanti the unnamed images no container uses and the daemon's dangling build cache # pulizia-docker.sh penzolanti le immagini senza nome che nessun contenitore usa e la cache di costruzione
# (the part no image shares) unused for 24 hours, of all projects (at the end # penzolante del demone (quella che nessuna immagine condivide) non usata da
# of every «immagine» job, after «esecuzione») # 24 ore, di tutti i progetti (alla fine di ogni lavoro «immagine», dopo
# pulizia-docker.sh residui [minuti] the leftovers of interrupted runs, older than N minutes (default 90: a job # «esecuzione»)
# lasts at most 60 minutes, so none of them is still alive) # pulizia-docker.sh residui [minuti] i resti di esecuzioni interrotte, più vecchi di N minuti (predefinito 90: un
# pulizia-docker.sh settimanale residui, febe:ci, unnamed images older than 72 hours: the narrow cleanup of # lavoro dura al massimo 60 minuti, quindi nessuno di essi è ancora vivo)
# before 21 October 2026, now only by hand # pulizia-docker.sh settimanale residui, febe:ci, immagini senza nome più vecchie di 72 ore: la pulizia
# pulizia-docker.sh completa residui, febe:ci, act_runner leftovers, the images no container uses # stretta di prima del 21 ottobre 2026, ora solo a mano
# created more than 24 hours ago, the build cache unused for 24 hours and, # pulizia-docker.sh completa residui, febe:ci, resti di act_runner, le immagini che nessun contenitore
# with REGISTRY_TOKEN, the registry's sha- tags beyond the 10 most recent and # usa create più di 24 ore fa, la cache di costruzione non usata da 24 ore e,
# the CI artifacts (febe-ci) older than 14 days («pulizia» workflow, every # con REGISTRY_TOKEN, le etichette sha- del registro oltre le 10 più recenti e
# Monday and by hand) # gli artefatti della CI (febe-ci) di più di 14 giorni (flusso «pulizia», ogni
# pulizia-docker.sh <modo> --prova lists what it would remove and removes nothing: only commands that read # lunedì e a mano)
# (on the registry only GET) # pulizia-docker.sh <modo> --prova elenca che cosa toglierebbe e non toglie nulla: solo comandi che leggono
# (sul registro solo GET)
# #
# All the arguments are checked before touching Docker: an option other than --prova (--dry-run, -n, --Prova) or an # Gli argomenti si controllano tutti prima di toccare Docker: un'opzione diversa da --prova (--dry-run, -n, --Prova) o
# extra argument (prova without dashes) stops everything with code 2, instead of starting the real cleanup in place # un argomento in più (prova senza trattini) fermano tutto con codice 2, invece di far partire la pulizia vera al posto
# of the dry run. # della prova.
# #
# Never docker system prune, container prune, volume prune or network prune; never image prune -a or builder prune -a # Mai docker system prune, container prune, volume prune o network prune; mai image prune -a o builder prune -a senza
# without the 24-hour filter; never a container, a volume or a network that does not belong to the CI. The images are # il filtro delle 24 ore; mai un contenitore, un volume o una rete che non sia della CI. Le immagini le toglie Docker
# removed by Docker itself (image prune), which never removes an image used by a container, not even a stopped one; # stesso (image prune), che non toglie mai un'immagine usata da un contenitore, nemmeno fermo; con -a, però, le toglie i
# with -a, though, it removes their extra names, and the script writes them out (in the dry run it estimates them, # nomi in più, e lo script li scrive (nella prova li stima, secondo lo store). Sul registro mai main, latest o una
# depending on the store). On the registry never main, latest or an X.Y.Z version: only the sha-<hexadecimal> tags of # versione X.Y.Z: solo le etichette sha-<esadecimale> della verifica e gli artefatti <x.y.z>-ci.<n> e
# the verification and the <x.y.z>-ci.<n> and <x.y.z>-rilascio.<n> artifacts of the generic febe-ci package. # <x.y.z>-rilascio.<n> del pacchetto generico febe-ci.
# #
# In the «residui», «settimanale» and «completa» modes a test container is removed only if it is stopped. One still # Nei modi «residui», «settimanale» e «completa» un contenitore di prova si toglie solo se è fermo. Uno ancora acceso
# running after 90 minutes (its job was killed right during the container test) stays where it is: it is reported, # dopo 90 minuti (il suo lavoro è stato ucciso proprio durante la prova del contenitore) resta dov'è: lo si segnala, con
# with the command to remove it by hand. The builders are the exception: they are always running and their cache goes # il comando per toglierlo a mano. I builder sono l'eccezione: sono sempre accesi e la loro cache se ne va solo
# away only by removing the container; they are recognised by the exact name and the buildkit image, never by a label. # togliendo il contenitore; si riconoscono dal nome esatto e dall'immagine di buildkit, mai da un'etichetta.
# #
# An object already gone is not an error: the cleanup can be repeated. In the «esecuzione», «penzolanti» and «residui» # Un oggetto già sparito non è un errore: la pulizia si può ripetere. Nei modi «esecuzione», «penzolanti» e «residui»
# modes a problem becomes a warning (a green job does not turn red because of the cleanup, which the Monday workflow # un problema diventa un avviso (un lavoro verde non diventa rosso per la pulizia, che il flusso del lunedì ripete); nei
# repeats); in the «settimanale» and «completa» modes it fails the job, so that someone looks at it. The registry is # modi «settimanale» e «completa» fa fallire il lavoro, perché qualcuno lo guardi. Il registro è l'eccezione: un
# the exception: a refusal by its API is only a warning, and the following Monday it is tried again. # rifiuto della sua API è solo un avviso, e il lunedì dopo si riprova.
# #
# Variables for the registry («completa» mode): REGISTRY_TOKEN (token with «package: read and write», never printed), # Variabili per il registro (modo «completa»): REGISTRY_TOKEN (token con «package: read and write», mai stampato),
# GITEA_API (the server's API, for example https://gitea.example/api/v1) and PROPRIETARIO (the owner of the febe # GITEA_API (l'API del server, per esempio https://gitea.example/api/v1) e PROPRIETARIO (il proprietario del pacchetto
# package). The choice of the versions to remove lives in versioni-registro.sh, next to this script. # febe). La scelta delle versioni da togliere sta in versioni-registro.sh, accanto a questo script.
set -uo pipefail set -uo pipefail
uso() { uso() {
@@ -92,21 +93,21 @@ esac
cartella_script="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cartella_script="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
problemi=0 problemi=0
# In a dry run: the containers (id and name) and the image names the real cleanup would remove, so that the lists # In prova: i contenitori (identificativo e nome) e i nomi di immagine che la pulizia vera toglierebbe, perché gli
# that follow treat them as already removed (a volume used only by a container that would go away, for example, # elenchi che seguono li trattino come già tolti (un volume usato solo da un contenitore che se ne andrebbe, per
# would go away too). # esempio, se ne andrebbe anche lui).
previsti=() previsti=()
nomi_previsti=() nomi_previsti=()
# For the summary: how many objects per kind, in the order they appear, and the space reclaimed by Docker. # Per il riepilogo: quanti oggetti per tipo, nell'ordine in cui compaiono, e lo spazio recuperato da Docker.
declare -A conteggi=() declare -A conteggi=()
tipi=() tipi=()
note=() note=()
# The build cache that is pruned is the one of the daemon's builder, «default». docker builder is an alias of docker # La cache di costruzione che si pota è quella del builder del demone, «default». docker builder è un alias di docker
# buildx when the plugin is there, and buildx works on the current builder: if someone had made the run's builder # buildx quando c'è il plugin, e buildx lavora sul builder corrente: se qualcuno avesse reso corrente il builder
# current (costruisci-immagine.sh builder does not), the «esecuzione» mode would have just removed it. The other # dell'esecuzione (costruisci-immagine.sh builder non lo fa), il modo «esecuzione» l'avrebbe appena tolto. Gli altri
# buildx commands of this script name the builder explicitly. # comandi buildx di questo script indicano il builder per nome.
export BUILDX_BUILDER=default export BUILDX_BUILDER=default
avviso() { avviso() {
@@ -114,7 +115,7 @@ avviso() {
problemi=$((problemi + 1)) problemi=$((problemi + 1))
} }
# A warning that does not turn the job red: for the registry. # Un avviso che non fa diventare rosso il lavoro: per il registro.
segnala() { segnala() {
echo "::warning::$*" echo "::warning::$*"
} }
@@ -124,7 +125,7 @@ conta() {
conteggi[$1]=$((${conteggi[$1]:-0} + 1)) conteggi[$1]=$((${conteggi[$1]:-0} + 1))
} }
# True if the first word is among the ones that follow. # Vero se la prima parola è fra quelle che seguono.
fra() { fra() {
local cercata="$1" voce local cercata="$1" voce
shift shift
@@ -134,9 +135,9 @@ fra() {
return 1 return 1
} }
# Minutes elapsed since an RFC 3339 instant as Docker writes it (Created of a container or an image, CreatedAt of a # Minuti trascorsi da un istante RFC 3339 come lo scrive Docker (Created di un contenitore o di un'immagine, CreatedAt
# volume, {{json .Created}} of a network, in quotes), with or without fractions of a second, with «Z» or with the # di un volume, {{json .Created}} di una rete, fra virgolette), con o senza frazioni di secondo, con «Z» o con lo scarto
# offset from universal time (+02:00). If it cannot be read, 0: when in doubt the object is young and stays. # dall'ora universale (+02:00). Se non si legge, 0: nel dubbio l'oggetto è giovane e resta.
eta_minuti() { eta_minuti() {
local creato="${1:-}" secondi local creato="${1:-}" secondi
creato="${creato//\"/}" creato="${creato//\"/}"
@@ -157,8 +158,8 @@ durata() {
fi fi
} }
# Among the given containers (ids, one per line), those that remain after this cleanup: in a dry run without the ones # Fra i contenitori dati (identificativi, uno per riga), quelli che restano dopo questa pulizia: in prova senza quelli
# the real cleanup would remove. # che la pulizia vera toglierebbe.
restanti() { restanti() {
local id local id
while read -r id; do while read -r id; do
@@ -167,9 +168,9 @@ restanti() {
done <<< "${1:-}" done <<< "${1:-}"
} }
# The CI test containers, one per line «id name»: the label febe.ci.prova (of the given run, or of any run if the # I contenitori di prova della CI, uno per riga «id nome»: l'etichetta febe.ci.prova (dell'esecuzione indicata, o di
# first argument is empty) and the exact name febe-prova-<label value>. The states that follow narrow the choice # qualunque se il primo argomento è vuoto) e il nome esatto febe-prova-<valore dell'etichetta>. Gli stati che seguono
# (Docker joins them with OR). Exits with 1 if Docker does not answer. # restringono la scelta (Docker li unisce in OR). Esce con 1 se Docker non risponde.
contenitori_di_prova() { contenitori_di_prova() {
local run="$1" local run="$1"
shift shift
@@ -184,8 +185,8 @@ contenitori_di_prova() {
done <<< "$elenco" done <<< "$elenco"
} }
# Removes a container with its anonymous volumes (in a dry run it only lists it). With «forza» even if it is running: # Toglie un contenitore con i suoi volumi anonimi (in prova lo elenca soltanto). Con «forza» anche se è acceso: solo
# only for those of the run itself and for the builders. Exits with 0 if the container goes away (or would). # per quelli dell'esecuzione stessa e per i builder. Esce con 0 se il contenitore se ne va (o se ne andrebbe).
togli_contenitore() { togli_contenitore() {
local id="$1" nome="$2" opzioni=(-v) local id="$1" nome="$2" opzioni=(-v)
[[ "${3:-}" == forza ]] && opzioni=(-f -v) [[ "${3:-}" == forza ]] && opzioni=(-f -v)
@@ -202,8 +203,8 @@ togli_contenitore() {
return 1 return 1
} }
# Removes the local name febe-ci:<esecuzione> (or febe:ci), never the image by id and never with -f: if the image also # Toglie il nome locale febe-ci:<esecuzione> (o febe:ci), mai l'immagine per identificativo e mai con -f: se l'immagine
# has another name (a registry one, for example) that one stays; if a container uses it, everything stays. # ha anche un altro nome (del registro, per esempio) quello resta; se un contenitore la usa, resta tutto.
togli_immagine() { togli_immagine() {
local riferimento="$1" nomi local riferimento="$1" nomi
[[ "$riferimento" =~ ^febe-ci:[0-9]+$ ]] || [[ "$riferimento" == febe:ci ]] \ [[ "$riferimento" =~ ^febe-ci:[0-9]+$ ]] || [[ "$riferimento" == febe:ci ]] \
@@ -226,9 +227,9 @@ togli_immagine() {
return 1 return 1
} }
# A CI buildx builder: first with buildx (if this client knows it), then container and volume by name, because a job # Un builder buildx della CI: prima con buildx (se questo client lo conosce), poi contenitore e volume per nome, perché
# other than the one that created it does not have its configuration. The container is removed only if it runs the # un lavoro diverso da quello che l'ha creato non ne ha la configurazione. Il contenitore si toglie solo se gira
# buildkit image, and the volume only when the container is gone. # l'immagine di buildkit, e il volume solo quando il contenitore non c'è più.
togli_builder() { togli_builder() {
local builder="$1" local builder="$1"
[[ "$builder" =~ ^febe-ci-[0-9]+$ ]] || { avviso "Nome di builder inatteso: «$builder»."; return 1; } [[ "$builder" =~ ^febe-ci-[0-9]+$ ]] || { avviso "Nome di builder inatteso: «$builder»."; return 1; }
@@ -261,8 +262,8 @@ togli_builder() {
return "$esito" return "$esito"
} }
# A volume or a network of act_runner. Docker itself does not remove a volume a container uses, nor a network with a # Un volume o una rete di act_runner. Docker stesso non toglie un volume che un contenitore usa, né una rete con un
# running container attached. # contenitore acceso collegato.
togli_volume() { togli_volume() {
local nome="$1" local nome="$1"
if ((prova)); then if ((prova)); then
@@ -291,8 +292,8 @@ togli_rete() {
return 1 return 1
} }
# True if no container, running or stopped, uses the volume or the network (in a dry run: none that the real cleanup # Vero se nessun contenitore, acceso o fermo, usa il volume o la rete (in prova: nessuno che la pulizia vera
# would leave). When in doubt (Docker does not answer) false: it stays. # lascerebbe). Nel dubbio (Docker non risponde) falso: resta.
nessuno_usa() { nessuno_usa() {
local tipo="$1" nome="$2" utenti local tipo="$1" nome="$2" utenti
if [[ "$tipo" == volume ]]; then if [[ "$tipo" == volume ]]; then
@@ -325,7 +326,7 @@ residui() {
echo "== Resti di esecuzioni interrotte della CI di Febe, più vecchi di $minuti minuti" echo "== Resti di esecuzioni interrotte della CI di Febe, più vecchi di $minuti minuti"
local elenco id nome eta riferimento builder local elenco id nome eta riferimento builder
# Stopped test containers: they are removed. Without -f: if one started again in the meantime, Docker leaves it alone. # Contenitori di prova fermi: si tolgono. Senza -f: se nel frattempo uno ripartisse, Docker lo lascia stare.
if elenco=$(contenitori_di_prova "" exited created dead); then if elenco=$(contenitori_di_prova "" exited created dead); then
while read -r id nome; do while read -r id nome; do
[[ -n "${id:-}" ]] || continue [[ -n "${id:-}" ]] || continue
@@ -336,7 +337,7 @@ residui() {
avviso "Non riesco a elencare i contenitori di prova fermi." avviso "Non riesco a elencare i contenitori di prova fermi."
fi fi
# Test containers still running: they are not touched, they are reported. # Contenitori di prova ancora accesi: non si toccano, si segnalano.
if elenco=$(contenitori_di_prova "" running restarting paused); then if elenco=$(contenitori_di_prova "" running restarting paused); then
while read -r id nome; do while read -r id nome; do
[[ -n "${id:-}" ]] || continue [[ -n "${id:-}" ]] || continue
@@ -349,7 +350,7 @@ residui() {
avviso "Non riesco a elencare i contenitori di prova accesi." avviso "Non riesco a elencare i contenitori di prova accesi."
fi fi
# Tested images: only the febe-ci:<esecuzione> names. # Immagini provate: solo i nomi febe-ci:<esecuzione>.
if elenco=$(docker image ls --filter "reference=febe-ci" --format '{{.Repository}}:{{.Tag}}'); then if elenco=$(docker image ls --filter "reference=febe-ci" --format '{{.Repository}}:{{.Tag}}'); then
while read -r riferimento; do while read -r riferimento; do
[[ "${riferimento:-}" =~ ^febe-ci:[0-9]+$ ]] || continue [[ "${riferimento:-}" =~ ^febe-ci:[0-9]+$ ]] || continue
@@ -360,7 +361,7 @@ residui() {
avviso "Non riesco a elencare le immagini febe-ci." avviso "Non riesco a elencare le immagini febe-ci."
fi fi
# buildx builders. Docker's name filter matches part of the name: the exact name is checked here. # Builder buildx. Il filtro per nome di Docker cerca una parte del nome: il nome esatto si controlla qui.
if elenco=$(docker ps -a --no-trunc --filter "name=buildx_buildkit_febe-ci-" --format '{{.ID}} {{.Names}}'); then if elenco=$(docker ps -a --no-trunc --filter "name=buildx_buildkit_febe-ci-" --format '{{.ID}} {{.Names}}'); then
while read -r id nome; do while read -r id nome; do
[[ -n "${id:-}" ]] || continue [[ -n "${id:-}" ]] || continue
@@ -375,7 +376,7 @@ residui() {
fi fi
} }
# The leftovers of the Febe CI and the febe:ci image of the old workflow («settimanale» and «completa» modes). # I resti della CI di Febe e l'immagine febe:ci del vecchio flusso (modi «settimanale» e «completa»).
resti_della_ci() { resti_della_ci() {
residui 90 residui 90
echo "== Immagine febe:ci del vecchio flusso di verifica" echo "== Immagine febe:ci del vecchio flusso di verifica"
@@ -384,16 +385,16 @@ resti_della_ci() {
fi fi
} }
# act_runner names its objects GITEA-ACTIONS-TASK-<task number>, followed by «_WORKFLOW-…» or, in older versions, by # act_runner chiama i suoi oggetti GITEA-ACTIONS-TASK-<numero del compito>, seguito da «_WORKFLOW-…» o, nelle versioni
# «-WORKFLOW-…» with a hash at the end. # più vecchie, da «-WORKFLOW-…» con un'impronta in fondo.
nome_act='^GITEA-ACTIONS-TASK-[0-9]+[-_]' nome_act='^GITEA-ACTIONS-TASK-[0-9]+[-_]'
resti_di_act_runner() { resti_di_act_runner() {
local minuti="$1" elenco id nome eta local minuti="$1" elenco id nome eta
echo "== Resti di act_runner (GITEA-ACTIONS-TASK-…) più vecchi di $minuti minuti: contenitori fermi, volumi e reti che nessun contenitore usa" echo "== Resti di act_runner (GITEA-ACTIONS-TASK-…) più vecchi di $minuti minuti: contenitori fermi, volumi e reti che nessun contenitore usa"
# Stopped containers. Docker's name filter matches part of the name: the exact start is checked here. Without -f: # Contenitori fermi. Il filtro per nome di Docker cerca una parte del nome: l'inizio esatto si controlla qui. Senza
# Docker does not remove a running container. # -f: Docker non toglie un contenitore acceso.
if elenco=$(docker ps -a --no-trunc --filter "name=GITEA-ACTIONS-TASK-" --filter "status=exited" \ if elenco=$(docker ps -a --no-trunc --filter "name=GITEA-ACTIONS-TASK-" --filter "status=exited" \
--filter "status=created" --filter "status=dead" --format '{{.ID}} {{.Names}}'); then --filter "status=created" --filter "status=dead" --format '{{.ID}} {{.Names}}'); then
while read -r id nome; do while read -r id nome; do
@@ -407,7 +408,7 @@ resti_di_act_runner() {
avviso "Non riesco a elencare i contenitori di act_runner." avviso "Non riesco a elencare i contenitori di act_runner."
fi fi
# Volumes no container uses, not even a stopped one. # Volumi che nessun contenitore usa, nemmeno fermo.
if elenco=$(docker volume ls -q --filter "name=GITEA-ACTIONS-TASK-"); then if elenco=$(docker volume ls -q --filter "name=GITEA-ACTIONS-TASK-"); then
while read -r nome; do while read -r nome; do
[[ -n "${nome:-}" && "$nome" =~ $nome_act ]] || continue [[ -n "${nome:-}" && "$nome" =~ $nome_act ]] || continue
@@ -419,8 +420,8 @@ resti_di_act_runner() {
avviso "Non riesco a elencare i volumi di act_runner." avviso "Non riesco a elencare i volumi di act_runner."
fi fi
# Networks no container is attached to, not even a stopped one. Created of a network is a Go time, which the template # Reti a cui nessun contenitore è collegato, nemmeno fermo. Created di una rete è un istante di Go, che il modello
# prints as «2026-10-21 06:17:03 +0200 CEST»: in JSON it is RFC 3339. # stampa come «2026-10-21 06:17:03 +0200 CEST»: in JSON è RFC 3339.
if elenco=$(docker network ls --no-trunc --filter "name=GITEA-ACTIONS-TASK-" --format '{{.ID}} {{.Name}}'); then if elenco=$(docker network ls --no-trunc --filter "name=GITEA-ACTIONS-TASK-" --format '{{.ID}} {{.Name}}'); then
while read -r id nome; do while read -r id nome; do
[[ -n "${id:-}" && "${nome:-}" =~ $nome_act ]] || continue [[ -n "${id:-}" && "${nome:-}" =~ $nome_act ]] || continue
@@ -433,8 +434,9 @@ resti_di_act_runner() {
fi fi
} }
# The images of the containers, running or stopped, except those the cleanup would remove: «id image» one per line, # Le immagini dei contenitori, accesi o fermi, tranne quelli che la pulizia toglierebbe: «identificativo immagine» una
# the image as it was given to docker run (a name or an id). Read only: it serves the dry-run listing. # per riga, l'immagine come la si è data a docker run (un nome o un identificativo). Solo lettura: serve all'elenco
# della prova.
immagini_in_uso() { immagini_in_uso() {
local elenco id nome local elenco id nome
elenco=$(docker ps -a --no-trunc --format '{{.ID}} {{.Names}}') || return 1 elenco=$(docker ps -a --no-trunc --format '{{.ID}} {{.Names}}') || return 1
@@ -447,8 +449,8 @@ immagini_in_uso() {
return 0 return 0
} }
# The full name of an image name, as Docker sorts it: docker.io/library/ or docker.io/ in front of Docker Hub names # Il nome completo di un nome d'immagine, come lo ordina Docker: docker.io/library/ o docker.io/ davanti ai nomi di
# written without a domain, :latest if the tag is missing. # Docker Hub scritti senza dominio, :latest se manca l'etichetta.
nome_completo() { nome_completo() {
local nome="$1" primo local nome="$1" primo
[[ "${nome##*/}" == *:* ]] || nome="$nome:latest" [[ "${nome##*/}" == *:* ]] || nome="$nome:latest"
@@ -464,13 +466,13 @@ nome_completo() {
fi fi
} }
# In a dry run: the names «image prune -a» would remove from an image a container uses (the names and the images of # In prova: i nomi che «image prune -a» toglierebbe a un'immagine che un contenitore usa (i nomi e le immagini dei
# the containers, as docker image ls and docker container inspect write them), one per line. The image stays, but the # contenitori, come li scrivono docker image ls e docker container inspect), uno per riga. L'immagine resta, ma i nomi
# extra names do not (moby). With the classic store Docker removes the names in alphabetical order of the full name # in più no (moby). Con lo store classico Docker toglie i nomi in ordine alfabetico del nome completo e si ferma
# and stops at the last one, the only one it refuses to remove because a container uses the image # all'ultimo, l'unico che rifiuta di togliere perché un contenitore usa l'immagine (daemon/images/image_prune.go e
# (daemon/images/image_prune.go and image_delete.go, isSingleReference): even the name the container was created from # image_delete.go, isSingleReference): può andarsene anche il nome da cui il contenitore è stato creato. Con containerd
# may go. With containerd the names the containers were created from stay and, if one uses it by id and no name would # restano i nomi da cui i contenitori sono stati creati e, se uno la usa per identificativo e nessun nome resterebbe,
# stay, the last one in alphabetical order (daemon/containerd/image_prune.go). # l'ultimo in ordine alfabetico (daemon/containerd/image_prune.go).
nomi_che_perde() { nomi_che_perde() {
local id="$1" nomi="$2" configurazioni="$3" nome completo configurazione resto per_id=0 ordinati quanti local id="$1" nomi="$2" configurazioni="$3" nome completo configurazione resto per_id=0 ordinati quanti
local -A protetti=() local -A protetti=()
@@ -506,10 +508,10 @@ nomi_che_perde() {
return 0 return 0
} }
# In a dry run: the images the pruning would remove, with size and age. No container uses them (apart from those this # In prova: le immagini che la potatura toglierebbe, con dimensione ed età. Nessun contenitore le usa (a parte quelli
# cleanup would remove) and they were created more than N minutes ago; with «senza-nome» only the unnamed ones. With # che questa pulizia toglierebbe) e sono state create più di N minuti fa; con «senza-nome» solo quelle senza nome. Con
# «tutte», for an image a container uses, the extra names Docker would remove from it. It is an estimate made here: in # «tutte», di un'immagine che un contenitore usa, i nomi in più che Docker le toglierebbe. È una stima fatta qui: nella
# the real cleanup Docker decides (image prune). # pulizia vera decide Docker (image prune).
elenca_immagini() { elenca_immagini() {
local minimo="$1" quali="$2" usate elenco id nome breve dimensione eta quante=0 configurazione local minimo="$1" quali="$2" usate elenco id nome breve dimensione eta quante=0 configurazione
local -A nomi=() elenco_nomi=() dimensioni=() aveva_nomi=() usata_da=() local -A nomi=() elenco_nomi=() dimensioni=() aveva_nomi=() usata_da=()
@@ -541,11 +543,11 @@ elenca_immagini() {
[[ "$nome" == *":<none>" ]] || elenco_nomi[$id]+="$nome"$'\n' [[ "$nome" == *":<none>" ]] || elenco_nomi[$id]+="$nome"$'\n'
done <<< "$elenco" done <<< "$elenco"
for id in "${ordine[@]}"; do for id in "${ordine[@]}"; do
# An image whose names the cleanup removes above already goes away with the last one. # Un'immagine i cui nomi la pulizia toglie qui sopra se ne va già con l'ultimo.
[[ -n "${aveva_nomi[$id]:-}" && -z "${nomi[$id]}" ]] && continue [[ -n "${aveva_nomi[$id]:-}" && -z "${nomi[$id]}" ]] && continue
breve="${id#sha256:}" breve="${id#sha256:}"
if [[ -n "${usata_da[$id]+x}" ]]; then if [[ -n "${usata_da[$id]+x}" ]]; then
# A container uses it: it stays. With -a, though, Docker removes its extra names. # Un contenitore la usa: resta. Con -a, però, Docker le toglie i nomi in più.
[[ "$quali" == tutte && -n "${elenco_nomi[$id]}" ]] || continue [[ "$quali" == tutte && -n "${elenco_nomi[$id]}" ]] || continue
eta=$(eta_minuti "$(docker image inspect -f '{{.Created}}' "$id" 2> /dev/null)") eta=$(eta_minuti "$(docker image inspect -f '{{.Created}}' "$id" 2> /dev/null)")
((eta >= minimo)) || continue ((eta >= minimo)) || continue
@@ -573,8 +575,8 @@ elenca_immagini() {
((quante > 0)) || echo " nessuna" ((quante > 0)) || echo " nessuna"
} }
# In a dry run: how much build cache the daemon has. How much of it the pruning would remove Docker does not say # In prova: quanta cache di costruzione ha il demone. Quanta ne toglierebbe la potatura Docker non lo dice senza
# without removing it: at most the part nobody is using («RECLAIMABLE» of docker system df). # toglierla: al più quella che nessuno sta usando («RECLAIMABLE» di docker system df).
elenca_cache() { elenca_cache() {
local riga tipo dimensione recuperabile local riga tipo dimensione recuperabile
riga=$(docker system df --format '{{.Type}}|{{.Size}}|{{.Reclaimable}}' 2> /dev/null | grep '^Build Cache|') riga=$(docker system df --format '{{.Type}}|{{.Size}}|{{.Reclaimable}}' 2> /dev/null | grep '^Build Cache|')
@@ -587,11 +589,11 @@ elenca_cache() {
note+=("cache di costruzione: $dimensione in tutto, al più $recuperabile da togliere") note+=("cache di costruzione: $dimensione in tutto, al più $recuperabile da togliere")
} }
# The daemon's image store: «containerd» (io.containerd.snapshotter.v1, the default in new Docker Engine installations # Lo store delle immagini del demone: «containerd» (io.containerd.snapshotter.v1, predefinito nelle installazioni nuove
# since 29) or «classico» (overlay2 and the other earlier drivers). It decides from when the 24 hours of image prune # di Docker Engine dalla 29) o «classico» (overlay2 e gli altri driver di prima). Ne dipende da quando contano le 24 ore
# --filter until count: with the classic store from the image build (Created of the configuration), with containerd # di image prune --filter until: con lo store classico dalla costruzione dell'immagine (Created della configurazione),
# from when the name arrived on the daemon (CreatedAt of its record, which a new pull of the same name does not # con containerd da quando il nome è arrivato sul demone (CreatedAt del suo record, che un nuovo pull dello stesso nome
# change). # non cambia).
store="" store=""
rileva_store() { rileva_store() {
local stato local stato
@@ -609,21 +611,21 @@ rileva_store() {
esac esac
} }
# Every image with each of its names, «id name» one per line (<none>:<none> if it has none). # Ogni immagine con ciascuno dei suoi nomi, «identificativo nome» una per riga (<none>:<none> se non ne ha).
immagini_e_nomi() { immagini_e_nomi() {
docker image ls --no-trunc --format '{{.ID}} {{.Repository}}:{{.Tag}}' 2> /dev/null docker image ls --no-trunc --format '{{.ID}} {{.Repository}}:{{.Tag}}' 2> /dev/null
} }
# The space reclaimed according to Docker: «Total reclaimed space: 1.2GB» (docker) or «Total: 1.2GB» (buildx). # Lo spazio recuperato secondo Docker: «Total reclaimed space: 1.2GB» (docker) o «Total: 1.2GB» (buildx).
spazio_recuperato() { spazio_recuperato() {
local riga local riga
riga=$(grep -E '^Total' <<< "$1" | tail -n 1 | sed -E 's/^Total( reclaimed space)?:[[:space:]]*//') riga=$(grep -E '^Total' <<< "$1" | tail -n 1 | sed -E 's/^Total( reclaimed space)?:[[:space:]]*//')
echo "${riga:-0B}" echo "${riga:-0B}"
} }
# A Docker image pruning: the names removed, how many images and how much space. An error is a warning. The names are # Una potatura di immagini di Docker: i nomi tolti, quante immagini e quanto spazio. Un errore è un avviso. I nomi si
# compared before and after: with -a Docker also removes the extra names of an image a container uses and that stays, # confrontano prima e dopo: con -a Docker toglie anche i nomi in più di un'immagine che un contenitore usa e che resta,
# and the job log says so. # e il registro del lavoro lo dice.
pota_immagini() { pota_immagini() {
local cosa="$1" uscita prima dopo recuperato prima_nomi dopo_nomi dopo_id id nome breve local cosa="$1" uscita prima dopo recuperato prima_nomi dopo_nomi dopo_id id nome breve
shift shift
@@ -657,7 +659,7 @@ pota_immagini() {
fi fi
} }
# A build cache pruning: how much space. An error is a warning. # Una potatura della cache di costruzione: quanto spazio. Un errore è un avviso.
pota_cache() { pota_cache() {
local cosa="$1" uscita recuperato local cosa="$1" uscita recuperato
shift shift
@@ -670,8 +672,8 @@ pota_cache() {
note+=("$cosa: $recuperato recuperati") note+=("$cosa: $recuperato recuperati")
} }
# A call to the Gitea API with the registry token, which is only in the curl header and never in the job log. Prints # Una chiamata all'API di Gitea con il token del registro, che sta solo nell'intestazione di curl e mai nel registro
# the HTTP code: 000 if Gitea does not answer. # del lavoro. Stampa il codice HTTP: 000 se Gitea non risponde.
chiedi() { chiedi() {
local metodo="$1" indirizzo="$2" uscita="$3" codice local metodo="$1" indirizzo="$2" uscita="$3" codice
codice=$(curl -sS --max-time 30 -X "$metodo" -H "Authorization: token $REGISTRY_TOKEN" -H "Accept: application/json" \ codice=$(curl -sS --max-time 30 -X "$metodo" -H "Authorization: token $REGISTRY_TOKEN" -H "Accept: application/json" \
@@ -688,22 +690,21 @@ spiega() {
esac esac
} }
# The sha- tags of the febe package beyond the 10 most recent, with the package API of Gitea 28: # Le etichette sha- del pacchetto febe oltre le 10 più recenti, con l'API dei pacchetti di Gitea 28:
# GET /api/v1/packages/{proprietario}/container/febe?page=N&limit=50 the versions, one page at a time until an # GET /api/v1/packages/{proprietario}/container/febe?page=N&limit=50 le versioni, una pagina alla volta finché
# empty one arrives (the server may give # ne arriva una vuota (il server può darne
# fewer than 50 per page) # meno di 50 per pagina)
# DELETE /api/v1/packages/{proprietario}/container/febe/{versione} one version (answers 204) # DELETE /api/v1/packages/{proprietario}/container/febe/{versione} una versione (risponde 204)
# Which ones to remove is chosen by versioni-registro.sh (POSIX awk with json.awk: no Node, no jq); here the # Quali togliere lo sceglie versioni-registro.sh (awk POSIX con json.awk: niente Node, niente jq); qui si ricontrolla
# sha-<hexadecimal> form is checked again before every DELETE. Every refusal by the API is a warning that does not # la forma sha-<esadecimale> prima di ogni DELETE. Ogni rifiuto dell'API è un avviso che non fa diventare rosso il
# turn the job red, and after a refusal the registry is not touched any more (the token is the same). The sha256:… # lavoro, e dopo un rifiuto il registro non si tocca più (il token è lo stesso). Le versioni sha256:… senza etichetta (i
# versions without a tag (the child manifests of an index, with the layers) are never touched: the API does not say # manifest figli di un indice, con gli strati) non si toccano mai: l'API non dice se un'etichetta le usa ancora. Si
# whether a tag still uses them. Only their number is reported; the CI publishes plain manifests # dice solo quante sono; la CI pubblica manifest semplici (costruisci-immagine.sh), quindi non dovrebbero essercene, e
# (costruisci-immagine.sh), so there should be none, and those no tag uses are removed by a Gitea cleanup rule # quelle che nessuna etichetta usa le toglie una regola di pulizia di Gitea (docs/processo.md, «Registro dei container»).
# (docs/processo.md, «Registro dei container»). # Poi gli artefatti della CI (artefatti.sh): le versioni del pacchetto generico febe-ci create più di 14 giorni fa,
# Then the CI artifacts (artefatti.sh): the versions of the generic febe-ci package created more than 14 days ago,
# GET /api/v1/packages/{proprietario}/generic/febe-ci?page=N&limit=50 # GET /api/v1/packages/{proprietario}/generic/febe-ci?page=N&limit=50
# DELETE /api/v1/packages/{proprietario}/generic/febe-ci/{versione} the version with its files (204) # DELETE /api/v1/packages/{proprietario}/generic/febe-ci/{versione} la versione con i suoi file (204)
# only with the form <x.y.z>-ci.<n> or <x.y.z>-rilascio.<n>, checked again before every DELETE. # solo con la forma <x.y.z>-ci.<n> o <x.y.z>-rilascio.<n>, ricontrollata prima di ogni DELETE.
registro() { registro() {
local tenere=10 local tenere=10
echo "== Registro: le etichette sha- del pacchetto febe oltre le $tenere più recenti" echo "== Registro: le etichette sha- del pacchetto febe oltre le $tenere più recenti"
@@ -736,9 +737,9 @@ registro() {
artefatti_della_ci artefatti_della_ci
} }
# The pages of the versions of a package in the folder, pagina-<n>.json, up to the first empty one (the server may give # Le pagine delle versioni di un pacchetto nella cartella, pagina-<n>.json, fino alla prima vuota (il server può darne
# fewer than 50 per page). Exits with 0 if it read them, 1 if the package is not there (404 on the first page), 2 if # meno di 50 per pagina). Esce con 0 se le ha lette, 1 se il pacchetto non c'è (404 alla prima pagina), 2 se l'API
# the API refuses (and reports it). # rifiuta (e lo segnala).
pagine() { pagine() {
local base="$1" cartella="$2" nome="$3" pagina codice local base="$1" cartella="$2" nome="$3" pagina codice
for ((pagina = 1; ; pagina++)); do for ((pagina = 1; ; pagina++)); do
@@ -760,7 +761,7 @@ pagine() {
done done
} }
# The sha- tags of the febe container, from the pages already read. # Le etichette sha- del contenitore febe, dalle pagine già lette.
contenitore() { contenitore() {
local base="$1" cartella="$2" scelte senza_etichetta quante codice local base="$1" cartella="$2" scelte senza_etichetta quante codice
if ! scelte=$(bash "$cartella_script/versioni-registro.sh" "$tenere" "$cartella"/pagina-*.json) \ if ! scelte=$(bash "$cartella_script/versioni-registro.sh" "$tenere" "$cartella"/pagina-*.json) \
@@ -799,8 +800,8 @@ contenitore() {
done <<< "$scelte" done <<< "$scelte"
} }
# The CI artifacts (artefatti.sh): the versions of the generic febe-ci package created more than 14 days ago, like the # Gli artefatti della CI (artefatti.sh): le versioni del pacchetto generico febe-ci create più di 14 giorni fa, come la
# artifact expiry of the old days. # scadenza degli artefatti di una volta.
artefatti_della_ci() { artefatti_della_ci() {
local giorni=14 base="${GITEA_API%/}/packages/$PROPRIETARIO/generic/febe-ci" cartella esito scelte versione creata codice local giorni=14 base="${GITEA_API%/}/packages/$PROPRIETARIO/generic/febe-ci" cartella esito scelte versione creata codice
echo "== Registro: gli artefatti della CI (pacchetto febe-ci) creati più di $giorni giorni fa" echo "== Registro: gli artefatti della CI (pacchetto febe-ci) creati più di $giorni giorni fa"
@@ -840,8 +841,8 @@ artefatti_della_ci() {
done <<< "$scelte" done <<< "$scelte"
} }
# The cache with the same limit as on Monday: without it, every push of every branch would remove the intermediate # La cache con lo stesso limite del lunedì: senza, a ogni push di ogni ramo se ne andrebbero gli strati intermedi e le
# layers and the mounted caches (RUN --mount=type=cache) that the builds of the other projects have just used. # cache montate (RUN --mount=type=cache) che le costruzioni degli altri progetti hanno appena usato.
penzolanti() { penzolanti() {
echo "== Immagini senza nome che nessun contenitore usa e cache di costruzione penzolante non usata da 24 ore, di tutti i progetti" echo "== Immagini senza nome che nessun contenitore usa e cache di costruzione penzolante non usata da 24 ore, di tutti i progetti"
if ((prova)); then if ((prova)); then
@@ -863,9 +864,9 @@ settimanale() {
fi fi
} }
# Everything «settimanale» does (the unnamed images older than 72 hours are among those no container uses created # Tutto ciò che fa «settimanale» (le immagini senza nome più vecchie di 72 ore sono fra quelle che nessun contenitore
# more than 24 hours ago) plus the act_runner leftovers, everyone's images and cache, and the registry. Containers # usa create più di 24 ore fa) e in più i resti di act_runner, le immagini e la cache di tutti e il registro. Prima i
# first, so that their images, volumes and networks are left with nobody using them. # contenitori, così le loro immagini, i loro volumi e le loro reti restano senza nessuno che li usi.
completa() { completa() {
resti_della_ci resti_della_ci
resti_di_act_runner 90 resti_di_act_runner 90
+15 -15
View File
@@ -1,15 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary of the test results (.trx files of «dotnet test --logger trx»): passed, failed and skipped for each file, # Riepilogo dei risultati delle prove (file .trx di «dotnet test --logger trx»): superate, fallite e saltate per ogni
# the names of the failed ones and the reasons of the skipped ones. It writes it to the log and, if the runner offers # file, i nomi delle fallite e i motivi delle saltate. Lo scrive nel registro e, se il runner lo offre, nel riepilogo
# it, to the job summary (GITHUB_STEP_SUMMARY). No response body nor personal data: only test names and messages. # del lavoro (GITHUB_STEP_SUMMARY). Nessun corpo di risposta né dato personale: solo nomi di prove e messaggi.
# #
# .gitea/scripts/riepilogo-prove.sh <cartella dei .trx> [saltate ammesse] # .gitea/scripts/riepilogo-prove.sh <cartella dei .trx> [saltate ammesse]
# #
# Exits with 1 if a test failed, if the skipped ones are more than those allowed (default 0: the CI has Chromium and # Esce con 1 se una prova è fallita, se le saltate sono più di quelle ammesse (predefinito 0: nella CI ci sono
# Xvfb, so no test has a reason to be skipped) or if there is no result at all. The only exception is the «da fare» # Chromium e Xvfb, quindi nessuna prova ha motivo di saltarsi) o se non c'è nessun risultato. Fa eccezione solo la
# category: the inconclusive results of FeaturesStillToDo (H.264 conformance streams for the parts the decoder does # categoria «da fare»: le inconclusive di FeaturesStillToDo (flussi di conformità H.264 delle parti che il
# not handle yet) whose reason starts with «da fare: » are listed and do not count among the skipped ones. # decodificatore non gestisce ancora) il cui motivo comincia con «da fare: » si elencano e non contano fra le saltate.
# Any other inconclusive result, even with «da fare: » in its message, is a skipped one. # Qualunque altra inconclusiva, anche con «da fare: » nel messaggio, è una saltata.
set -euo pipefail set -euo pipefail
cartella="${1:?Indica la cartella con i file .trx.}" cartella="${1:?Indica la cartella con i file .trx.}"
@@ -29,10 +29,10 @@ trap 'rm -f "$riepilogo"' EXIT
fallite_totali=0 fallite_totali=0
saltate_totali=0 saltate_totali=0
dafare_totali=0 dafare_totali=0
# «Da fare»: an inconclusive result of FeaturesStillToDo whose reason starts with «da fare: » right after the MSTest # «Da fare»: una inconclusiva di FeaturesStillToDo il cui motivo comincia con «da fare: » subito dopo la cornice di MSTest
# frame («Assert.Inconclusive. », «Assert.Inconclusive failed. », «Assert.Inconclusive non riuscito. »): it marks a part # («Assert.Inconclusive. », «Assert.Inconclusive failed. », «Assert.Inconclusive non riuscito. »): segna una parte non
# not written yet, not a broken environment, and is counted apart. Both the test name and the start of the reason are # ancora scritta, non un ambiente rotto, e si conta a parte. Il nome della prova e l'inizio del motivo sono entrambi
# constrained: no other test can skip silently by writing «da fare: » in its message. # vincolati: nessun'altra prova può saltarsi in silenzio scrivendo «da fare: » nel messaggio.
da_fare='$1 != "Passed" && $1 != "Failed" && $1 != "Error" && $1 != "Timeout" && $1 != "Aborted" && $2 ~ /^FeaturesStillToDo( |\(|$)/ && $3 ~ /^Assert\.Inconclusive[^.]*\. *da fare: /' da_fare='$1 != "Passed" && $1 != "Failed" && $1 != "Error" && $1 != "Timeout" && $1 != "Aborted" && $2 ~ /^FeaturesStillToDo( |\(|$)/ && $3 ~ /^Assert\.Inconclusive[^.]*\. *da fare: /'
{ {
echo "### Prove" echo "### Prove"
@@ -43,7 +43,7 @@ da_fare='$1 != "Passed" && $1 != "Failed" && $1 != "Error" && $1 != "Timeout" &&
for trx in "${file[@]}"; do for trx in "${file[@]}"; do
nome="$(basename "$trx")" nome="$(basename "$trx")"
# One result per line (the .trx files are XML over several lines), then name, outcome and first message of each. # Un risultato per riga (i .trx sono XML su più righe), poi nome, esito e primo messaggio di ciascuno.
righe="$(tr '\r\n' ' ' < "$trx" | sed 's/<UnitTestResult /\n<UnitTestResult /g' | awk ' righe="$(tr '\r\n' ' ' < "$trx" | sed 's/<UnitTestResult /\n<UnitTestResult /g' | awk '
function attributo(testo, chiave, inizio) { function attributo(testo, chiave, inizio) {
if (match(testo, chiave "=\"[^\"]*\"")) { if (match(testo, chiave "=\"[^\"]*\"")) {
@@ -83,14 +83,14 @@ for trx in "${file[@]}"; do
if (( fallite > 0 )); then if (( fallite > 0 )); then
echo " Fallite:" echo " Fallite:"
# The extra lines are read and discarded (no «head»: with pipefail the SIGPIPE would stop the script). # Le righe in più si leggono e si scartano (niente «head»: con pipefail il SIGPIPE fermerebbe lo script).
printf '%s\n' "$righe" | awk -F'\t' '$1 == "Failed" || $1 == "Error" || $1 == "Timeout" || $1 == "Aborted" { printf '%s\n' "$righe" | awk -F'\t' '$1 == "Failed" || $1 == "Error" || $1 == "Timeout" || $1 == "Aborted" {
if (++n > 50) next; m = $3; if (length(m) > 300) m = substr(m, 1, 300) "…"; print " - " $2 ": " m }' if (++n > 50) next; m = $3; if (length(m) > 300) m = substr(m, 1, 300) "…"; print " - " $2 ": " m }'
fi fi
if (( saltate > 0 )); then if (( saltate > 0 )); then
echo " Saltate, per motivo:" echo " Saltate, per motivo:"
# The reason without the MSTest frame («Il metodo … ha generato un'eccezione. Assert.Inconclusive.»). # Il motivo senza la cornice di MSTest («Il metodo … ha generato un'eccezione. Assert.Inconclusive.»).
printf '%s\n' "$righe" | awk -F'\t' "!($da_fare)"' && $1 != "Passed" && $1 != "Failed" && $1 != "Error" && $1 != "Timeout" && $1 != "Aborted" { printf '%s\n' "$righe" | awk -F'\t' "!($da_fare)"' && $1 != "Passed" && $1 != "Failed" && $1 != "Error" && $1 != "Timeout" && $1 != "Aborted" {
m = $3; sub(/^.*Assert\.Inconclusive\. */, "", m); if (m == "") m = "(nessun motivo)"; print m }' \ m = $3; sub(/^.*Assert\.Inconclusive\. */, "", m); if (m == "") m = "(nessun motivo)"; print m }' \
| sort | uniq -c | sort -rn | awk 'NR <= 30 { sub(/^ */, " "); print }' | sort | uniq -c | sort -rn | awk 'NR <= 30 { sub(/^ */, " "); print }'
+11 -11
View File
@@ -1,15 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Vulnerability scan of the Docker image with Trivy, at a fixed version (strumento.sh), on the archive produced by # Scansione delle vulnerabilità dell'immagine Docker con Trivy, a versione fissa (strumento.sh), sull'archivio prodotto
# the build (docker save or buildx --output type=docker): no daemon is needed, and the very image that was tested is # dalla costruzione (docker save o buildx --output type=docker): non serve il demone, e si scansiona proprio
# scanned. Debian packages and Febe's .NET dependencies (the *.deps.json files). # l'immagine provata. Pacchetti di Debian e dipendenze .NET di Febe (i file *.deps.json).
# #
# .gitea/scripts/scansione-immagine.sh <immagine.tar> [cartella dei rapporti] # .gitea/scripts/scansione-immagine.sh <immagine.tar> [cartella dei rapporti]
# #
# The rule (docs/processo.md, «Rilievi di sicurezza»): # La regola (docs/processo.md, «Rilievi di sicurezza»):
# - CRITICAL with a fix available: the job fails and the image is not published; # - CRITICAL con una correzione disponibile: il lavoro fallisce e l'immagine non si pubblica;
# - HIGH, and CRITICAL still without a fix: reported in the log and in trivy.json, without stopping anything. # - HIGH, e CRITICAL ancora senza correzione: si riportano nel registro e in trivy.json, senza fermare nulla.
# The exceptions live only in .trivyignore, at the repository root: one identifier per line, with the expiry # Le eccezioni stanno solo in .trivyignore, alla radice del repository: un identificativo per riga, con la scadenza
# (exp:AAAA-MM-GG) and, on the line above, the written reason and who decided it. # (exp:AAAA-MM-GG) e, sulla riga sopra, il motivo scritto e chi l'ha deciso.
set -euo pipefail set -euo pipefail
radice="$(git rev-parse --show-toplevel)" radice="$(git rev-parse --show-toplevel)"
@@ -22,7 +22,7 @@ strumenti="$lavoro/febe-strumenti"
bash "$radice/.gitea/scripts/strumento.sh" trivy "$strumenti" bash "$radice/.gitea/scripts/strumento.sh" trivy "$strumenti"
mkdir -p "$rapporti" mkdir -p "$rapporti"
# No progress bars, no check for new versions, no usage data. # Niente barre di avanzamento, niente controllo di versioni nuove, niente dati d'uso.
export TRIVY_NO_PROGRESS=true TRIVY_SKIP_VERSION_CHECK=true TRIVY_DISABLE_TELEMETRY=true export TRIVY_NO_PROGRESS=true TRIVY_SKIP_VERSION_CHECK=true TRIVY_DISABLE_TELEMETRY=true
export TRIVY_CACHE_DIR="$lavoro/febe-trivy-cache" export TRIVY_CACHE_DIR="$lavoro/febe-trivy-cache"
comuni=(image --input "$archivio" --scanners vuln --timeout 20m) comuni=(image --input "$archivio" --scanners vuln --timeout 20m)
@@ -35,8 +35,8 @@ echo "== Vulnerabilità HIGH e CRITICAL (rapporto: non fermano il lavoro)"
"$strumenti/trivy" "${comuni[@]}" --severity HIGH,CRITICAL --format json --output "$rapporti/trivy.json" --exit-code 0 "$strumenti/trivy" "${comuni[@]}" --severity HIGH,CRITICAL --format json --output "$rapporti/trivy.json" --exit-code 0
"$strumenti/trivy" convert --format table "$rapporti/trivy.json" "$strumenti/trivy" convert --format table "$rapporti/trivy.json"
# The count with our own JSON reader (json.sh, awk): no jq. One line per vulnerability, severity and the version that # Il conteggio con il lettore JSON nostro (json.sh, awk): niente jq. Una riga per vulnerabilità, gravità e versione
# fixes it (empty or null if there is none). An unreadable report stops nothing: it just says so. # che la corregge (vuota o null se non c'è). Un rapporto illeggibile non ferma nulla: lo dice e basta.
if vulnerabilita=$(bash "$radice/.gitea/scripts/json.sh" campi "Results/*/Vulnerabilities/*" Severity,FixedVersion "$rapporti/trivy.json"); then if vulnerabilita=$(bash "$radice/.gitea/scripts/json.sh" campi "Results/*/Vulnerabilities/*" Severity,FixedVersion "$rapporti/trivy.json"); then
conteggio=$(awk -F '\t' ' conteggio=$(awk -F '\t' '
$1 == "HIGH" { alte++ } $1 == "HIGH" { alte++ }
+8 -9
View File
@@ -1,15 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Looks for secrets (tokens, keys, passwords) with gitleaks, at a fixed version (strumento.sh), in the whole history # Cerca segreti (gettoni, chiavi, password) con gitleaks, a versione fissa (strumento.sh), in tutta la storia del
# of the commit being verified: every commit it descends from, not only the last one. Each branch is checked on its # commit verificato: ogni commit da cui discende, non solo l'ultimo. Ogni ramo si controlla al suo push (main a ogni
# own push (main at every merge), so a finding on one branch does not block the others. A secret never appears in # unione), così un rilievo su un ramo non blocca gli altri. Un segreto non compare mai per intero: --redact lo
# full: --redact replaces it with REDACTED in the log and in the report, and here only rule, file, line, commit and # sostituisce con REDACTED nel registro e nel rapporto, e qui si stampano solo regola, file, riga, commit e impronta.
# fingerprint are printed.
# #
# .gitea/scripts/segreti.sh [cartella del rapporto] # .gitea/scripts/segreti.sh [cartella del rapporto]
# #
# What to do with a finding: docs/processo.md, «Rilievi di sicurezza». In short: a real secret is revoked at once # Che cosa fare con un rilievo: docs/processo.md, «Rilievi di sicurezza». In breve: un segreto vero si revoca subito
# (removing it from the history is not enough); a false alarm already checked (fake test data) goes into # (toglierlo dalla storia non basta); un falso allarme già controllato (un dato di prova finto) si mette in
# .gitleaksignore with its fingerprint and, on the line above, a comment saying what it is and who checked it. # .gitleaksignore con la sua impronta e, sulla riga sopra, un commento che dice che cos'è e chi l'ha controllato.
set -euo pipefail set -euo pipefail
radice="$(git rev-parse --show-toplevel)" radice="$(git rev-parse --show-toplevel)"
@@ -38,7 +37,7 @@ if ((stato == 0)); then
exit 0 exit 0
fi fi
# The summary with our own JSON reader (json.sh, awk): no jq. # Il riassunto con il lettore JSON nostro (json.sh, awk): niente jq.
if [[ -s "$rapporto" ]] \ if [[ -s "$rapporto" ]] \
&& rilievi=$(bash "$radice/.gitea/scripts/json.sh" campi "*" RuleID,File,StartLine,Commit,Fingerprint "$rapporto"); then && rilievi=$(bash "$radice/.gitea/scripts/json.sh" campi "*" RuleID,File,StartLine,Commit,Fingerprint "$rapporto"); then
quanti=0 quanti=0
+8 -8
View File
@@ -1,15 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Installs one of the two external tools of the CI, the only ones Alberto approved and only for the CI (20 October # Installa uno dei due strumenti esterni della CI, gli unici approvati da Alberto e solo per la CI (20 ottobre 2026):
# 2026): gitleaks (secrets in the history) and Trivy (image vulnerabilities). Fixed version, archive downloaded from # gitleaks (segreti nella storia) e Trivy (vulnerabilità dell'immagine). Versione fissa, archivio scaricato dalla
# the project's release and installed only if its SHA-256 hash matches the one written here. The hashes are those of # release del progetto e installato solo se la sua impronta SHA-256 coincide con quella scritta qui. Le impronte sono
# the releases' *_checksums.txt files, checked again on 20 October 2026 against the downloaded archive and the hash # quelle dei file *_checksums.txt delle release, ricontrollate il 20 ottobre 2026 sull'archivio scaricato e
# GitHub shows for the attachment. # sull'impronta che GitHub mostra per l'allegato.
# #
# .gitea/scripts/strumento.sh gitleaks|trivy <cartella> # .gitea/scripts/strumento.sh gitleaks|trivy <cartella>
# #
# To update a tool, version and hash change together, in a single commit, with a line in docs/decisioni.md. Never # Per aggiornare uno strumento si cambiano versione e impronta insieme, in un commit solo, con una riga in
# «latest», never third-party actions (trivy-action was compromised in March 2026, CVE-2026-33634), never an install # docs/decisioni.md. Mai «latest», mai le azioni di terzi (trivy-action fu compromessa a marzo 2026, CVE-2026-33634),
# script downloaded on the fly. # mai uno script di installazione scaricato al volo.
set -euo pipefail set -euo pipefail
nome="${1:?Indica lo strumento: gitleaks o trivy.}" nome="${1:?Indica lo strumento: gitleaks o trivy.}"
+19 -20
View File
@@ -1,24 +1,23 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Chooses the versions to remove from Gitea's package registry (pulizia-docker.sh, «completa» mode). It reads only the # Sceglie le versioni da togliere dal registro dei pacchetti di Gitea (pulizia-docker.sh, modo «completa»). Legge solo
# files it is given, with json.awk and versioni-registro.awk (POSIX awk: no jq, no Node): no network, no writes, so it # i file che riceve, con json.awk e versioni-registro.awk (awk POSIX: niente jq, niente Node): niente rete, niente
# is tested with a JSON file (PipelineTests). # scritture, quindi si prova con un file JSON (PipelineTests).
# #
# versioni-registro.sh <quante tenere> <pagina.json>... the sha-<7 to 40 hexadecimal digits> tags of # versioni-registro.sh <quante tenere> <pagina.json>... le etichette sha-<da 7 a 40 cifre esadecimali>
# the febe container beyond the N most recent # del contenitore febe oltre le N più recenti
# versioni-registro.sh senza-etichetta <pagina.json>... the sha256:<64 digits> versions of the febe # versioni-registro.sh senza-etichetta <pagina.json>... le versioni sha256:<64 cifre> del contenitore
# container (the manifests of an index: only to # febe (i manifest di un indice: solo da contare)
# be counted) # versioni-registro.sh scadute <giorni> <adesso> <pagina.json>... le versioni <x.y.z>-ci.<n> e
# versioni-registro.sh scadute <giorni> <adesso> <pagina.json>... the <x.y.z>-ci.<n> and <x.y.z>-rilascio.<n> # <x.y.z>-rilascio.<n> del pacchetto generico
# versions of the generic febe-ci package (the CI # febe-ci (gli artefatti della CI, artefatti.sh)
# artifacts, artefatti.sh) created more than # create più di <giorni> giorni prima di <adesso>,
# <giorni> days before <adesso>, in seconds since # in secondi dal 1970
# 1970
# #
# Each page is a response of GET /api/v1/packages/{owner}/{type}/{name} of Gitea 28. Prints, oldest first and one per # Ogni pagina è una risposta di GET /api/v1/packages/{proprietario}/{tipo}/{nome} di Gitea 28. Stampa, dalla più
# line, «version<TAB>created». Everything else always stays: main, latest, the X.Y.Z versions (also X.Y.Z-rc.N), the # vecchia e una per riga, «versione<TAB>creata». Tutto il resto resta sempre: main, latest, le versioni X.Y.Z (anche
# digests, every other tag, a sha- tag or an artifact without a readable date. Among the sha- tags the dates count, # X.Y.Z-rc.N), i digest, ogni altra etichetta, una sha- o un artefatto senza una data che si legga. Fra le sha- contano
# not the text; with equal dates the identifier. If a file is not a JSON list it exits with 2 and prints nothing: when # le date, non il testo; a parità di data l'identificativo. Se un file non è un elenco JSON esce con 2 e non stampa
# in doubt nothing is removed. # nulla: nel dubbio non si toglie niente.
set -euo pipefail set -euo pipefail
qui="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" qui="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -49,7 +48,7 @@ export LC_ALL=C
tab=$'\t' tab=$'\t'
versioni=$(awk -v tipo="$tipo" -v nome="$nome" -f "$qui/json.awk" -f "$qui/versioni-registro.awk" "$@") || exit 2 versioni=$(awk -v tipo="$tipo" -v nome="$nome" -f "$qui/json.awk" -f "$qui/versioni-registro.awk" "$@") || exit 2
# Lines: milliseconds (or «-»), identifier, order, version, date as written. # Righe: millisecondi (o «-»), identificativo, ordine, versione, data come scritta.
case "$modo" in case "$modo" in
senza-etichetta) senza-etichetta)
awk -F "$tab" -v OFS="$tab" '$4 ~ /^sha256:[0-9a-f]+$/ && length($4) == 71 { if ($1 == "-") $1 = 0; print }' <<< "$versioni" \ awk -F "$tab" -v OFS="$tab" '$4 ~ /^sha256:[0-9a-f]+$/ && length($4) == 71 { if ($1 == "-") $1 = 0; print }' <<< "$versioni" \
@@ -61,7 +60,7 @@ case "$modo" in
| sort -t "$tab" -k1,1n -k2,2n -k3,3n | cut -f4,5 | sort -t "$tab" -k1,1n -k2,2n -k3,3n | cut -f4,5
;; ;;
*) *)
# The most recent first (date, then identifier), the first N are skipped, the rest from the oldest. # Le più recenti prima (data, poi identificativo), si saltano le prime N, il resto dalla più vecchia.
awk -F "$tab" '$1 != "-" && $4 ~ /^sha-[0-9a-f]+$/ && length($4) >= 11 && length($4) <= 44' <<< "$versioni" \ awk -F "$tab" '$1 != "-" && $4 ~ /^sha-[0-9a-f]+$/ && length($4) >= 11 && length($4) <= 44' <<< "$versioni" \
| sort -t "$tab" -k1,1nr -k2,2nr -k3,3n | tail -n "+$((modo + 1))" \ | sort -t "$tab" -k1,1nr -k2,2nr -k3,3n | tail -n "+$((modo + 1))" \
| awk '{ righe[NR] = $0 } END { for (i = NR; i > 0; i--) print righe[i] }' | cut -f4,5 | awk '{ righe[NR] = $0 } END { for (i = NR; i > 0; i--) print righe[i] }' | cut -f4,5
+22 -23
View File
@@ -1,22 +1,22 @@
# Monday cleanup (at 4:17, Gitea server time) and by hand (Actions ▸ pulizia ▸ Esegui) of the runner's Docker daemon and # Pulizia del lunedì (alle 4:17, ora del server di Gitea) e a mano (Actions ▸ pulizia ▸ Esegui) del demone Docker del
# of the container registry. By hand, with «Solo prova» ticked, it lists what it would remove and removes nothing: to # runner e del registro dei container. A mano, con «Solo prova» spuntato, elenca che cosa toglierebbe e non toglie
# be run before the first real cleanup and after every change to the script. # nulla: da lanciare prima della prima pulizia vera e dopo ogni cambio dello script.
# Every verification and release run already removes what it creates and, for everyone, the unnamed images and the # Ogni esecuzione di verifica e di rilascio toglie già ciò che crea e, per tutti, le immagini senza nome e la cache di
# dangling build cache unused for 24 hours. Here, since 21 October 2026 (decision of Alberto: delete everything that # costruzione penzolante non usata da 24 ore. Qui, dal 21 ottobre 2026 (decisione di Alberto: eliminare tutto ciò che
# is no longer needed), what nobody needs any more is removed too, of any project (pulizia-docker.sh completa): # non serve più), si toglie anche ciò che non serve più a nessuno, di qualunque progetto (pulizia-docker.sh completa):
# - the leftovers of the Febe CI: stopped test containers (label febe.ci.prova and name febe-prova-<esecuzione>, # - i resti della CI di Febe: contenitori di prova fermi (etichetta febe.ci.prova e nome febe-prova-<esecuzione>, mai
# never the febe.ci.* labels a real Febe inherits from the image), local names febe-ci:<esecuzione>, builders # le etichette febe.ci.* che un Febe vero eredita dall'immagine), nomi locali febe-ci:<esecuzione>, builder
# febe-ci-<esecuzione>, the febe:ci image of the old workflow; # febe-ci-<esecuzione>, l'immagine febe:ci del vecchio flusso;
# - the leftovers of act_runner: stopped containers, volumes and networks GITEA-ACTIONS-TASK-… no container uses, # - i resti di act_runner: contenitori fermi, volumi e reti GITEA-ACTIONS-TASK-… che nessun contenitore usa, più
# older than 90 minutes; # vecchi di 90 minuti;
# - the images no container uses, running or stopped, created more than 24 hours ago (from an image in use Docker # - le immagini che nessun contenitore usa, né acceso né fermo, create più di 24 ore fa (di un'immagine in uso Docker
# removes the extra names), and the daemon's build cache unused for 24 hours. The base images (debian:trixie, # toglie i nomi in più), e la cache di costruzione del demone non usata da 24 ore. Le immagini di base
# moby/buildkit, …) are downloaded again by the first run that asks for them; # (debian:trixie, moby/buildkit, …) si riscaricano alla prima esecuzione che le chiede;
# - with the REGISTRY_TOKEN secret, the registry's sha- tags beyond the 10 most recent, never main, latest or X.Y.Z, # - con il segreto REGISTRY_TOKEN, le etichette sha- del registro oltre le 10 più recenti, mai main, latest o X.Y.Z,
# and the CI artifacts (generic package febe-ci, artefatti.sh) created more than 14 days ago. # e gli artefatti della CI (pacchetto generico febe-ci, artefatti.sh) creati più di 14 giorni fa.
# Never system prune, container prune, volume prune or network prune; never a container, a volume or a network that # Mai system prune, container prune, volume prune o network prune; mai un contenitore, un volume o una rete che non sia
# does not belong to the CI. A test container still running is reported and the job turns red; a refusal by the # della CI. Un contenitore di prova ancora acceso si segnala e il lavoro diventa rosso; un rifiuto dell'API del
# registry API is only a warning. Details in .gitea/scripts/pulizia-docker.sh and in docs/processo.md, «Pulizia». # registro è solo un avviso. Dettagli in .gitea/scripts/pulizia-docker.sh e in docs/processo.md, «Pulizia».
name: pulizia name: pulizia
on: on:
@@ -67,10 +67,9 @@ jobs:
git checkout -q --force --detach "$GITHUB_SHA" git checkout -q --force --detach "$GITHUB_SHA"
git log -1 --format='Commit %h: %s' git log -1 --format='Commit %h: %s'
# Gitea 28 puts the «prova» checkbox in the event as text, "true" or "false"; on Monday the event has no inputs # Gitea 28 mette nell'evento la casella «prova» come testo, "true" o "false"; il lunedì l'evento non ha input e
# and the cleanup is the real one. A start through the API passes the value as it is: any other («True», «1») # la pulizia è quella vera. Un avvio con l'API passa il valore così com'è: qualunque altro («True», «1») ferma il
# stops the job without touching anything. The registry token goes only into this step's environment and is # lavoro senza toccare nulla. Il token del registro va solo nell'ambiente di questo passo e non si stampa mai.
# never printed.
- name: Pulizia completa del demone Docker e del registro - name: Pulizia completa del demone Docker e del registro
env: env:
PROVA: ${{ gitea.event.inputs.prova }} PROVA: ${{ gitea.event.inputs.prova }}
+58 -58
View File
@@ -1,43 +1,43 @@
# Release at every vX.Y.Z tag (also vX.Y.Z-something for a preview): # Rilascio a ogni tag vX.Y.Z (anche vX.Y.Z-qualcosa per un'anteprima):
# 1. prove: the tag matches <Version> in Directory.Build.props, the solution builds with warnings as errors and all # 1. prove: il tag coincide con <Version> di Directory.Build.props, la soluzione si compila con gli avvisi come errori
# the tests pass, in the same Debian 13 container as the verification (real Chromium and Xvfb) and without any # e tutte le prove passano, nello stesso contenitore Debian 13 della verifica (Chromium e Xvfb veri) e
# skipped test. Without green tests nothing is built or released; # senza nessuna prova saltata. Senza prove verdi non si costruisce né si rilascia nulla;
# 2. windows: Febe.exe in a single file, our own installer (src/Febe.Installer) and the portable zip # 2. windows: Febe.exe in un file solo, il programma di installazione nostro (src/Febe.Installer) e lo zip portabile
# (installer/costruisci.sh, runs on Linux with the .NET SDK only): the gate before the image; # (installer/costruisci.sh, gira su Linux con il solo .NET SDK): il cancello prima dell'immagine;
# 3. immagine: after the installer, the Docker image (the tests also run inside the build), tested without network # 3. immagine: dopo l'installatore, l'immagine Docker (le prove girano anche dentro la build), provata senza rete e
# and scanned with Trivy as in the verification (a CRITICAL with a fix stops everything), then published on the # scansionata con Trivy come nella verifica (una CRITICAL con correzione ferma tutto), poi pubblicata sul registro
# Gitea container registry as <registro>/<proprietario>/febe:X.Y.Z and :latest (only for versions without a # dei container di Gitea come <registro>/<proprietario>/febe:X.Y.Z e :latest (solo per le versioni senza
# dash). The job says whether it published it, and at the end it always removes the run's images, containers, # trattino). Il lavoro dice se l'ha pubblicata, e alla fine toglie sempre immagini, contenitori, cache e builder
# cache and builder, then the unnamed images and the dangling build cache unused for 24 hours of all the # dell'esecuzione, poi le immagini senza nome e la cache di costruzione penzolante non usata da 24 ore di tutti i
# daemon's projects; # progetti del demone;
# 4. release: only after the tests, the installer and the image. It rebuilds installer and zip from the same commit # 4. release: solo dopo le prove, l'installatore e l'immagine. Ricostruisce installatore e zip dallo stesso commit con
# with the same script (without actions there is no way to pass artifacts between jobs that does not depend on # lo stesso script (senza azioni non c'è un passaggio di artefatti fra i lavori che non dipenda da REGISTRY_TOKEN,
# REGISTRY_TOKEN, and the release must come out without it too), then creates the release (or completes it, if # e la release deve uscire anche senza), poi crea la release (o la completa, se esiste già) con installatore, zip
# it already exists) with installer, portable zip, Unraid template and the Docker Compose archive (compose.yml # portabile, modello Unraid e l'archivio per Docker Compose (compose.yml con il profilo seccomp accanto); le note
# with the seccomp profile next to it); the notes say where the image is, or that it was not published. # dicono dove sta l'immagine, o che non è stata pubblicata.
# #
# No actions, as in the verification (decision of 18 November 2026): sources with git and the job token, SDK with # Niente azioni, come nella verifica (decisione del 18 novembre 2026): sorgenti con git e il gettone del lavoro, SDK con
# .gitea/scripts/dotnet.sh, buildx builder with costruisci-immagine.sh builder, test results and Trivy report in the # .gitea/scripts/dotnet.sh, builder buildx con costruisci-immagine.sh builder, risultati delle prove e rapporto di Trivy
# generic package febe-ci (version <versione>-rilascio.<numero>, with REGISTRY_TOKEN; artefatti.sh). # nel pacchetto generico febe-ci (versione <versione>-rilascio.<numero>, con REGISTRY_TOKEN; artefatti.sh).
# #
# Repository secret (Impostazioni ▸ Actions ▸ Segreti): REGISTRY_TOKEN, a user token with the permissions # Segreto del repository (Impostazioni ▸ Actions ▸ Segreti): REGISTRY_TOKEN, un token dell'utente con i permessi
# «package: read and write». Without it, the image is built and tested but not published: the release comes out # «package: read and write». Senza, l'immagine si costruisce e si prova ma non si pubblica: la release esce lo stesso,
# anyway, with the Windows installer, and its notes say the image of this version is missing. Once the secret is # con l'installatore per Windows, e le sue note dicono che l'immagine di questa versione non c'è. Aggiunto il segreto,
# added, the tag's workflow is run again: the image is published and the release notes are corrected. # si rilancia il flusso del tag: l'immagine si pubblica e le note della release si correggono.
# Optional variable (Impostazioni ▸ Actions ▸ Variabili): REGISTRY, the registry name as the runner reaches it (for # Variabile facoltativa (Impostazioni ▸ Actions ▸ Variabili): REGISTRY, il nome del registro come lo raggiunge il
# example 192.168.30.23:3000); if missing, the host of the Gitea server address (its ROOT_URL) is used. # runner (per esempio 192.168.30.23:3000); se manca si usa l'host dell'indirizzo del server Gitea (il suo ROOT_URL).
# The registry answers in HTTP: publishing goes through buildx with a builder of its own (docker-container) whose # Il registro risponde in HTTP: la pubblicazione passa da buildx con un builder proprio (docker-container) a cui la
# buildkit configuration says that registry is HTTP and insecure, so the runner's Docker does not need it among its # configurazione di buildkit dice che quel registro è in HTTP e insicuro, così non serve che il Docker del runner lo
# insecure-registries. The credentials go into the Docker client configuration, without «docker login» (which would # abbia fra gli insecure-registries. Le credenziali vanno nella configurazione del client Docker, senza «docker login»
# go through the daemon, and the daemon would try HTTPS). # (che passerebbe dal demone, e il demone proverebbe HTTPS).
name: rilascio name: rilascio
on: on:
push: push:
tags: ["v*"] tags: ["v*"]
# Like the verification and the cleanup: every step with «bash -e -o pipefail», whatever the default shell of the # Come la verifica e la pulizia: ogni passo con «bash -e -o pipefail», qualunque sia la shell predefinita del runner
# runner or of the container (the Sorgenti step uses bash arrays; in a Debian container the default would be dash). # o del contenitore (i Sorgenti usano gli array di bash; in un contenitore Debian la predefinita sarebbe dash).
defaults: defaults:
run: run:
shell: bash shell: bash
@@ -51,9 +51,9 @@ jobs:
prove: prove:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 60 timeout-minutes: 60
# The same environment as the verification tests: Debian 13 with real Chromium and Xvfb and the summary that # Lo stesso ambiente delle prove della verifica: Debian 13 con Chromium e Xvfb veri e il riepilogo che non
# allows no skipped tests. On ubuntu-latest the browser tests (among them the return after sign-in, # ammette prove saltate. Su ubuntu-latest le prove nel browser (fra cui il ritorno dopo l'accesso, return-path.js)
# return-path.js) would be inconclusive and a release would come out without having run them. # sarebbero inconcludenti e un rilascio uscirebbe senza averle fatte.
container: container:
image: debian:trixie image: debian:trixie
options: --shm-size=1g options: --shm-size=1g
@@ -108,7 +108,7 @@ jobs:
dotnet test tests/Febe.Tests -c Release --no-build --nologo dotnet test tests/Febe.Tests -c Release --no-build --nologo
--logger "trx;LogFileName=prove.trx" --results-directory out/prove --logger "trx;LogFileName=prove.trx" --results-directory out/prove
# No skipped test: an inconclusive test (for example without Chromium) stops the release. # Nessuna prova saltata: una prova inconcludente (per esempio senza Chromium) ferma il rilascio.
- name: Riepilogo delle prove - name: Riepilogo delle prove
if: ${{ !cancelled() }} if: ${{ !cancelled() }}
run: bash .gitea/scripts/riepilogo-prove.sh out/prove 0 run: bash .gitea/scripts/riepilogo-prove.sh out/prove 0
@@ -128,7 +128,7 @@ jobs:
needs: prove needs: prove
timeout-minutes: 30 timeout-minutes: 30
env: env:
# Like the installer job of verifica.yml: the runner image does not guarantee ICU, and it is not needed here. # Come l'installatore di verifica.yml: l'immagine del runner non garantisce ICU, e qui non serve.
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: "true" DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: "true"
steps: steps:
- name: Sorgenti - name: Sorgenti
@@ -163,7 +163,7 @@ jobs:
immagine: immagine:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# After the installer: :X.Y.Z and :latest come out only if the release can come out too. # Dopo l'installatore: :X.Y.Z e :latest escono solo se anche la release potrà uscire.
needs: [prove, windows] needs: [prove, windows]
timeout-minutes: 60 timeout-minutes: 60
env: env:
@@ -198,7 +198,7 @@ jobs:
git checkout -q --force --detach "$GITHUB_SHA" git checkout -q --force --detach "$GITHUB_SHA"
git log -1 --format='Commit %h: %s' git log -1 --format='Commit %h: %s'
# What an interrupted run could not remove, and an earlier attempt of this same run. # Ciò che un'esecuzione interrotta non ha potuto togliere, e un tentativo precedente di questa stessa esecuzione.
- name: Resti di esecuzioni interrotte - name: Resti di esecuzioni interrotte
run: | run: |
bash .gitea/scripts/pulizia-docker.sh residui 90 bash .gitea/scripts/pulizia-docker.sh residui 90
@@ -219,11 +219,11 @@ jobs:
echo "IMAGE=$REGISTRY/$OWNER/febe" >> "$GITHUB_ENV" echo "IMAGE=$REGISTRY/$OWNER/febe" >> "$GITHUB_ENV"
echo "immagine=$REGISTRY/$OWNER/febe" >> "$GITHUB_OUTPUT" echo "immagine=$REGISTRY/$OWNER/febe" >> "$GITHUB_OUTPUT"
# A buildx builder of our own, which knows that the home registry answers in HTTP. # Un builder buildx proprio, che sa che il registro di casa risponde in HTTP.
- name: Builder buildx dell'esecuzione - name: Builder buildx dell'esecuzione
run: bash .gitea/scripts/costruisci-immagine.sh builder "$REGISTRY" run: bash .gitea/scripts/costruisci-immagine.sh builder "$REGISTRY"
# The same arguments and labels as the publication (costruisci-immagine.sh): that one comes from this one's cache. # Gli stessi argomenti ed etichette della pubblicazione (costruisci-immagine.sh): quella esce dalla cache di questa.
- name: Costruzione dell'immagine (le prove girano dentro la build) - name: Costruzione dell'immagine (le prove girano dentro la build)
run: | run: |
bash .gitea/scripts/costruisci-immagine.sh archivio "$ARCHIVIO" "$PROVA" bash .gitea/scripts/costruisci-immagine.sh archivio "$ARCHIVIO" "$PROVA"
@@ -267,37 +267,37 @@ jobs:
REGISTRO_UTENTE: ${{ gitea.actor }} REGISTRO_UTENTE: ${{ gitea.actor }}
run: | run: |
set -eu set -eu
# costruisci-immagine.sh pubblica puts the credentials in a client configuration of its own, removed at the # Le credenziali le mette costruisci-immagine.sh pubblica in una configurazione del client solo sua, tolta
# end: buildx passes them to the builder, the daemon is not involved. # alla fine: buildx le passa al builder, il demone non c'entra.
NOMI="$IMAGE:$VERSION" NOMI="$IMAGE:$VERSION"
case "$VERSION" in case "$VERSION" in
*-*) echo "Versione di anteprima: :latest non si sposta." ;; *-*) echo "Versione di anteprima: :latest non si sposta." ;;
*) NOMI="$NOMI $IMAGE:latest" ;; *) NOMI="$NOMI $IMAGE:latest" ;;
esac esac
# The same build as before (from the builder's cache), this time pushed to the registry by buildx. # La stessa costruzione di prima (dalla cache del builder), questa volta spinta sul registro da buildx.
bash .gitea/scripts/costruisci-immagine.sh pubblica $NOMI bash .gitea/scripts/costruisci-immagine.sh pubblica $NOMI
echo "pubblicata=si" >> "$GITHUB_OUTPUT" echo "pubblicata=si" >> "$GITHUB_OUTPUT"
- name: Pulizia (sempre) - name: Pulizia (sempre)
if: always() if: always()
run: | run: |
# The client configuration with the credentials, if an interruption skipped the trap of whoever wrote it. # La configurazione del client con le credenziali, se un'interruzione ha saltato la trap di chi l'ha scritta.
rm -rf "${RUNNER_TEMP:-/tmp}/febe-docker-$ESECUZIONE" rm -rf "${RUNNER_TEMP:-/tmp}/febe-docker-$ESECUZIONE"
if [ -n "${ARCHIVIO:-}" ]; then rm -f "$ARCHIVIO"; fi if [ -n "${ARCHIVIO:-}" ]; then rm -f "$ARCHIVIO"; fi
bash .gitea/scripts/pulizia-docker.sh esecuzione "$ESECUZIONE" bash .gitea/scripts/pulizia-docker.sh esecuzione "$ESECUZIONE"
# Then, for all the daemon's projects, what nobody uses: unnamed images and dangling build cache unused for # Poi, per tutti i progetti del demone, ciò che nessuno usa: immagini senza nome e cache di costruzione
# 24 hours. It never fails the job. # penzolante non usata da 24 ore. Non fa mai fallire il lavoro.
bash .gitea/scripts/pulizia-docker.sh penzolanti || echo "::warning::La pulizia di ciò che nessuno usa non è riuscita." bash .gitea/scripts/pulizia-docker.sh penzolanti || echo "::warning::La pulizia di ciò che nessuno usa non è riuscita."
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# The tests are green, the installer is there and the image was built: published, or not published only because # Le prove sono verdi, l'installatore c'è e l'immagine si è costruita: pubblicata, o non pubblicata per la sola
# the secret is missing (the «immagine» job says so and the notes report it). If the build, the container test, # mancanza del segreto (il lavoro «immagine» lo dice e le note lo riportano). Se la costruzione, la prova del
# the scan or the push to the registry fail, no release comes out. # contenitore, la scansione o la spinta sul registro falliscono, non esce nessuna release.
needs: [prove, windows, immagine] needs: [prove, windows, immagine]
timeout-minutes: 40 timeout-minutes: 40
env: env:
# Like «windows»: the runner image does not guarantee ICU, and building the installer does not need it. # Come «windows»: l'immagine del runner non garantisce ICU, e per costruire l'installatore non serve.
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: "true" DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: "true"
steps: steps:
- name: Sorgenti - name: Sorgenti
@@ -324,7 +324,7 @@ jobs:
- name: SDK .NET 10 - name: SDK .NET 10
run: bash .gitea/scripts/dotnet.sh 10.0 run: bash .gitea/scripts/dotnet.sh 10.0
# The same commit and the same script as the «windows» job, which already acted as the gate before the image. # Lo stesso commit e lo stesso script del lavoro «windows», che ha già fatto da cancello prima dell'immagine.
- name: Febe.exe, programma di installazione e zip portabile per la release - name: Febe.exe, programma di installazione e zip portabile per la release
run: bash installer/costruisci.sh "${GITHUB_REF_NAME#v}" run: bash installer/costruisci.sh "${GITHUB_REF_NAME#v}"
@@ -339,7 +339,7 @@ jobs:
set -eu set -eu
TAG="${GITHUB_REF_NAME}" TAG="${GITHUB_REF_NAME}"
VERSION="${TAG#v}" VERSION="${TAG#v}"
case "$VERSION" in *-*|0.*) PRE=true ;; *) PRE=false ;; esac # 0.x versions are previews case "$VERSION" in *-*|0.*) PRE=true ;; *) PRE=false ;; esac # le versioni 0.x sono anteprime
NOTE=$(awk -v v="$VERSION" '/^## /{p=($2==v)} p' CHANGELOG.md || true) NOTE=$(awk -v v="$VERSION" '/^## /{p=($2==v)} p' CHANGELOG.md || true)
[ -n "$NOTE" ] || NOTE="Febe $VERSION" [ -n "$NOTE" ] || NOTE="Febe $VERSION"
if [ "$PUBBLICATA" = "si" ]; then if [ "$PUBBLICATA" = "si" ]; then
@@ -349,12 +349,12 @@ jobs:
esac esac
IMMAGINE_NOTA="Immagine Docker: $DOVE. Il registro risponde in HTTP: il Docker che la scarica deve averlo fra gli \`insecure-registries\`." IMMAGINE_NOTA="Immagine Docker: $DOVE. Il registro risponde in HTTP: il Docker che la scarica deve averlo fra gli \`insecure-registries\`."
else else
IMMAGINE_NOTA="**L'immagine Docker di questa versione non è stata pubblicata** (${MOTIVO:-motivo sconosciuto}): questo rilascio non aggiorna \`:latest\`, e Unraid e Docker Compose continuano a usare l'immagine che avevano già, se ce n'era una. Febe per Windows, qui allegato, è provato come sempre. Per pubblicare l'immagine, rilancia il flusso di rilascio di questo tag dopo aver risolto il problema: queste note si aggiornano." IMMAGINE_NOTA="**L'immagine Docker di questa versione non è stata pubblicata** (${MOTIVO:-motivo sconosciuto}): \`:latest\` resta sulla versione precedente, e Unraid e Docker Compose continuano a usare quella. Febe per Windows, qui allegato, è provato come sempre. Per pubblicare l'immagine, rilancia il flusso di rilascio di questo tag dopo aver risolto il problema: queste note si aggiornano."
fi fi
NOTE=$(printf '%s\n\n### Immagine Docker\n\n%s\n' "$NOTE" "$IMMAGINE_NOTA") NOTE=$(printf '%s\n\n### Immagine Docker\n\n%s\n' "$NOTE" "$IMMAGINE_NOTA")
# JSON read and written with .gitea/scripts/json.sh (awk), no jq. Gitea's responses go to a file: the reader # JSON letto e scritto con .gitea/scripts/json.sh (awk), niente jq. Le risposte di Gitea in un file: il
# reads files, not a stream. # lettore legge file, non un flusso.
RISPOSTA="${RUNNER_TEMP:-/tmp}/febe-release-${GITHUB_RUN_ID:-0}.json" RISPOSTA="${RUNNER_TEMP:-/tmp}/febe-release-${GITHUB_RUN_ID:-0}.json"
ID="" ID=""
if curl -sf -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG" -o "$RISPOSTA"; then if curl -sf -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG" -o "$RISPOSTA"; then
@@ -371,7 +371,7 @@ jobs:
echo "Release $TAG creata (id $ID)" echo "Release $TAG creata (id $ID)"
else else
[[ "$ID" =~ ^[0-9]+$ ]] || { echo "Identificativo della release inatteso: «$ID»." >&2; exit 1; } [[ "$ID" =~ ^[0-9]+$ ]] || { echo "Identificativo della release inatteso: «$ID»." >&2; exit 1; }
# The notes say how it went this time (for example: the image is now published). # Le note dicono come è andata questa volta (per esempio: l'immagine ora è pubblicata).
printf '{"body":%s}' "$(bash .gitea/scripts/json.sh stringa "$NOTE")" \ printf '{"body":%s}' "$(bash .gitea/scripts/json.sh stringa "$NOTE")" \
| curl -sf -X PATCH -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \ | curl -sf -X PATCH -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
--data-binary @- "$API/releases/$ID" > /dev/null --data-binary @- "$API/releases/$ID" > /dev/null
@@ -379,7 +379,7 @@ jobs:
fi fi
cp docker/unraid/febe.xml "out/febe-unraid-$VERSION.xml" cp docker/unraid/febe.xml "out/febe-unraid-$VERSION.xml"
# compose.yml points to the seccomp profile with a relative path: the archive carries them together. # compose.yml indica il profilo seccomp con un percorso relativo: l'archivio li porta insieme.
COMPOSE="out/febe-compose-$VERSION" COMPOSE="out/febe-compose-$VERSION"
rm -rf "$COMPOSE" rm -rf "$COMPOSE"
mkdir -p "$COMPOSE/chromium" mkdir -p "$COMPOSE/chromium"
+57 -56
View File
@@ -1,34 +1,34 @@
# Verification: at every push on any branch (tags are taken by rilascio.yml) and by hand (Actions ▸ verifica ▸ Esegui). # Verifica: a ogni push su qualunque ramo (i tag li prende rilascio.yml) e a mano (Actions ▸ verifica ▸ Esegui).
# Its four jobs are the checks required to merge into main (docs/processo.md): # I suoi quattro lavori sono i controlli richiesti per unire in main (docs/processo.md):
# controlli script syntax, workflows in block YAML and without actions, conflict markers, version, projects of # controlli sintassi degli script, flussi in YAML a blocchi e senza azioni, segni di conflitto, versione,
# the solution, JSON; secrets in the whole history with gitleaks (version and hash pinned); # progetti della soluzione, JSON; segreti in tutta la storia con gitleaks (versione e impronta fissate);
# prove build of the whole solution with warnings as errors and all the tests of tests/Febe.Tests (never # prove compilazione di tutta la soluzione con gli avvisi come errori e tutte le prove di tests/Febe.Tests
# «dotnet test» on the whole solution: tests/Febe.Tests.Windows runs only on Windows) with real # (mai «dotnet test» sulla soluzione intera: tests/Febe.Tests.Windows gira solo su Windows) con
# Chromium and Xvfb in a Debian 13 container: no test may be skipped, except the «da fare» ones of # Chromium e Xvfb veri in un contenitore Debian 13: nessuna prova deve saltarsi, tranne le «da fare»
# H264ConformanceTests.FeaturesStillToDo (riepilogo-prove.sh counts them apart). # di H264ConformanceTests.FeaturesStillToDo (riepilogo-prove.sh le conta a parte).
# The synthetic world of the test site has seed 13 and, for the SitoDiProva category, also the seed of # Il mondo sintetico del sito di prova ha il seme 13 e, per la categoria SitoDiProva, anche il seme di
# this run, written in the log to reproduce a failure; # questa esecuzione, scritto nel registro per rifare un errore;
# installatore Febe-Setup-<versione>-ci.<numero>.exe (our own installer, src/Febe.Installer) and the portable zip; # installatore Febe-Setup-<versione>-ci.<numero>.exe (il programma di installazione nostro, src/Febe.Installer) e
# only the .NET SDK is needed; # lo zip portabile; serve solo il .NET SDK;
# immagine after the installer: the Docker image built with buildx, tested without network (start, health, # immagine dopo l'installatore: l'immagine Docker costruita con buildx, provata senza rete (parte, salute,
# Chromium, it_IT) and scanned with Trivy (it stops for a CRITICAL with a fix); only after a push on # Chromium, it_IT) e scansionata con Trivy (si ferma per una CRITICAL con correzione); solo dopo un push
# main it publishes it as :main and :sha-<7 characters> (:latest is left to the release). At the end, # su main la pubblica come :main e :sha-<7 caratteri> (:latest resta al rilascio). Alla fine, sempre,
# always, it removes this run's images, containers, cache and builder, then the unnamed images and the # toglie immagini, contenitori, cache e builder di questa esecuzione, poi le immagini senza nome e la
# dangling build cache unused for 24 hours of all the daemon's projects. # cache di costruzione penzolante non usata da 24 ore di tutti i progetti del demone.
# #
# No actions (decision of Alberto of 18 November 2026: no external components): every step is a command. The sources # Niente azioni (decisione di Alberto del 18 novembre 2026: niente componenti esterni): ogni passo è un comando. I
# arrive with git and the job token, the .NET SDK with .gitea/scripts/dotnet.sh (verified against the hash in # sorgenti arrivano con git e il gettone del lavoro, l'SDK .NET con .gitea/scripts/dotnet.sh (verificato con l'impronta
# Microsoft's metadata), the buildx builder with costruisci-immagine.sh builder. The artifacts (test results, # dei metadati di Microsoft), il builder buildx con costruisci-immagine.sh builder. Gli artefatti (risultati delle
# installer and zip, gitleaks and Trivy reports) go to Gitea's package registry, generic package febe-ci, version # prove, installatore e zip, rapporti di gitleaks e di Trivy) vanno nel registro dei pacchetti di Gitea, pacchetto
# <versione>-ci.<numero>, with REGISTRY_TOKEN (.gitea/scripts/artefatti.sh); the Monday cleanup removes those older # generico febe-ci, versione <versione>-ci.<numero>, con REGISTRY_TOKEN (.gitea/scripts/artefatti.sh); la pulizia del
# than 14 days. Without the secret a warning, and the job stays green. No step uses Node. # lunedì toglie quelli di più di 14 giorni. Senza il segreto un avviso, e il lavoro resta verde. Nessun passo usa Node.
# #
# No «pull_request»: in Gitea a pull request shows the status of its last commit, which the branch push has already # Niente «pull_request»: in Gitea una richiesta di unione mostra lo stato del suo ultimo commit, che il push del ramo
# verified; pull_request would redo everything on the same commit (refs/pull/N/head) on the only runner. # ha già verificato; pull_request rifarebbe tutto sullo stesso commit (refs/pull/N/head) sull'unico runner.
# Runner: act_runner with the ubuntu-latest label, one job at a time. The jobs talk to the server's Docker daemon, the # Runner: act_runner con l'etichetta ubuntu-latest, un lavoro alla volta. I lavori parlano con il demone Docker del
# same as Encelado, Mimante and the other projects: no mounts of the job folder into other containers (on the server # server, lo stesso di Encelado, Mimante e degli altri progetti: niente montaggi della cartella del lavoro in altri
# the paths are different); images travel as archives and build contexts. # contenitori (sul server i percorsi sono diversi); le immagini passano come archivi e contesti di costruzione.
# What of Gitea 28 is used and why: docs/decisioni.md (20 October and 18 November 2026) and docs/processo.md. # Che cosa di Gitea 28 si usa e perché: docs/decisioni.md (20 ottobre e 18 novembre 2026) e docs/processo.md.
name: verifica name: verifica
on: on:
@@ -44,10 +44,10 @@ on:
permissions: permissions:
contents: read contents: read
# On a branch the last push counts: the earlier run is cancelled. On main every commit has its own group, so every # Su un ramo conta l'ultimo push: l'esecuzione precedente si annulla. Su main ogni commit ha il suo gruppo, così ogni
# merge runs to the end and publishes its :sha-. The event is part of the group: a run by hand never cancels the one # unione arriva fino in fondo e pubblica la sua :sha-. L'evento fa parte del gruppo: un'esecuzione a mano non annulla
# of a push, which is the only one that writes the commit statuses required to merge (a cancelled job leaves the # mai quella di un push, che è l'unica a scrivere gli stati del commit richiesti per unire (un lavoro annullato lascia
# «failure» status, and workflow_dispatch writes none). # lo stato «failure», e workflow_dispatch non ne scrive).
concurrency: concurrency:
group: verifica-${{ gitea.event_name }}-${{ gitea.ref }}${{ gitea.ref == 'refs/heads/main' && format('-{0}', gitea.sha) || '' }} group: verifica-${{ gitea.event_name }}-${{ gitea.ref }}${{ gitea.ref == 'refs/heads/main' && format('-{0}', gitea.sha) || '' }}
cancel-in-progress: ${{ gitea.ref != 'refs/heads/main' }} cancel-in-progress: ${{ gitea.ref != 'refs/heads/main' }}
@@ -68,9 +68,9 @@ jobs:
env: env:
NUMERO: ${{ gitea.run_number }} NUMERO: ${{ gitea.run_number }}
steps: steps:
# The commit's sources with git and the job token, which is valid only while the job runs and does not stay in # I sorgenti del commit con git e il gettone del lavoro, che vale solo finché il lavoro gira e non resta nella
# the repository configuration. Here the whole history (PROFONDITA 0): gitleaks reads every commit the verified # configurazione del repository. Qui tutta la storia (PROFONDITA 0): gitleaks legge ogni commit da cui discende
# one descends from. The same step, letter for letter, opens every job (PipelineTests checks it). # quello verificato. Lo stesso passo, lettera per lettera, apre ogni lavoro (lo controlla PipelineTests).
- name: Sorgenti - name: Sorgenti
env: env:
TOKEN: ${{ gitea.token }} TOKEN: ${{ gitea.token }}
@@ -112,9 +112,9 @@ jobs:
needs: controlli needs: controlli
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 60 timeout-minutes: 60
# Debian 13, nothing else: the distribution's real Chromium, as in the Febe image (on Ubuntu it is a snap). Without # Debian 13, nient'altro: Chromium vero della distribuzione, come nell'immagine di Febe (su Ubuntu è uno snap). Senza
# actions Node is not needed: git and curl before the sources, the rest from ambiente-prove.sh, the SDK from # azioni non serve Node: git e curl prima dei sorgenti, il resto da ambiente-prove.sh, l'SDK da dotnet.sh.
# dotnet.sh. Shared memory larger than the default 64 MB: the interface tests use a Chromium without a window. # Memoria condivisa più ampia dei 64 MB predefiniti: le prove dell'interfaccia usano un Chromium senza finestra.
container: container:
image: debian:trixie image: debian:trixie
options: --shm-size=1g options: --shm-size=1g
@@ -151,7 +151,7 @@ jobs:
git checkout -q --force --detach "$GITHUB_SHA" git checkout -q --force --detach "$GITHUB_SHA"
git log -1 --format='Commit %h: %s' git log -1 --format='Commit %h: %s'
# Before everything else, so that a wrong seed asked by hand stops the job at once. # Prima di tutto il resto, così un seme chiesto a mano e sbagliato ferma subito il lavoro.
- name: Semi del mondo sintetico - name: Semi del mondo sintetico
id: semi id: semi
run: | run: |
@@ -209,8 +209,8 @@ jobs:
timeout-minutes: 30 timeout-minutes: 30
env: env:
NUMERO: ${{ gitea.run_number }} NUMERO: ${{ gitea.run_number }}
# This job runs on the runner image, which does not guarantee ICU: publishing and packaging do not need it, so # Questo lavoro gira sull'immagine del runner, che non garantisce ICU: pubblicare e impacchettare non ne hanno
# .NET goes into invariant globalization instead of stopping («Couldn't find a valid ICU package»). # bisogno, quindi .NET va in globalizzazione invariante invece di fermarsi («Couldn't find a valid ICU package»).
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: "true" DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: "true"
steps: steps:
- name: Sorgenti - name: Sorgenti
@@ -254,8 +254,8 @@ jobs:
((${#artefatti[@]} == 2)) || { echo "Servono il programma di installazione e lo zip portabile, non: ${artefatti[*]:-niente}." >&2; exit 1; } ((${#artefatti[@]} == 2)) || { echo "Servono il programma di installazione e lo zip portabile, non: ${artefatti[*]:-niente}." >&2; exit 1; }
bash .gitea/scripts/artefatti.sh verifica "${artefatti[@]}" bash .gitea/scripts/artefatti.sh verifica "${artefatti[@]}"
# After the installer, not only after the tests: :main and :sha- come only from a commit with the whole verification # Dopo l'installatore, non solo dopo le prove: :main e :sha- escono solo da un commit con tutta la verifica verde.
# green. On the only runner the jobs go one at a time anyway, so the duration does not change. # Sull'unico runner i lavori vanno comunque uno alla volta, quindi la durata non cambia.
immagine: immagine:
needs: [prove, installatore] needs: [prove, installatore]
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -288,13 +288,14 @@ jobs:
git checkout -q --force --detach "$GITHUB_SHA" git checkout -q --force --detach "$GITHUB_SHA"
git log -1 --format='Commit %h: %s' git log -1 --format='Commit %h: %s'
# What an interrupted run (cancelled, timed out) could not remove, and an earlier attempt of this same run. # Ciò che un'esecuzione interrotta (annullata, scaduta) non ha potuto togliere, e un tentativo precedente di
# questa stessa esecuzione.
- name: Resti di esecuzioni interrotte - name: Resti di esecuzioni interrotte
run: | run: |
bash .gitea/scripts/pulizia-docker.sh residui 90 bash .gitea/scripts/pulizia-docker.sh residui 90
bash .gitea/scripts/pulizia-docker.sh esecuzione "$ESECUZIONE" bash .gitea/scripts/pulizia-docker.sh esecuzione "$ESECUZIONE"
# Registry: the REGISTRY variable of the Actions, if set, otherwise the host of the server address (ROOT_URL). # Registro: la variabile REGISTRY delle Actions, se c'è, altrimenti l'host dell'indirizzo del server (ROOT_URL).
- name: Versione, registro e nomi - name: Versione, registro e nomi
env: env:
REGISTRO_SCELTO: ${{ vars.REGISTRY }} REGISTRO_SCELTO: ${{ vars.REGISTRY }}
@@ -314,7 +315,7 @@ jobs:
} >> "$GITHUB_ENV" } >> "$GITHUB_ENV"
echo "Immagine $V-ci.$NUMERO del commit ${GITHUB_SHA::12}, provata come $PROVA; registro $REGISTRY/$OWNER/febe" echo "Immagine $V-ci.$NUMERO del commit ${GITHUB_SHA::12}, provata come $PROVA; registro $REGISTRY/$OWNER/febe"
# A buildx builder of this run (with its cache), which knows that the home registry answers in HTTP. # Un builder buildx di questa esecuzione (con la sua cache), che sa che il registro di casa risponde in HTTP.
- name: Builder buildx dell'esecuzione - name: Builder buildx dell'esecuzione
run: bash .gitea/scripts/costruisci-immagine.sh builder "$REGISTRY" run: bash .gitea/scripts/costruisci-immagine.sh builder "$REGISTRY"
@@ -363,13 +364,13 @@ jobs:
REGISTRO_UTENTE: ${{ gitea.actor }} REGISTRO_UTENTE: ${{ gitea.actor }}
GITEA_TOKEN: ${{ gitea.token }} GITEA_TOKEN: ${{ gitea.token }}
run: | run: |
# costruisci-immagine.sh pubblica puts the credentials in a client configuration of its own, removed at the # Le credenziali le mette costruisci-immagine.sh pubblica in una configurazione del client solo sua, tolta
# end: buildx passes them to the builder, the daemon is not involved (and would try HTTPS). Never printed. # alla fine: buildx le passa al builder, il demone non c'entra (e proverebbe HTTPS). Non si stampano mai.
NOMI=("$IMAGE:sha-${GITHUB_SHA::7}") NOMI=("$IMAGE:sha-${GITHUB_SHA::7}")
# :main only if main is still at this commit: a run that arrives late does not move it back. # :main solo se main è ancora a questo commit: un'esecuzione arrivata in ritardo non lo riporta indietro.
# The job token only in git's environment, as for the sources. The step runs with «bash -e -o # Il gettone del lavoro solo nell'ambiente di git, come per i sorgenti. Il passo gira con «bash -e -o
# pipefail»: without «|| CIMA=""» an ls-remote error would end the step before the warning, and not even # pipefail»: senza «|| CIMA=""» un errore di ls-remote chiuderebbe il passo prima dell'avviso, e non
# the :sha- would come out. # uscirebbe nemmeno la :sha-.
INTESTAZIONE="Authorization: basic $(printf 'x-access-token:%s' "$GITEA_TOKEN" | base64 -w0)" INTESTAZIONE="Authorization: basic $(printf 'x-access-token:%s' "$GITEA_TOKEN" | base64 -w0)"
CIMA=$(GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=http.extraHeader GIT_CONFIG_VALUE_0="$INTESTAZIONE" \ CIMA=$(GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=http.extraHeader GIT_CONFIG_VALUE_0="$INTESTAZIONE" \
git ls-remote origin refs/heads/main 2> /dev/null | cut -f1) || CIMA="" git ls-remote origin refs/heads/main 2> /dev/null | cut -f1) || CIMA=""
@@ -385,10 +386,10 @@ jobs:
- name: Pulizia (sempre) - name: Pulizia (sempre)
if: always() if: always()
run: | run: |
# The client configuration with the credentials, if an interruption skipped the trap of whoever wrote it. # La configurazione del client con le credenziali, se un'interruzione ha saltato la trap di chi l'ha scritta.
rm -rf "${RUNNER_TEMP:-/tmp}/febe-docker-$ESECUZIONE" rm -rf "${RUNNER_TEMP:-/tmp}/febe-docker-$ESECUZIONE"
if [ -n "${ARCHIVIO:-}" ]; then rm -f "$ARCHIVIO"; fi if [ -n "${ARCHIVIO:-}" ]; then rm -f "$ARCHIVIO"; fi
bash .gitea/scripts/pulizia-docker.sh esecuzione "$ESECUZIONE" bash .gitea/scripts/pulizia-docker.sh esecuzione "$ESECUZIONE"
# Then, for all the daemon's projects, what nobody uses: unnamed images and dangling build cache unused for # Poi, per tutti i progetti del demone, ciò che nessuno usa: immagini senza nome e cache di costruzione
# 24 hours. It never fails the job. # penzolante non usata da 24 ore. Non fa mai fallire il lavoro.
bash .gitea/scripts/pulizia-docker.sh penzolanti || echo "::warning::La pulizia di ciò che nessuno usa non è riuscita." bash .gitea/scripts/pulizia-docker.sh penzolanti || echo "::warning::La pulizia di ciò che nessuno usa non è riuscita."
+24 -25
View File
@@ -1,24 +1,24 @@
#!/bin/sh #!/bin/sh
# Febe: container start (specification §11). # Febe: avvio del contenitore (specifica §11).
# #
# It does only three things and then hands over to the server: # Fa solo tre cose e poi cede il posto al server:
# 1. creates, if missing, the group PGID and the user PUID (on Unraid 99 and 100, «nobody:users»); # 1. crea, se mancano, il gruppo PGID e l'utente PUID (su Unraid 99 e 100, «nobody:users»);
# 2. makes /dati owned by that user (the first time, or if PUID/PGID changed) and has it prepare /dati/home; # 2. rende /dati di quell'utente (la prima volta, o se PUID/PGID sono cambiati) e gli fa preparare /dati/home;
# 3. execs the server with setpriv, as that user: the server starts and watches Xvfb and Chromium by itself. # 3. exec del server con setpriv, come quell'utente: il server avvia e sorveglia da sé Xvfb e Chromium.
# Always exec, never a child process: the server takes the place of this script as process 1 of the container # Sempre exec, mai un processo figlio: il server prende il posto di questo script come processo 1 del contenitore
# (no tini), receives SIGTERM from «docker stop» and, with the .NET runtime, reaps the orphaned processes. # (niente tini), riceve SIGTERM da «docker stop» e, con il runtime .NET, raccoglie i processi rimasti orfani.
# No watch loop here: that is the job of Febe.Server (no shell script acting as a supervisor). # Nessun ciclo di sorveglianza qui: è il lavoro di Febe.Server (niente script di shell che facciano da supervisore).
# /libreria is never changed recursively (it holds Alberto's photos); /importa is read only and is not touched; # /libreria non si cambia mai ricorsivamente (sono le foto di Alberto); /importa è in sola lettura e non si tocca;
# of /esporta (the external copies, specification §4.10) only the root is assigned, never recursively, and only if # di /esporta (le copie esterne, specifica §4.10) si assegna solo la radice, mai ricorsivamente, e solo se le copie
# the external copies are declared (FEBE_ESPORTA=1 or --esporta). # esterne sono dichiarate (FEBE_ESPORTA=1 o --esporta).
# If /dati cannot be fixed (network disk, permissions) it starts anyway: Febe explains the problem on its page, # Se /dati non si può sistemare (disco di rete, permessi) si parte lo stesso: è Febe a spiegare il problema nella sua
# instead of a container that restarts without saying why. # pagina, invece di un contenitore che si riavvia senza dire perché.
set -eu set -eu
PUID="${PUID:-99}" PUID="${PUID:-99}"
PGID="${PGID:-100}" PGID="${PGID:-100}"
# Already started as a normal user (docker run --user ...): nothing to change. # Già avviato come utente normale (docker run --user ...): niente da cambiare.
if [ "$(id -u)" != "0" ]; then if [ "$(id -u)" != "0" ]; then
exec "$@" exec "$@"
fi fi
@@ -36,13 +36,13 @@ if ! getent passwd "${PUID}" >/dev/null 2>&1; then
useradd -o -u "${PUID}" -g "${PGID}" -M -d /dati/home -s /usr/sbin/nologin febe useradd -o -u "${PUID}" -g "${PGID}" -M -d /dati/home -s /usr/sbin/nologin febe
fi fi
# /dati belongs to the PUID user, who can put anything in it, even symbolic links to files of the container: as root # /dati è dell'utente PUID, che dentro può mettere di tutto, anche collegamenti simbolici verso file del contenitore:
# nothing is written in there. The only thing done as root is the change of owner, recursive and without following # da root qui dentro non si scrive niente. L'unica cosa fatta da root è il cambio di proprietario, ricorsivo e senza
# links (-R without -H/-L: it changes the link, never what it points to). The rest is done by the user itself. # seguire i collegamenti (-R senza -H/-L: cambia il collegamento, mai ciò a cui punta). Il resto lo fa l'utente stesso.
if mkdir -p /dati 2>/dev/null; then if mkdir -p /dati 2>/dev/null; then
da_assegnare="" da_assegnare=""
[ "$(stat -c '%u:%g' /dati)" = "${PUID}:${PGID}" ] || da_assegnare=1 [ "$(stat -c '%u:%g' /dati)" = "${PUID}:${PGID}" ] || da_assegnare=1
# A /dati/home with another owner (an earlier start as root): only a real folder counts. # Una /dati/home di un altro proprietario (un avvio precedente come root): conta solo una cartella vera.
if [ -d /dati/home ] && [ ! -L /dati/home ] && [ "$(stat -c '%u:%g' /dati/home)" != "${PUID}:${PGID}" ]; then if [ -d /dati/home ] && [ ! -L /dati/home ] && [ "$(stat -c '%u:%g' /dati/home)" != "${PUID}:${PGID}" ]; then
da_assegnare=1 da_assegnare=1
fi fi
@@ -51,23 +51,22 @@ if mkdir -p /dati 2>/dev/null; then
chown -R "${PUID}:${PGID}" /dati 2>/dev/null || echo "Febe: non riesco ad assegnare /dati a ${PUID}:${PGID}." >&2 chown -R "${PUID}:${PGID}" /dati 2>/dev/null || echo "Febe: non riesco ad assegnare /dati a ${PUID}:${PGID}." >&2
fi fi
chmod 0750 /dati 2>/dev/null || true chmod 0750 /dati 2>/dev/null || true
# Chromium's HOME is created and locked by the user, with its own permissions. # La HOME di Chromium la crea e la chiude l'utente, con i suoi permessi.
setpriv --reuid="${PUID}" --regid="${PGID}" --init-groups sh -c 'mkdir -p /dati/home && chmod 0700 /dati/home' 2>/dev/null || true setpriv --reuid="${PUID}" --regid="${PGID}" --init-groups sh -c 'mkdir -p /dati/home && chmod 0700 /dati/home' 2>/dev/null || true
# The seccomp profile no longer lives in /dati: Docker reads it on the server when the container is created, and in # Il profilo seccomp non sta più in /dati: Docker lo legge sul server alla creazione del contenitore, e in /dati
# /dati the container's user could loosen it. It is kept outside the data volume (docs/docker.md, «Sandbox»). # l'utente del contenitore potrebbe allentarlo. Si tiene fuori dal volume dei dati (docs/docker.md, «Sandbox»).
if [ -e /dati/seccomp.json ] || [ -L /dati/seccomp.json ]; then if [ -e /dati/seccomp.json ] || [ -L /dati/seccomp.json ]; then
echo "Febe: /dati/seccomp.json non si aggiorna più. Se --security-opt seccomp= indica quel file, sposta il profilo fuori dalla cartella dei dati (su Unraid /mnt/user/appdata/febe-seccomp.json): vedi docs/docker.md, «Sandbox»." >&2 echo "Febe: /dati/seccomp.json non si aggiorna più. Se --security-opt seccomp= indica quel file, sposta il profilo fuori dalla cartella dei dati (su Unraid /mnt/user/appdata/febe-seccomp.json): vedi docs/docker.md, «Sandbox»." >&2
fi fi
fi fi
# A library folder just created by Docker belongs to root: only that folder, without recursion. # Una cartella della libreria appena creata da Docker appartiene a root: solo quella, senza ricorsione.
if [ -d /libreria ] && [ "$(stat -c '%u' /libreria)" = "0" ]; then if [ -d /libreria ] && [ "$(stat -c '%u' /libreria)" = "0" ]; then
chown "${PUID}:${PGID}" /libreria 2>/dev/null || true chown "${PUID}:${PGID}" /libreria 2>/dev/null || true
fi fi
# /esporta: only the root, never recursive, and only if the external copies are declared (SPECIFICA §4.10). Inside # /esporta: solo la radice, mai ricorsivo, e solo se le copie esterne sono dichiarate (SPECIFICA §4.10). Dentro ci
# there are Alberto's files copied by Febe or put there by him: they are never changed. Febe does not create /esporta # sono file di Alberto copiati da Febe o messi da lui: non si cambiano mai. Febe non crea /esporta se manca.
# if it is missing.
case "${FEBE_ESPORTA:-}" in 1|true|sì|si|yes) esporta=1 ;; *) esporta= ;; esac case "${FEBE_ESPORTA:-}" in 1|true|sì|si|yes) esporta=1 ;; *) esporta= ;; esac
case " $* " in *" --esporta "*) esporta=1 ;; esac case " $* " in *" --esporta "*) esporta=1 ;; esac
if [ -n "$esporta" ] && [ -d /esporta ] && [ "$(stat -c '%u' /esporta)" = "0" ]; then if [ -n "$esporta" ] && [ -d /esporta ] && [ "$(stat -c '%u' /esporta)" = "0" ]; then
-1
View File
@@ -657,4 +657,3 @@ Ogni scelta tecnica presa strada facendo, con data e motivo (specifica §15).
| 2026-11-28 | Seconda revisione della tappa E3, conversione della libreria: il lavoro ricorda il file che l'ha messo in pausa per spazio e quanto serve al suo convertito (riga, SHA-256 dell'originale, byte), e finché il disco non ha posto anche per quello la pausa vale prima di rileggere l'originale (hash, decodifica, rimuxaggio). Non si sottraggono i byte dell'originale in anticipo: un PNG grande che diventa un JPG piccolo resterebbe fermo senza motivo. Il ricordo è del processo: dopo un riavvio l'originale si rilegge una volta. | La pausa per spazio (D17) non deve rileggere lo stesso video di 2 GB a ogni risveglio quando lo spazio libero sta fra la soglia e la soglia più il file. | | 2026-11-28 | Seconda revisione della tappa E3, conversione della libreria: il lavoro ricorda il file che l'ha messo in pausa per spazio e quanto serve al suo convertito (riga, SHA-256 dell'originale, byte), e finché il disco non ha posto anche per quello la pausa vale prima di rileggere l'originale (hash, decodifica, rimuxaggio). Non si sottraggono i byte dell'originale in anticipo: un PNG grande che diventa un JPG piccolo resterebbe fermo senza motivo. Il ricordo è del processo: dopo un riavvio l'originale si rilegge una volta. | La pausa per spazio (D17) non deve rileggere lo stesso video di 2 GB a ogni risveglio quando lo spazio libero sta fra la soglia e la soglia più il file. |
| 2026-11-28 | Seconda revisione della tappa E3: un cambio dei formati della libreria si salva in una transazione sola con le chiavi «dal» e la coda svuotata del formato sostituito (`LibraryConversionQueue.SaveSettingsAsync`, `IMediaConversionStore.SaveSettingsAndDeleteQueuesAsync`); «Anche i N» dopo il salvataggio non dipende più dalla richiesta (`CancellationToken.None`). Il gancio della libreria legge formati e chiavi «dal» con una lettura sola. | Una scheda chiusa, un arresto o un file salvato in quel momento non devono vedere il formato nuovo senza la sua chiave «dal» (che metterebbe in coda tutto l'elemento) né lasciare «Non riuscito» del formato vecchio che «Riprova» non tocca più. | | 2026-11-28 | Seconda revisione della tappa E3: un cambio dei formati della libreria si salva in una transazione sola con le chiavi «dal» e la coda svuotata del formato sostituito (`LibraryConversionQueue.SaveSettingsAsync`, `IMediaConversionStore.SaveSettingsAndDeleteQueuesAsync`); «Anche i N» dopo il salvataggio non dipende più dalla richiesta (`CancellationToken.None`). Il gancio della libreria legge formati e chiavi «dal» con una lettura sola. | Una scheda chiusa, un arresto o un file salvato in quel momento non devono vedere il formato nuovo senza la sua chiave «dal» (che metterebbe in coda tutto l'elemento) né lasciare «Non riuscito» del formato vecchio che «Riprova» non tocca più. |
| 2026-11-28 | Seconda revisione della tappa E3, fotogrammi: i tempi di `WriteStall` dello zip passano da un `TimeProvider` della BCL (`FrameService.StallTime`, di serie quello di sistema); la prova del lettore lento usa un `TimeProvider` scritto nella prova che avanza solo quando il collegamento finto manda un pezzo. | La prova dipendeva da orologi veri con 250 ms di margine e poteva cadere su un esecutore carico della CI; ora non dipende dal carico. Nessun pacchetto esterno. | | 2026-11-28 | Seconda revisione della tappa E3, fotogrammi: i tempi di `WriteStall` dello zip passano da un `TimeProvider` della BCL (`FrameService.StallTime`, di serie quello di sistema); la prova del lettore lento usa un `TimeProvider` scritto nella prova che avanza solo quando il collegamento finto manda un pezzo. | La prova dipendeva da orologi veri con 250 ms di margine e poteva cadere su un esecutore carico della CI; ora non dipende dal carico. Nessun pacchetto esterno. |
| 2026-11-29 | Commenti in inglese anche negli script di shell di `.gitea/scripts/` e `installer/`, nei blocchi `run:` dei flussi di `.gitea/workflows/` e in `docker/entrypoint.sh`; restano in italiano i messaggi che una persona legge (`echo`, `::warning::`/`::error::`, nomi dei passi, note della release, istruzioni d'uso), come nel resto del codice. Decisione di Alberto (#43) | La regola «codice e commenti in inglese; interfaccia, documenti e messaggi in italiano» vale per tutto il repository, script compresi: nessuna eccezione per la CI |
+5 -1
View File
@@ -735,7 +735,9 @@ protezione di `main` sono in `docs/processo.md`.
8. Da decidere: 8. Da decidere:
- dopo ogni esecuzione la cache di costruzione si toglie solo se nessuno la usa da 24 ore (`--filter until=24h`). - dopo ogni esecuzione la cache di costruzione si toglie solo se nessuno la usa da 24 ore (`--filter until=24h`).
Senza filtro, a ogni push se ne andrebbe anche quella appena usata dagli altri progetti; per cambiare basta togliere Senza filtro, a ogni push se ne andrebbe anche quella appena usata dagli altri progetti; per cambiare basta togliere
il filtro in `pulizia-docker.sh penzolanti`. il filtro in `pulizia-docker.sh penzolanti`;
- gli script di shell di `.gitea/` e `installer/` hanno i commenti in italiano, contro «codice e commenti in
inglese»: o un'eccezione in `docs/decisioni.md`, o una traduzione in un ramo a parte.
## Rilievi aperti (20 ottobre) ## Rilievi aperti (20 ottobre)
@@ -768,6 +770,8 @@ protezione di `main` sono in `docs/processo.md`.
## Rilievi aperti (21 ottobre) ## Rilievi aperti (21 ottobre)
- Le note della release scritte da `rilascio.yml` senza immagine dicono «`:latest` resta sulla versione precedente», ma
sul registro un'immagine precedente non c'è mai stata. Da riformulare per il caso della prima pubblicazione.
- Un solo timeout di `OpenAsync` all'apertura di `/browser` (`AfterHoFinitoLeavingTheBrowserPageChangesNothingMore`) in - Un solo timeout di `OpenAsync` all'apertura di `/browser` (`AfterHoFinitoLeavingTheBrowserPageChangesNothingMore`) in
migliaia di esecuzioni delle prove d'interfaccia, senza causa trovata. Se ricompare nella CI, va fatto dire a migliaia di esecuzioni delle prove d'interfaccia, senza causa trovata. Se ricompare nella CI, va fatto dire a
`OpenAsync` quale condizione mancava. `OpenAsync` quale condizione mancava.
+11 -11
View File
@@ -1,16 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Febe for Windows: publishes Febe.exe as a single file and makes the installer and the portable zip from it. # Febe per Windows: pubblica Febe.exe in un file solo e ne fa il programma di installazione e lo zip portabile.
# #
# installer/costruisci.sh [versione] # installer/costruisci.sh [versione]
# #
# Runs on Linux (CI and release) as on Windows with bash: only the .NET SDK 10 is needed. No other program: the # Gira su Linux (CI e rilascio) come su Windows con bash: serve solo il .NET SDK 10. Nessun altro programma: il
# installer is our own (src/Febe.Installer) and the same project, built for the system that builds it, makes the # programma di installazione è nostro (src/Febe.Installer) e lo stesso progetto, compilato per il sistema che lo
# package, checks it and writes the zip. The version, if not given, is the one in Directory.Build.props (the tag must # costruisce, fa il pacchetto, lo controlla e scrive lo zip. La versione, se non la si passa, è quella di
# match). # Directory.Build.props (il tag deve coincidere).
# Result in out/: # Risultato in out/:
# Febe-Setup-<versione>.exe per-user installation, without administrator rights # Febe-Setup-<versione>.exe installazione per l'utente, senza permessi di amministratore
# Febe-<versione>-portabile.zip Febe.exe and LEGGIMI.txt, to copy wherever you like # Febe-<versione>-portabile.zip Febe.exe e LEGGIMI.txt, da copiare dove si vuole
# Each must stay under 100 MB (the Gitea attachment limit). # Ognuno deve restare sotto i 100 MB (limite degli allegati di Gitea).
set -euo pipefail set -euo pipefail
radice="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" radice="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
@@ -36,7 +36,7 @@ dotnet publish src/Febe.Desktop/Febe.Desktop.csproj -c Release -r win-x64 --self
-p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:EnableCompressionInSingleFile=true \ -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:EnableCompressionInSingleFile=true \
-p:Version="$versione" -nologo -o "$pubblicazione" -p:Version="$versione" -nologo -o "$pubblicazione"
# A single file: nothing next to the executable. # Un file solo: niente accanto all'eseguibile.
solo_un_file() { solo_un_file() {
local cartella="$1" nome="$2" altri local cartella="$1" nome="$2" altri
altri="$(find "$cartella" -mindepth 1 ! -name "$nome")" altri="$(find "$cartella" -mindepth 1 ! -name "$nome")"
@@ -49,7 +49,7 @@ solo_un_file() {
solo_un_file "$pubblicazione" Febe.exe solo_un_file "$pubblicazione" Febe.exe
echo "== Programma di installazione (win-x64, un file solo, ridotto)" echo "== Programma di installazione (win-x64, un file solo, ridotto)"
# The publish properties (self-contained, single file, trimming, compression) are in the project. # Le proprietà della pubblicazione (autosufficiente, un file solo, trimming, compressione) sono nel progetto.
dotnet publish src/Febe.Installer/Febe.Installer.csproj -c Release -r win-x64 \ dotnet publish src/Febe.Installer/Febe.Installer.csproj -c Release -r win-x64 \
-p:Version="$versione" -nologo -o "$installatore" -p:Version="$versione" -nologo -o "$installatore"
solo_un_file "$installatore" Febe.Installer.exe solo_un_file "$installatore" Febe.Installer.exe
+76 -6
View File
@@ -189,6 +189,17 @@ public sealed class BrowserConnectionService : IConnectionService, IAsyncDisposa
/// </summary> /// </summary>
public TimeSpan PageTurnWait { get; set; } = TimeSpan.FromSeconds(15); public TimeSpan PageTurnWait { get; set; } = TimeSpan.FromSeconds(15);
/// <summary>
/// How long Alberto's first navigation waits, at most, for the browser to say which page it shows when it does not
/// answer (real time): right after «Scollega» it has just restarted with an empty profile and may not answer yet.
/// After it the page counts as the rest page, and the start page opens (issue #67, decision of 29 November 2026):
/// never a white window (issue #52). Read at every wait; tests shorten it.
/// </summary>
public TimeSpan AddressWait { get; set; } = TimeSpan.FromSeconds(10);
/// <summary>How often the wait of <see cref="AddressWait"/> asks the browser again.</summary>
private static readonly TimeSpan AddressPoll = TimeSpan.FromMilliseconds(200);
/// <summary>The engine, once it exists (it is built after the browser).</summary> /// <summary>The engine, once it exists (it is built after the browser).</summary>
public void AttachEngine(EngineHost engine) => _engine = engine ?? throw new ArgumentNullException(nameof(engine)); public void AttachEngine(EngineHost engine) => _engine = engine ?? throw new ArgumentNullException(nameof(engine));
@@ -1083,14 +1094,23 @@ public sealed class BrowserConnectionService : IConnectionService, IAsyncDisposa
/// <summary> /// <summary>
/// Alberto's own first navigation (rule 7: not an engine action, no Governor), under his lease: the login page when /// Alberto's own first navigation (rule 7: not an engine action, no Governor), under his lease: the login page when
/// asked for, and the start page when the browser rests on the empty page (issue #52). Any other page stays as it is /// asked for, and the start page when the browser rests on the empty page (issue #52). Any other page stays as it is
/// — the one he was using, or the verification page of a stop. /// — the one he was using, or the verification page of a stop. A browser that does not say its page is waited for,
/// up to <see cref="AddressWait"/>; still silent, its page counts as the rest page (issue #67).
/// </summary> /// </summary>
private async Task OpenForAlbertoAsync(bool openLogin, CancellationToken ct) private async Task OpenForAlbertoAsync(bool openLogin, CancellationToken ct)
{ {
if (!openLogin && !IsRest(await FullUrlAsync(ct).ConfigureAwait(false))) // A known address that is not the rest page is a page Alberto uses: never touched. An unknown one (the browser
// still silent after the wait) is the rest page.
var answered = true;
if (!openLogin)
{ {
_log.Info("collegamento", "Alberto usa il browser."); var first = await AwaitFullUrlAsync(ct).ConfigureAwait(false);
return; answered = first is not null;
if (answered && !IsRest(first))
{
_log.Info("collegamento", "Alberto usa il browser.");
return;
}
} }
// The engine ends its session when the lease starts; wait for it before taking the page. A search step in // The engine ends its session when the lease starts; wait for it before taking the page. A search step in
@@ -1104,7 +1124,7 @@ public sealed class BrowserConnectionService : IConnectionService, IAsyncDisposa
target = _loginUrl; target = _loginUrl;
what = "pagina di accesso"; what = "pagina di accesso";
} }
else if (IsRest(await FullUrlAsync(ct).ConfigureAwait(false))) else if (await IsAtRestAsync(wait: answered, ct).ConfigureAwait(false))
{ {
target = StartPageUrl; target = StartPageUrl;
what = target == _loginUrl ? "era a riposo, pagina di accesso" : "era a riposo, pagina iniziale del sito"; what = target == _loginUrl ? "era a riposo, pagina di accesso" : "era a riposo, pagina iniziale del sito";
@@ -1116,7 +1136,19 @@ public sealed class BrowserConnectionService : IConnectionService, IAsyncDisposa
return; return;
} }
var result = await _browser.Cdp.NavigateAsync(target, ct).ConfigureAwait(false); // A browser still silent (restarting after «Scollega», issue #67) usually refuses the navigation too: the window
// comes to the front all the same, as when its page was unknown before, never an internal error.
NavigationResult result;
try
{
result = await _browser.Cdp.NavigateAsync(target, ct).ConfigureAwait(false);
}
catch (Exception ex) when (ex is CdpDisconnectedException or BrowserUnavailableException or CdpCommandException or TimeoutException)
{
_log.Info("collegamento", $"Alberto usa il browser: {what} non aperta (il browser non risponde).");
return;
}
_log.Info("collegamento", result.Succeeded _log.Info("collegamento", result.Succeeded
? $"Alberto usa il browser: {what} aperta." ? $"Alberto usa il browser: {what} aperta."
: $"Alberto usa il browser: {what} non aperta (errore di rete del browser)."); : $"Alberto usa il browser: {what} non aperta (errore di rete del browser).");
@@ -1267,6 +1299,44 @@ public sealed class BrowserConnectionService : IConnectionService, IAsyncDisposa
} }
} }
/// <summary>
/// The address of the main frame as <see cref="FullUrlAsync"/> gives it, but a browser that does not answer is asked
/// again every <see cref="AddressPoll"/> until it does, for at most <see cref="AddressWait"/> (real time, issue #67);
/// null when it stayed silent. Cancelled with <paramref name="ct"/>.
/// </summary>
private async Task<string?> AwaitFullUrlAsync(CancellationToken ct)
{
using var limit = CancellationTokenSource.CreateLinkedTokenSource(ct);
limit.CancelAfter(AddressWait);
try
{
while (true)
{
if (await FullUrlAsync(limit.Token).ConfigureAwait(false) is { } url)
{
return url;
}
await _clock.Delay(AddressPoll, limit.Token).ConfigureAwait(false);
}
}
catch (OperationCanceledException) when (!ct.IsCancellationRequested)
{
_log.Info("collegamento", "Il browser non ha indicato la pagina in tempo: la pagina conta come quella di riposo.");
return null;
}
}
/// <summary>
/// After the engine's session ended: whether the page is the rest page (or still unknown). A browser that already let
/// <see cref="AddressWait"/> pass is asked once more (<paramref name="wait"/> false), not waited for again.
/// </summary>
private async Task<bool> IsAtRestAsync(bool wait, CancellationToken ct)
{
var url = wait ? await AwaitFullUrlAsync(ct).ConfigureAwait(false) : await FullUrlAsync(ct).ConfigureAwait(false);
return url is null || IsRest(url);
}
private async Task WaitForSessionEndAsync(CancellationToken ct) private async Task WaitForSessionEndAsync(CancellationToken ct)
{ {
if (_engine is not { } engine) if (_engine is not { } engine)
@@ -54,6 +54,128 @@ public sealed class BrowserStartPageTests
Assert.IsTrue(status.GetProperty("userIsDriving").GetBoolean()); Assert.IsTrue(status.GetProperty("userIsDriving").GetBoolean());
} }
[TestMethod]
[Timeout(60_000, CooperativeCancellation = true)]
public async Task ABrowserThatDoesNotAnswerYetIsWaitedForAndThenOpensTheLogin()
{
var ct = TestContext.CancellationToken;
await using var bed = await DesktopTestBed.StartAsync();
await bed.App.Running.WaitAsync(TimeSpan.FromSeconds(20), ct);
var browser = bed.Browser!;
// Just restarted (after «Scollega», issue #67): the browser does not say its page yet. Febe asks again and waits.
browser.FakeCdp.Silent = true;
var asked = browser.FakeCdp.SilentAnswers;
var begin = BeginAsync(bed, openLogin: false);
await DesktopTestBed.WaitUntilAsync(() => browser.FakeCdp.SilentAnswers >= asked + 3, TimeSpan.FromSeconds(5), "le domande ripetute al browser che non risponde");
Assert.IsFalse(begin.IsCompleted, "still waiting for the browser");
Assert.DoesNotContain(Login, browser.FakeCdp.Visited);
// It answers, on the empty rest page: the login page, never a white window (issue #52).
browser.FakeCdp.Silent = false;
await begin.WaitAsync(TimeSpan.FromSeconds(10), ct);
Assert.AreEqual(Login, browser.FakeCdp.Url);
}
[TestMethod]
[Timeout(60_000, CooperativeCancellation = true)]
public async Task ABrowserSilentBeyondTheWaitCountsAsAtRestAndOpensTheLogin()
{
var ct = TestContext.CancellationToken;
await using var bed = await DesktopTestBed.StartAsync();
await bed.App.Running.WaitAsync(TimeSpan.FromSeconds(20), ct);
var browser = bed.Browser!;
var connection = bed.App.Connection!;
connection.AddressWait = TimeSpan.FromMilliseconds(400);
browser.FakeCdp.Silent = true;
var watch = System.Diagnostics.Stopwatch.StartNew();
await BeginAsync(bed, openLogin: false);
watch.Stop();
Assert.IsGreaterThanOrEqualTo(TimeSpan.FromMilliseconds(350), watch.Elapsed, "it waited for the browser first");
Assert.AreEqual(Login, browser.FakeCdp.Url, "still silent: the rest page, and the login opens");
Assert.AreEqual(1, browser.FakeCdp.Visited.Count(v => v == Login));
}
[TestMethod]
[Timeout(60_000, CooperativeCancellation = true)]
public async Task ABrowserThatAnswersLateWithAPageOfAlbertosLeavesItAlone()
{
var ct = TestContext.CancellationToken;
await using var bed = await DesktopTestBed.StartAsync();
await bed.App.Running.WaitAsync(TimeSpan.FromSeconds(20), ct);
var browser = bed.Browser!;
await BeginAsync(bed, openLogin: false);
browser.FakeCdp.Navigated("https://www.instagram.com/marta.prova/");
var navigations = Navigations(browser);
browser.FakeCdp.Silent = true;
var asked = browser.FakeCdp.SilentAnswers;
var begin = BeginAsync(bed, openLogin: false);
await DesktopTestBed.WaitUntilAsync(() => browser.FakeCdp.SilentAnswers >= asked + 2, TimeSpan.FromSeconds(5), "le domande ripetute al browser che non risponde");
browser.FakeCdp.Silent = false;
await begin.WaitAsync(TimeSpan.FromSeconds(10), ct);
Assert.AreEqual("https://www.instagram.com/marta.prova/", browser.FakeCdp.Url);
Assert.AreEqual(navigations, Navigations(browser), "no navigation of his page");
}
[TestMethod]
[Timeout(60_000, CooperativeCancellation = true)]
public async Task TheWaitForASilentBrowserEndsWithTheRequest()
{
var ct = TestContext.CancellationToken;
await using var bed = await DesktopTestBed.StartAsync();
await bed.App.Running.WaitAsync(TimeSpan.FromSeconds(20), ct);
var browser = bed.Browser!;
var connection = bed.App.Connection!;
var navigations = Navigations(browser);
browser.FakeCdp.Silent = true;
var asked = browser.FakeCdp.SilentAnswers;
using var request = new CancellationTokenSource();
var begin = connection.BeginUserDrivingAsync(openLogin: false, request.Token);
await DesktopTestBed.WaitUntilAsync(() => browser.FakeCdp.SilentAnswers >= asked + 2, TimeSpan.FromSeconds(5), "le domande ripetute al browser che non risponde");
await request.CancelAsync();
await Assert.ThrowsAsync<OperationCanceledException>(() => begin.WaitAsync(TimeSpan.FromSeconds(10), ct));
Assert.AreEqual(navigations, Navigations(browser), "nothing opened after the request went away");
Assert.AreEqual("about:blank", browser.FakeCdp.Url);
// The commands of the connection are free again: the next request, with the browser answering, opens the login.
browser.FakeCdp.Silent = false;
await BeginAsync(bed, openLogin: false);
Assert.AreEqual(Login, browser.FakeCdp.Url);
}
[TestMethod]
[Timeout(60_000, CooperativeCancellation = true)]
public async Task ABrowserThatAnswersNothingStillComesToTheFrontWithoutAnError()
{
var ct = TestContext.CancellationToken;
await using var bed = await DesktopTestBed.StartAsync();
await bed.App.Running.WaitAsync(TimeSpan.FromSeconds(20), ct);
var browser = bed.Browser!;
bed.App.Connection!.AddressWait = TimeSpan.FromMilliseconds(300);
// Still restarting (issue #67): no page and no navigation either. The window comes all the same, never a 500.
browser.FakeCdp.Silent = true;
browser.FakeCdp.RefusesNavigation = true;
var shown = browser.Shown;
await BeginAsync(bed, openLogin: false);
Assert.AreEqual(shown + 1, browser.Shown, "«Usa il browser»: the window came to the front");
var result = await bed.JsonAsync(HttpMethod.Post, "/api/browser/show");
StringAssert.Contains(result.GetProperty("message").GetString(), "primo piano");
Assert.AreEqual(shown + 2, browser.Shown, "«Apri il browser»: the window came to the front");
Assert.AreEqual("about:blank", browser.FakeCdp.Url, "nothing could open");
Assert.DoesNotContain(Login, browser.FakeCdp.Visited);
browser.FakeCdp.Silent = false;
browser.FakeCdp.RefusesNavigation = false;
}
[TestMethod] [TestMethod]
[Timeout(60_000, CooperativeCancellation = true)] [Timeout(60_000, CooperativeCancellation = true)]
public async Task ApriIlBrowserBringsTheWindowWithItsStartPageAndTheLoginAfterADisconnection() public async Task ApriIlBrowserBringsTheWindowWithItsStartPageAndTheLoginAfterADisconnection()
@@ -263,6 +263,9 @@ internal sealed class FakeCdp : ICdpSession
private readonly Dictionary<string, List<Action<JsonElement>>> _handlers = new(StringComparer.Ordinal); private readonly Dictionary<string, List<Action<JsonElement>>> _handlers = new(StringComparer.Ordinal);
private int _captureReads; private int _captureReads;
private int _cookieReads; private int _cookieReads;
private bool _silent;
private int _silentAnswers;
private bool _refusesNavigation;
public bool LoggedIn { get; set; } public bool LoggedIn { get; set; }
@@ -313,6 +316,29 @@ internal sealed class FakeCdp : ICdpSession
public string Url { get; private set; } = "about:blank"; public string Url { get; private set; } = "about:blank";
/// <summary>
/// While true the page does not say where it is, like a browser that has just restarted and does not answer yet
/// (issue #67): <c>Page.getFrameTree</c> fails as a closed connection, and is counted in <see cref="SilentAnswers"/>.
/// </summary>
public bool Silent
{
get => Volatile.Read(ref _silent);
set => Volatile.Write(ref _silent, value);
}
/// <summary>How many times <c>Page.getFrameTree</c> was asked while <see cref="Silent"/>.</summary>
public int SilentAnswers => Volatile.Read(ref _silentAnswers);
/// <summary>
/// While true <c>Page.navigate</c> fails as a closed connection too, like a browser that has not finished restarting
/// (issue #67): with <see cref="Silent"/>, a browser that answers nothing at all.
/// </summary>
public bool RefusesNavigation
{
get => Volatile.Read(ref _refusesNavigation);
set => Volatile.Write(ref _refusesNavigation, value);
}
public ConcurrentQueue<string> Methods { get; } = new(); public ConcurrentQueue<string> Methods { get; } = new();
/// <summary>Every address a <c>Page.navigate</c> asked for, in order.</summary> /// <summary>Every address a <c>Page.navigate</c> asked for, in order.</summary>
@@ -329,6 +355,17 @@ internal sealed class FakeCdp : ICdpSession
{ {
CdpCommandPolicy.EnsureAllowed(method); CdpCommandPolicy.EnsureAllowed(method);
Methods.Enqueue(method); Methods.Enqueue(method);
if (method == "Page.getFrameTree" && Silent)
{
Interlocked.Increment(ref _silentAnswers);
return Task.FromException<JsonElement>(new CdpDisconnectedException());
}
if (method == "Page.navigate" && RefusesNavigation)
{
return Task.FromException<JsonElement>(new CdpDisconnectedException());
}
JsonNode result = method switch JsonNode result = method switch
{ {
"Page.getFrameTree" => new JsonObject { ["frameTree"] = new JsonObject { ["frame"] = new JsonObject { ["id"] = "F1", ["url"] = Url } } }, "Page.getFrameTree" => new JsonObject { ["frameTree"] = new JsonObject { ["frame"] = new JsonObject { ["id"] = "F1", ["url"] = Url } } },
@@ -169,10 +169,6 @@ public sealed partial class PackagingTests
StringAssert.Contains(image, "pubblicata: ${{ steps.pubblicazione.outputs.pubblicata }}"); StringAssert.Contains(image, "pubblicata: ${{ steps.pubblicazione.outputs.pubblicata }}");
StringAssert.Contains(release, "PUBBLICATA: ${{ needs.immagine.outputs.pubblicata }}"); StringAssert.Contains(release, "PUBBLICATA: ${{ needs.immagine.outputs.pubblicata }}");
StringAssert.Contains(release, "non è stata pubblicata"); StringAssert.Contains(release, "non è stata pubblicata");
// The first publication has no earlier image on the registry: the note without an image must not promise one.
var unpublished = release.Split('\n').Single(line => line.Contains("non è stata pubblicata"));
StringAssert.Contains(unpublished, "non aggiorna \\`:latest\\`");
Assert.DoesNotContain("versione precedente", unpublished, "the first publication has no earlier image");
// Without the secret the image is built and tested, and the job still succeeds: the release says so. // Without the secret the image is built and tested, and the job still succeeds: the release says so.
var secret = Step(image, "Segreto per il registro"); var secret = Step(image, "Segreto per il registro");