Merge pull request 'CI e installatore: commenti degli script in inglese (#43)' (#76) from ci/commenti-script-inglese into main
verifica / controlli (push) Successful in 22s
verifica / prove (push) Successful in 20m15s
verifica / installatore (push) Successful in 2m7s
verifica / immagine (push) Successful in 17m25s

This commit was merged in pull request #76.
This commit is contained in:
Alby96 committed 2026-11-29 15:57:28 +01:00
commit 81883dd7bc
21 files changed
+502 -502

No files matched your search

+5 -6
View File
@@ -1,10 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Prepara il contenitore Debian del lavoro «prove» (debian:trixie, Debian 13 senza nient'altro: nessuna azione # Prepares the Debian container of the «prove» job (debian:trixie, plain Debian 13: no JavaScript action, hence no
# JavaScript, quindi niente Node) perché nessuna prova si salti: Chromium vero della distribuzione (su Ubuntu è uno # Node) so that no test is skipped: the distribution's real Chromium (on Ubuntu it is a snap, which does not work in
# snap, che nei contenitori non va) con le sue lingue, Xvfb, la lingua it_IT.UTF-8, fusi orari e gli stessi caratteri # containers) with its languages, Xvfb, the it_IT.UTF-8 locale, time zones and the same fonts as the Febe image; ICU,
# dell'immagine di Febe; ICU, OpenSSL, zlib e libstdc++ per l'SDK .NET (dotnet.sh). git, curl e i certificati li # OpenSSL, zlib and libstdc++ for the .NET SDK (dotnet.sh). git, curl and the certificates are installed by the step
# installa il passo prima dei sorgenti. setpriv, getent e l'utente nobody (65534) vengono con Debian (prove # before the sources. setpriv, getent and the nobody user (65534) come with Debian (tests of the container start).
# 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
# Artefatti della CI, al posto di actions/upload-artifact (un'azione JavaScript, che vuole Node): i file vanno nel # CI artifacts, instead of actions/upload-artifact (a JavaScript action, which needs Node): the files go to the Gitea
# registro dei pacchetti di Gitea, pacchetto generico febe-ci, una versione per esecuzione: # package registry, generic package febe-ci, one version per run:
# #
# <versione>-ci.<numero> dal flusso verifica (come Febe-Setup-<versione>-ci.<numero>.exe) # <versione>-ci.<numero> from the verifica workflow (like Febe-Setup-<versione>-ci.<numero>.exe)
# <versione>-rilascio.<numero> dal flusso rilascio # <versione>-rilascio.<numero> from the rilascio workflow
# #
# con <versione> da Directory.Build.props e <numero> il numero dell'esecuzione (NUMERO). Si scaricano dalla pagina del # with <versione> from Directory.Build.props and <numero> the run number (NUMERO). They are downloaded from the package
# pacchetto su Gitea (proprietario ▸ Pacchetti ▸ febe-ci). La pulizia del lunedì (pulizia-docker.sh completa) toglie le # page on Gitea (owner ▸ Packages ▸ febe-ci). The Monday cleanup (full pulizia-docker.sh) removes the versions created
# versioni create più di 14 giorni prima, come faceva la scadenza degli artefatti. # more than 14 days earlier, as the artifact expiry used to do.
# #
# .gitea/scripts/artefatti.sh verifica|rilascio <file>... # .gitea/scripts/artefatti.sh verifica|rilascio <file>...
# #
# Variabili: REGISTRY_TOKEN (token con «package: read and write», solo nell'intestazione di curl, mai stampato), GITEA_URL # Variables: REGISTRY_TOKEN (token with «package: read and write», only in the curl header, never printed), GITEA_URL
# (l'indirizzo del server, gitea.server_url), PROPRIETARIO, NUMERO. Senza REGISTRY_TOKEN un avviso e nessun file # (the server address, gitea.server_url), PROPRIETARIO, NUMERO. Without REGISTRY_TOKEN a warning and no file uploaded:
# caricato: il lavoro resta verde, come per l'immagine. Un file che manca o un rifiuto del registro fanno fallire il # the job stays green, as for the image. A missing file or a refusal by the registry fails the step. A file with the
# passo. Un file con lo stesso nome già caricato (un nuovo tentativo della stessa esecuzione) si sostituisce. # same name already uploaded (a new attempt of the same run) is replaced.
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"
# Una chiamata al registro: il codice HTTP, 000 se Gitea non risponde. Il token sta solo nell'intestazione di curl. # One call to the registry: the HTTP code, 000 if Gitea does not answer. The token is only in the curl header.
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
# Controlli veloci prima di compilare (lavoro «controlli» della CI): pochi secondi, e fermano subito gli errori che # Quick checks before building (the «controlli» job of the CI): a few seconds, and they stop at once the errors that
# altrimenti si scoprirebbero dopo mezz'ora di prove. Si lanciano anche a mano, dalla radice del repository: # would otherwise be found after half an hour of tests. They can also be run by hand, from the repository root:
# #
# bash .gitea/scripts/controlli.sh # bash .gitea/scripts/controlli.sh
# #
# 1. ogni script di shell del repository è sintassi valida (bash -n; sh -n per quelli in sh) e ha le righe Unix, come # 1. every shell script of the repository is valid syntax (bash -n; sh -n for the sh ones) and has Unix line
# i programmi awk della CI; # endings, like the awk programs of the CI;
# 2. i flussi della CI si leggono come YAML a blocchi: niente tabulazioni né righe Windows, rientri di due spazi fuori # 2. the CI workflows read as block YAML: no tabs nor Windows line endings, two-space indentation outside text
# dai blocchi di testo, «on:» e «jobs:» presenti; e sono fatti solo di comandi: nessun «uses:», cioè nessuna # blocks, «on:» and «jobs:» present; and they are made of commands only: no «uses:», that is no action
# azione (le azioni JavaScript vogliono Node, e la CI di Febe è scritta in casa: decisione del 18 novembre 2026); # (JavaScript actions need Node, and the Febe CI is written in house: decision of 18 November 2026);
# 3. nessun file contiene segni di conflitto rimasti da un'unione; # 3. no file contains conflict markers left over from a merge;
# 4. la versione di Directory.Build.props è nella forma x.y.z[-qualcosa], quella che installer/costruisci.sh accetta; # 4. the version in Directory.Build.props has the form x.y.z[-something], the one installer/costruisci.sh accepts;
# 5. ogni progetto elencato in Febe.slnx esiste; # 5. every project listed in Febe.slnx exists;
# 6. ogni file JSON del repository si legge (configurazioni, campioni ripuliti, criteri di Chromium), con json.awk. # 6. every JSON file of the repository parses (configurations, cleaned samples, Chromium policies), with 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
# Un blocco di testo («run: |», «>-») tiene tutte le righe più rientrate della sua chiave; fuori, i rientri sono di # A text block («run: |», «>-») holds all the lines indented more than its key; outside, indentation goes two
# due spazi in due e nessuna riga chiama un'azione. # spaces at a time and no line calls an action.
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"
# Un solo processo per tutti i file; stampa i file che non si leggono, uno per riga, con il motivo e la riga. # A single process for all files; prints the files that do not parse, one per line, with the reason and the line.
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
# Costruzione dell'immagine Docker di Febe con il builder buildx dell'esecuzione (docker-container), sempre con gli # Builds the Febe Docker image with the buildx builder of the run (docker-container), always with the same arguments
# stessi argomenti e le stesse etichette: la costruzione che si pubblica esce intera dalla cache di quella che si è # and the same labels: the build that is published comes entirely from the cache of the one that was tested and
# provata e scansionata, quindi gli strati sono gli stessi. # scanned, so the layers are the same.
# #
# costruisci-immagine.sh builder <registro> il builder buildx dell'esecuzione (BUILDER), con il # costruisci-immagine.sh builder <registro> the buildx builder of the run (BUILDER), with the
# driver docker-container e la configurazione di # docker-container driver and the buildkit configuration
# buildkit che dice che il registro di casa risponde in # that says the home registry answers in HTTP (instead
# HTTP (al posto di docker/setup-buildx-action, un'azione # of docker/setup-buildx-action, a JavaScript action);
# JavaScript); lo toglie pulizia-docker.sh esecuzione # pulizia-docker.sh esecuzione removes it
# costruisci-immagine.sh archivio <file.tar> <nome locale> archivio dell'immagine, per docker load e per Trivy # costruisci-immagine.sh archivio <file.tar> <nome locale> archive of the image, for docker load and for Trivy
# costruisci-immagine.sh pubblica <nome:etichetta>... spinta sul registro REGISTRY da buildx, con # costruisci-immagine.sh pubblica <nome:etichetta>... push to the REGISTRY registry by buildx, with
# REGISTRO_UTENTE e REGISTRO_TOKEN in una configurazione # REGISTRO_UTENTE and REGISTRO_TOKEN in a client
# del client solo sua, tolta alla fine; il demone non # configuration of its own, removed at the end; the
# parla mai con il registro (proverebbe HTTPS) # daemon never talks to the registry (it would try HTTPS)
# #
# L'immagine è un manifest semplice, senza attestazioni (--provenance=false --sbom=false). Con le attestazioni, che # The image is a plain manifest, without attestations (--provenance=false --sbom=false). With the attestations, which
# buildx aggiunge da sé, sarebbe un indice: Gitea tiene ogni manifest figlio come una versione a sé, sha256:… senza # buildx adds by itself, it would be an index: Gitea keeps every child manifest as a version of its own, sha256:…
# etichetta, con la configurazione e gli strati, e togliere dal registro un'etichetta :sha- toglierebbe solo l'indice. # without a tag, with the configuration and the layers, and removing a :sha- tag from the registry would remove only
# Con un manifest semplice gli strati stanno nella versione dell'etichetta, e la pulizia del registro li libera davvero. # the index. With a plain manifest the layers belong to the tag's version, and the registry cleanup really frees them.
# #
# Variabili richieste: BUILDER, VERSIONE, GIT_COMMIT, FLUSSO (verifica o rilascio), ESECUZIONE (gitea.run_id). # Required variables: BUILDER, VERSIONE, GIT_COMMIT, FLUSSO (verifica or rilascio), ESECUZIONE (gitea.run_id).
# Le etichette febe.ci.* dicono quale flusso, esecuzione, ramo e commit hanno costruito l'immagine. Non servono alla # The febe.ci.* labels say which workflow, run, branch and commit built the image. They are not used by the cleanup:
# pulizia: stanno anche nelle immagini pubblicate e Docker le copia in ogni contenitore creato da quelle, anche in un # they are also in the published images and Docker copies them into every container created from those, even in a
# Febe vero. Per questo qui non si mette mai febe.ci.prova, il segno dei soli contenitori di prova (prova-immagine.sh): # real Febe. That is why febe.ci.prova, the mark of test containers only (prova-immagine.sh), is never set here:
# lo controlla PipelineTests. # PipelineTests checks it.
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.}"
# Solo un nome di host (o un indirizzo) con la porta: il valore finisce in un file TOML. # Only a host name (or an address) with the port: the value ends up in a TOML file.
[[ "$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 da buildx 0.13; prima si chiamava --config. # --buildkitd-config since buildx 0.13; before, it was called --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
# Le credenziali in una configurazione del client tutta nostra, solo per questa spinta e poi tolta: quella del # The credentials in a client configuration entirely our own, only for this push and then removed: the runner's
# runner non si tocca mai (niente jq per modificarla, nessuna credenziale che resti nella sua cartella). buildx le # one is never touched (no jq to modify it, no credential left in its folder). buildx passes them to the builder;
# passa al builder; il demone non c'entra (proverebbe HTTPS). Del client originale restano i plugin, i contesti e # the daemon is not involved (it would try HTTPS). From the original client we keep the plugins, the contexts and
# il contesto corrente; i builder buildx li trova con BUILDX_CONFIG. Il nome è fisso per l'esecuzione, così il passo # the current context; the buildx builders are found through BUILDX_CONFIG. The name is fixed for the run, so the
# «Pulizia (sempre)» la toglie anche dopo un'interruzione che salta la trap. # «Pulizia (sempre)» step removes it even after an interruption that skips the 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)
# Solo caratteri di base64, e il registro controllato sopra: il JSON si scrive senza bisogno di escape. # Only base64 characters, and the registry checked above: the JSON is written without any need for escapes.
[[ "$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
# Installa l'SDK .NET per un lavoro della CI, al posto di actions/setup-dotnet (un'azione JavaScript, che vuole Node). # Installs the .NET SDK for a CI job, instead of actions/setup-dotnet (a JavaScript action, which needs Node). Like
# Come quella prende l'ultimo SDK del canale (predefinito 10.0, come «10.0.x»), ma lo verifica: la versione e # that action it takes the newest SDK of the channel (default 10.0, like «10.0.x»), but it verifies it: the version
# l'impronta SHA-512 dell'archivio vengono dai metadati dei rilasci di Microsoft (letti con json.awk e dotnet-sdk.awk, # and the SHA-512 hash of the archive come from Microsoft's release metadata (read with json.awk and dotnet-sdk.awk,
# awk POSIX), l'archivio da builds.dotnet.microsoft.com, e si installa solo se l'impronta coincide. Mai uno script di # POSIX awk), the archive from builds.dotnet.microsoft.com, and it is installed only if the hash matches. Never an
# installazione scaricato al volo. # install script downloaded on the fly.
# #
# .gitea/scripts/dotnet.sh [canale] # .gitea/scripts/dotnet.sh [canale]
# #
# Dove: nella cache degli strumenti del runner (RUNNER_TOOL_CACHE, il volume act-toolcache che act_runner monta in ogni # Where: in the runner's tool cache (RUNNER_TOOL_CACHE, the act-toolcache volume that act_runner mounts in every job,
# lavoro, anche nei contenitori), in febe-dotnet/<versione>; senza, nella cartella temporanea del lavoro. Una versione # containers included), in febe-dotnet/<versione>; without it, in the job's temporary folder. A version already
# già installata e verificata non si riscarica; le versioni più vecchie di febe-dotnet si tolgono. Aggiunge dotnet al # installed and verified is not downloaded again; older versions in febe-dotnet are removed. Adds dotnet to the PATH
# PATH dei passi seguenti (GITHUB_PATH) e scrive DOTNET_ROOT (GITHUB_ENV); fuori dalla CI stampa solo la cartella. # of the following steps (GITHUB_PATH) and writes DOTNET_ROOT (GITHUB_ENV); outside the CI it only prints the folder.
# Serve curl, tar, sha512sum e awk. Nel contenitore Debian delle prove le librerie di sistema dell'SDK (ICU, OpenSSL) # Needs curl, tar, sha512sum and awk. In the Debian container of the tests the SDK's system libraries (ICU, OpenSSL)
# le installa ambiente-prove.sh; sull'immagine del runner ICU non è garantito, e i lavori che ci girano (installatore, # are installed by ambiente-prove.sh; on the runner image ICU is not guaranteed, and the jobs that run there
# windows, release) usano DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true. # (installatore, windows, release) use 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
# Le versioni precedenti, che nessun lavoro userà più (la CI fa un lavoro alla volta), e gli scarichi interrotti. # The earlier versions, which no job will use any more (the CI runs one job at a time), and interrupted downloads.
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 per i passi della CI, senza programmi di terzi (niente jq, niente Node; decisione di Alberto del 18 novembre # JSON for the CI steps, without third-party programs (no jq, no Node; decision of Alberto of 18 November 2026):
# 2026): legge con json.awk e json-campi.awk, scrive le stringhe con json-stringa.awk. awk POSIX, niente rete. # reads with json.awk and json-campi.awk, writes strings with json-stringa.awk. POSIX awk, no network.
# #
# json.sh campi <percorso> <campo,campo...> <file.json>... per ogni oggetto a quel posto, una riga con i campi # json.sh campi <percorso> <campo,campo...> <file.json>... for each object at that place, one line with the fields
# separati da un TAB (json-campi.awk): percorso vuoto # separated by a TAB (json-campi.awk): empty path for
# per l'oggetto radice, «*» per ogni elemento di un # the root object, «*» for every element of a list,
# elenco, per esempio «Results/*/Vulnerabilities/*» # for example «Results/*/Vulnerabilities/*»
# json.sh stringa <testo> il testo come stringa JSON, virgolette comprese # json.sh stringa <testo> the text as a JSON string, quotes included
# #
# Un file che non è JSON valido: niente in uscita, il motivo su stderr, uscita 2. Lo provano le PipelineTests. # A file that is not valid JSON: no output, the reason on stderr, exit status 2. PipelineTests tests it.
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
# Prova dell'immagine appena costruita, sul demone Docker del runner. Ogni contenitore gira SENZA RETE # Test of the image just built, on the runner's Docker daemon. Every container runs WITHOUT NETWORK (--network none):
# (--network none): Febe non può raggiungere alcun sito, tanto meno Instagram (regola 1), e il controllo di salute # Febe cannot reach any site, let alone Instagram (rule 1), and the health check goes through the container's
# passa dalla rete interna del contenitore. # internal network.
# Ogni contenitore porta l'etichetta febe.ci.prova=<esecuzione>, messa qui con «docker run --label» e mai in # Every container carries the label febe.ci.prova=<esecuzione>, set here with «docker run --label» and never in an
# un'immagine: è il segno con cui pulizia-docker.sh riconosce un contenitore di prova, insieme al nome # image: it is the mark by which pulizia-docker.sh recognises a test container, together with the name
# febe-prova-<esecuzione>. Le etichette febe.ci.* dell'immagine non bastano: Docker le copia in ogni contenitore, anche # febe-prova-<esecuzione>. The febe.ci.* labels of the image are not enough: Docker copies them into every container,
# in un Febe vero avviato da un'immagine pubblicata. # even into a real Febe started from a published image.
# #
# .gitea/scripts/prova-immagine.sh <immagine> [esecuzione] # .gitea/scripts/prova-immagine.sh <immagine> [esecuzione]
# #
# 1. Chromium della distribuzione risponde e i criteri di Febe (niente password salvate) sono al loro posto; # 1. the distribution's Chromium answers and the Febe policies (no saved passwords) are in place;
# 2. la lingua it_IT.UTF-8 è generata; # 2. the it_IT.UTF-8 locale is generated;
# 3. il contenitore parte come dice la guida (profilo seccomp di Febe, password dell'interfaccia, PUID/PGID # 3. the container starts as the guide says (Febe's seccomp profile, interface password, default PUID/PGID), the
# predefiniti), il controllo di salute dell'immagine diventa «healthy» e «febe --controllo-salute» risponde; # image's health check becomes «healthy» and «febe --controllo-salute» answers;
# 4. il processo 1 è Febe (niente tini) e nel contenitore non restano processi orfani da raccogliere; # 4. process 1 is Febe (no tini) and no orphan processes are left in the container to be reaped;
# 5. allo stop si ferma da solo, entro i 30 secondi che la guida concede. # 5. on stop it stops by itself, within the 30 seconds the guide allows.
# La password è casuale, vive solo nell'ambiente del client Docker e non si stampa mai. # The password is random, lives only in the Docker client's environment and is never printed.
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"
# Toglie il contenitore di prova di questa esecuzione (anche quello di un tentativo precedente), ma solo se porta il # Removes the test container of this run (also the one of an earlier attempt), but only if it carries the test mark:
# segno della prova: un contenitore con lo stesso nome e senza segno resta, e «docker run --name» si ferma. # a container with the same name and without the mark stays, and «docker run --name» stops.
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
# Il primo controllo di salute dell'immagine arriva 30 secondi dopo l'avvio (HEALTHCHECK --interval=30s): fino a 3 minuti. # The image's first health check comes 30 seconds after the start (HEALTHCHECK --interval=30s): up to 3 minutes.
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"
# Senza tini il processo 1 è Febe, e il runtime .NET da processo 1 raccoglie anche i figli di Chromium rimasti orfani. # Without tini process 1 is Febe, and the .NET runtime as process 1 also reaps the orphaned children of Chromium.
# Un processo appena finito può restare «zombie» per un istante: conta solo uno che resta tale per 10 secondi. # A process that has just ended may stay a «zombie» for an instant: only one that stays so for 10 seconds counts.
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
# I numeri dei processi zombie figli del processo 1, ordinati: quelli che tocca a lui raccogliere (gli orfani finiscono # The ids of the zombie processes that are children of process 1, sorted: the ones it has to reap (orphans end up
# lì). Uno sparito durante la lettura non conta. # there). One that vanishes while being read does not count.
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'
+158 -159
View File
@@ -1,71 +1,70 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Pulizia del demone Docker del runner e del registro dei container. Il demone è lo stesso che costruisce Encelado, # Cleanup of the runner's Docker daemon and of the container registry. The daemon is the same one that builds
# Mimante e gli altri progetti di Alberto (e molto probabilmente quello delle applicazioni di Unraid), e ci può girare # Encelado, Mimante and Alberto's other projects (and very probably the one of the Unraid applications), and a real
# anche un Febe vero. Dal 21 ottobre 2026 (decisione di Alberto) la pulizia toglie anche ciò che non serve più a # Febe may run on it too. Since 21 October 2026 (decision of Alberto) the cleanup also removes what nobody needs any
# nessuno, di qualunque progetto: le immagini che nessun contenitore usa, la cache di costruzione, i resti di # more, of any project: the images no container uses, the build cache, the leftovers of act_runner. Never a
# act_runner. Mai un contenitore, un volume o una rete che non sia della CI. # container, a volume or a network that does not belong to the CI.
# #
# Della CI di Febe si toglie ciò che si può provare suo. Le etichette febe.ci.workflow, febe.ci.run, febe.ci.ref e # 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
# febe.ci.commit dicono da dove viene un'immagine, ma NON scelgono che cosa togliere: stanno anche nelle immagini # and febe.ci.commit say where an image comes from, but they do NOT choose what to remove: they are also in the
# pubblicate (:main, :sha-, :X.Y.Z, :latest), e Docker le copia in ogni contenitore creato da quelle, quindi le porta # published images (:main, :sha-, :X.Y.Z, :latest), and Docker copies them into every container created from those,
# anche un Febe vero. Ciò che si toglie si riconosce così: # so a real Febe carries them too. What is removed is recognised like this:
# - contenitori di prova: l'etichetta febe.ci.prova=<esecuzione>, che mette solo prova-immagine.sh con # - test containers: the label febe.ci.prova=<esecuzione>, which only prova-immagine.sh sets with
# «docker run --label» e che nessuna immagine porta (lo controlla PipelineTests), E il nome esatto # «docker run --label» and which no image carries (PipelineTests checks it), AND the exact name
# febe-prova-<la stessa esecuzione> (gli altri contenitori della prova, senza nome, girano con --rm e Docker li # febe-prova-<the same run> (the other test containers, without a name, run with --rm and Docker removes them by
# toglie da sé appena finiscono); # itself as soon as they end);
# - immagini provate: il nome locale febe-ci:<esecuzione>, tolto per nome, mai per identificativo e mai con -f. Se la # - tested images: the local name febe-ci:<esecuzione>, removed by name, never by id and never with -f. If the same
# stessa immagine ha anche un nome del registro, si toglie solo febe-ci:<esecuzione>; se un contenitore la usa, resta; # image also has a registry name, only febe-ci:<esecuzione> is removed; if a container uses it, it stays;
# - builder buildx: il contenitore buildx_buildkit_febe-ci-<esecuzione>0, con l'immagine moby/buildkit, e il suo # - buildx builders: the container buildx_buildkit_febe-ci-<esecuzione>0, with the moby/buildkit image, and its
# volume …_state, che contengono la cache di costruzione di quell'esecuzione; # …_state volume, which hold the build cache of that run;
# - l'immagine febe:ci lasciata dal vecchio flusso di verifica (prima del 20 ottobre 2026), se nessuno la usa. # - the febe:ci image left by the old verification workflow (before 20 October 2026), if nobody uses it.
# Di act_runner si tolgono i resti dei lavori: act_runner chiama tutto ciò che crea per un lavoro # Of act_runner, the leftovers of the jobs are removed: act_runner names everything it creates for a job
# GITEA-ACTIONS-TASK-<numero del compito>… (il contenitore del lavoro, i suoi volumi <nome> e <nome>-env, la sua rete # GITEA-ACTIONS-TASK-<task number>… (the job container, its volumes <nome> and <nome>-env, its network
# <nome>-<lavoro>-network). Solo i contenitori fermi e i volumi e le reti che nessun contenitore usa, più vecchi di 90 # <nome>-<lavoro>-network). Only stopped containers, and volumes and networks no container uses, older than 90
# minuti: un lavoro che parte li crea e li usa subito. Il volume act-toolcache (la cache degli strumenti, condivisa fra # minutes: a job that starts creates them and uses them at once. The act-toolcache volume (the tool cache, shared
# i lavori) resta. # among the jobs) stays.
# #
# pulizia-docker.sh esecuzione <id> tutto ciò che ha creato l'esecuzione <id> (all'inizio e alla fine del suo # pulizia-docker.sh esecuzione <id> everything the run <id> created (at the start and at the end of its
# lavoro «immagine», sempre) # «immagine» job, always)
# pulizia-docker.sh penzolanti le immagini senza nome che nessun contenitore usa e la cache di costruzione # pulizia-docker.sh penzolanti the unnamed images no container uses and the daemon's dangling build cache
# penzolante del demone (quella che nessuna immagine condivide) non usata da # (the part no image shares) unused for 24 hours, of all projects (at the end
# 24 ore, di tutti i progetti (alla fine di ogni lavoro «immagine», dopo # of every «immagine» job, after «esecuzione»)
# «esecuzione») # pulizia-docker.sh residui [minuti] the leftovers of interrupted runs, older than N minutes (default 90: a job
# pulizia-docker.sh residui [minuti] i resti di esecuzioni interrotte, più vecchi di N minuti (predefinito 90: un # lasts at most 60 minutes, so none of them is still alive)
# lavoro dura al massimo 60 minuti, quindi nessuno di essi è ancora vivo) # pulizia-docker.sh settimanale residui, febe:ci, unnamed images older than 72 hours: the narrow cleanup of
# pulizia-docker.sh settimanale residui, febe:ci, immagini senza nome più vecchie di 72 ore: la pulizia # before 21 October 2026, now only by hand
# stretta di prima del 21 ottobre 2026, ora solo a mano # pulizia-docker.sh completa residui, febe:ci, act_runner leftovers, the images no container uses
# pulizia-docker.sh completa residui, febe:ci, resti di act_runner, le immagini che nessun contenitore # created more than 24 hours ago, the build cache unused for 24 hours and,
# usa create più di 24 ore fa, la cache di costruzione non usata da 24 ore e, # with REGISTRY_TOKEN, the registry's sha- tags beyond the 10 most recent and
# con REGISTRY_TOKEN, le etichette sha- del registro oltre le 10 più recenti e # the CI artifacts (febe-ci) older than 14 days («pulizia» workflow, every
# gli artefatti della CI (febe-ci) di più di 14 giorni (flusso «pulizia», ogni # Monday and by hand)
# lunedì e a mano) # pulizia-docker.sh <modo> --prova lists what it would remove and removes nothing: only commands that read
# pulizia-docker.sh <modo> --prova elenca che cosa toglierebbe e non toglie nulla: solo comandi che leggono # (on the registry only GET)
# (sul registro solo GET)
# #
# Gli argomenti si controllano tutti prima di toccare Docker: un'opzione diversa da --prova (--dry-run, -n, --Prova) o # All the arguments are checked before touching Docker: an option other than --prova (--dry-run, -n, --Prova) or an
# un argomento in più (prova senza trattini) fermano tutto con codice 2, invece di far partire la pulizia vera al posto # extra argument (prova without dashes) stops everything with code 2, instead of starting the real cleanup in place
# della prova. # of the dry run.
# #
# Mai docker system prune, container prune, volume prune o network prune; mai image prune -a o builder prune -a senza # Never docker system prune, container prune, volume prune or network prune; never image prune -a or builder prune -a
# il filtro delle 24 ore; mai un contenitore, un volume o una rete che non sia della CI. Le immagini le toglie Docker # without the 24-hour filter; never a container, a volume or a network that does not belong to the CI. The images are
# stesso (image prune), che non toglie mai un'immagine usata da un contenitore, nemmeno fermo; con -a, però, le toglie i # removed by Docker itself (image prune), which never removes an image used by a container, not even a stopped one;
# nomi in più, e lo script li scrive (nella prova li stima, secondo lo store). Sul registro mai main, latest o una # with -a, though, it removes their extra names, and the script writes them out (in the dry run it estimates them,
# versione X.Y.Z: solo le etichette sha-<esadecimale> della verifica e gli artefatti <x.y.z>-ci.<n> e # depending on the store). On the registry never main, latest or an X.Y.Z version: only the sha-<hexadecimal> tags of
# <x.y.z>-rilascio.<n> del pacchetto generico febe-ci. # the verification and the <x.y.z>-ci.<n> and <x.y.z>-rilascio.<n> artifacts of the generic febe-ci package.
# #
# Nei modi «residui», «settimanale» e «completa» un contenitore di prova si toglie solo se è fermo. Uno ancora acceso # In the «residui», «settimanale» and «completa» modes a test container is removed only if it is stopped. One still
# dopo 90 minuti (il suo lavoro è stato ucciso proprio durante la prova del contenitore) resta dov'è: lo si segnala, con # running after 90 minutes (its job was killed right during the container test) stays where it is: it is reported,
# il comando per toglierlo a mano. I builder sono l'eccezione: sono sempre accesi e la loro cache se ne va solo # with the command to remove it by hand. The builders are the exception: they are always running and their cache goes
# togliendo il contenitore; si riconoscono dal nome esatto e dall'immagine di buildkit, mai da un'etichetta. # away only by removing the container; they are recognised by the exact name and the buildkit image, never by a label.
# #
# Un oggetto già sparito non è un errore: la pulizia si può ripetere. Nei modi «esecuzione», «penzolanti» e «residui» # An object already gone is not an error: the cleanup can be repeated. In the «esecuzione», «penzolanti» and «residui»
# un problema diventa un avviso (un lavoro verde non diventa rosso per la pulizia, che il flusso del lunedì ripete); nei # modes a problem becomes a warning (a green job does not turn red because of the cleanup, which the Monday workflow
# modi «settimanale» e «completa» fa fallire il lavoro, perché qualcuno lo guardi. Il registro è l'eccezione: un # repeats); in the «settimanale» and «completa» modes it fails the job, so that someone looks at it. The registry is
# rifiuto della sua API è solo un avviso, e il lunedì dopo si riprova. # the exception: a refusal by its API is only a warning, and the following Monday it is tried again.
# #
# Variabili per il registro (modo «completa»): REGISTRY_TOKEN (token con «package: read and write», mai stampato), # Variables for the registry («completa» mode): REGISTRY_TOKEN (token with «package: read and write», never printed),
# GITEA_API (l'API del server, per esempio https://gitea.example/api/v1) e PROPRIETARIO (il proprietario del pacchetto # GITEA_API (the server's API, for example https://gitea.example/api/v1) and PROPRIETARIO (the owner of the febe
# febe). La scelta delle versioni da togliere sta in versioni-registro.sh, accanto a questo script. # package). The choice of the versions to remove lives in versioni-registro.sh, next to this script.
set -uo pipefail set -uo pipefail
uso() { uso() {
@@ -93,21 +92,21 @@ esac
cartella_script="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cartella_script="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
problemi=0 problemi=0
# In prova: i contenitori (identificativo e nome) e i nomi di immagine che la pulizia vera toglierebbe, perché gli # In a dry run: the containers (id and name) and the image names the real cleanup would remove, so that the lists
# elenchi che seguono li trattino come già tolti (un volume usato solo da un contenitore che se ne andrebbe, per # that follow treat them as already removed (a volume used only by a container that would go away, for example,
# esempio, se ne andrebbe anche lui). # would go away too).
previsti=() previsti=()
nomi_previsti=() nomi_previsti=()
# Per il riepilogo: quanti oggetti per tipo, nell'ordine in cui compaiono, e lo spazio recuperato da Docker. # For the summary: how many objects per kind, in the order they appear, and the space reclaimed by Docker.
declare -A conteggi=() declare -A conteggi=()
tipi=() tipi=()
note=() note=()
# La cache di costruzione che si pota è quella del builder del demone, «default». docker builder è un alias di docker # The build cache that is pruned is the one of the daemon's builder, «default». docker builder is an alias of docker
# buildx quando c'è il plugin, e buildx lavora sul builder corrente: se qualcuno avesse reso corrente il builder # buildx when the plugin is there, and buildx works on the current builder: if someone had made the run's builder
# dell'esecuzione (costruisci-immagine.sh builder non lo fa), il modo «esecuzione» l'avrebbe appena tolto. Gli altri # current (costruisci-immagine.sh builder does not), the «esecuzione» mode would have just removed it. The other
# comandi buildx di questo script indicano il builder per nome. # buildx commands of this script name the builder explicitly.
export BUILDX_BUILDER=default export BUILDX_BUILDER=default
avviso() { avviso() {
@@ -115,7 +114,7 @@ avviso() {
problemi=$((problemi + 1)) problemi=$((problemi + 1))
} }
# Un avviso che non fa diventare rosso il lavoro: per il registro. # A warning that does not turn the job red: for the registry.
segnala() { segnala() {
echo "::warning::$*" echo "::warning::$*"
} }
@@ -125,7 +124,7 @@ conta() {
conteggi[$1]=$((${conteggi[$1]:-0} + 1)) conteggi[$1]=$((${conteggi[$1]:-0} + 1))
} }
# Vero se la prima parola è fra quelle che seguono. # True if the first word is among the ones that follow.
fra() { fra() {
local cercata="$1" voce local cercata="$1" voce
shift shift
@@ -135,9 +134,9 @@ fra() {
return 1 return 1
} }
# Minuti trascorsi da un istante RFC 3339 come lo scrive Docker (Created di un contenitore o di un'immagine, CreatedAt # Minutes elapsed since an RFC 3339 instant as Docker writes it (Created of a container or an image, CreatedAt of a
# di un volume, {{json .Created}} di una rete, fra virgolette), con o senza frazioni di secondo, con «Z» o con lo scarto # volume, {{json .Created}} of a network, in quotes), with or without fractions of a second, with «Z» or with the
# dall'ora universale (+02:00). Se non si legge, 0: nel dubbio l'oggetto è giovane e resta. # offset from universal time (+02:00). If it cannot be read, 0: when in doubt the object is young and stays.
eta_minuti() { eta_minuti() {
local creato="${1:-}" secondi local creato="${1:-}" secondi
creato="${creato//\"/}" creato="${creato//\"/}"
@@ -158,8 +157,8 @@ durata() {
fi fi
} }
# Fra i contenitori dati (identificativi, uno per riga), quelli che restano dopo questa pulizia: in prova senza quelli # Among the given containers (ids, one per line), those that remain after this cleanup: in a dry run without the ones
# che la pulizia vera toglierebbe. # the real cleanup would remove.
restanti() { restanti() {
local id local id
while read -r id; do while read -r id; do
@@ -168,9 +167,9 @@ restanti() {
done <<< "${1:-}" done <<< "${1:-}"
} }
# I contenitori di prova della CI, uno per riga «id nome»: l'etichetta febe.ci.prova (dell'esecuzione indicata, o di # The CI test containers, one per line «id name»: the label febe.ci.prova (of the given run, or of any run if the
# qualunque se il primo argomento è vuoto) e il nome esatto febe-prova-<valore dell'etichetta>. Gli stati che seguono # first argument is empty) and the exact name febe-prova-<label value>. The states that follow narrow the choice
# restringono la scelta (Docker li unisce in OR). Esce con 1 se Docker non risponde. # (Docker joins them with OR). Exits with 1 if Docker does not answer.
contenitori_di_prova() { contenitori_di_prova() {
local run="$1" local run="$1"
shift shift
@@ -185,8 +184,8 @@ contenitori_di_prova() {
done <<< "$elenco" done <<< "$elenco"
} }
# Toglie un contenitore con i suoi volumi anonimi (in prova lo elenca soltanto). Con «forza» anche se è acceso: solo # Removes a container with its anonymous volumes (in a dry run it only lists it). With «forza» even if it is running:
# per quelli dell'esecuzione stessa e per i builder. Esce con 0 se il contenitore se ne va (o se ne andrebbe). # only for those of the run itself and for the builders. Exits with 0 if the container goes away (or would).
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)
@@ -203,8 +202,8 @@ togli_contenitore() {
return 1 return 1
} }
# Toglie il nome locale febe-ci:<esecuzione> (o febe:ci), mai l'immagine per identificativo e mai con -f: se l'immagine # Removes the local name febe-ci:<esecuzione> (or febe:ci), never the image by id and never with -f: if the image also
# ha anche un altro nome (del registro, per esempio) quello resta; se un contenitore la usa, resta tutto. # has another name (a registry one, for example) that one stays; if a container uses it, everything stays.
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 ]] \
@@ -227,9 +226,9 @@ togli_immagine() {
return 1 return 1
} }
# Un builder buildx della CI: prima con buildx (se questo client lo conosce), poi contenitore e volume per nome, perché # A CI buildx builder: first with buildx (if this client knows it), then container and volume by name, because a job
# un lavoro diverso da quello che l'ha creato non ne ha la configurazione. Il contenitore si toglie solo se gira # other than the one that created it does not have its configuration. The container is removed only if it runs the
# l'immagine di buildkit, e il volume solo quando il contenitore non c'è più. # buildkit image, and the volume only when the container is gone.
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; }
@@ -262,8 +261,8 @@ togli_builder() {
return "$esito" return "$esito"
} }
# Un volume o una rete di act_runner. Docker stesso non toglie un volume che un contenitore usa, né una rete con un # A volume or a network of act_runner. Docker itself does not remove a volume a container uses, nor a network with a
# contenitore acceso collegato. # running container attached.
togli_volume() { togli_volume() {
local nome="$1" local nome="$1"
if ((prova)); then if ((prova)); then
@@ -292,8 +291,8 @@ togli_rete() {
return 1 return 1
} }
# Vero se nessun contenitore, acceso o fermo, usa il volume o la rete (in prova: nessuno che la pulizia vera # True if no container, running or stopped, uses the volume or the network (in a dry run: none that the real cleanup
# lascerebbe). Nel dubbio (Docker non risponde) falso: resta. # would leave). When in doubt (Docker does not answer) false: it stays.
nessuno_usa() { nessuno_usa() {
local tipo="$1" nome="$2" utenti local tipo="$1" nome="$2" utenti
if [[ "$tipo" == volume ]]; then if [[ "$tipo" == volume ]]; then
@@ -326,7 +325,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
# Contenitori di prova fermi: si tolgono. Senza -f: se nel frattempo uno ripartisse, Docker lo lascia stare. # Stopped test containers: they are removed. Without -f: if one started again in the meantime, Docker leaves it alone.
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
@@ -337,7 +336,7 @@ residui() {
avviso "Non riesco a elencare i contenitori di prova fermi." avviso "Non riesco a elencare i contenitori di prova fermi."
fi fi
# Contenitori di prova ancora accesi: non si toccano, si segnalano. # Test containers still running: they are not touched, they are reported.
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
@@ -350,7 +349,7 @@ residui() {
avviso "Non riesco a elencare i contenitori di prova accesi." avviso "Non riesco a elencare i contenitori di prova accesi."
fi fi
# Immagini provate: solo i nomi febe-ci:<esecuzione>. # Tested images: only the febe-ci:<esecuzione> names.
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
@@ -361,7 +360,7 @@ residui() {
avviso "Non riesco a elencare le immagini febe-ci." avviso "Non riesco a elencare le immagini febe-ci."
fi fi
# Builder buildx. Il filtro per nome di Docker cerca una parte del nome: il nome esatto si controlla qui. # buildx builders. Docker's name filter matches part of the name: the exact name is checked here.
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
@@ -376,7 +375,7 @@ residui() {
fi fi
} }
# I resti della CI di Febe e l'immagine febe:ci del vecchio flusso (modi «settimanale» e «completa»). # The leftovers of the Febe CI and the febe:ci image of the old workflow («settimanale» and «completa» modes).
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"
@@ -385,16 +384,16 @@ resti_della_ci() {
fi fi
} }
# act_runner chiama i suoi oggetti GITEA-ACTIONS-TASK-<numero del compito>, seguito da «_WORKFLOW-…» o, nelle versioni # act_runner names its objects GITEA-ACTIONS-TASK-<task number>, followed by «_WORKFLOW-…» or, in older versions, by
# più vecchie, da «-WORKFLOW-…» con un'impronta in fondo. # «-WORKFLOW-…» with a hash at the end.
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"
# Contenitori fermi. Il filtro per nome di Docker cerca una parte del nome: l'inizio esatto si controlla qui. Senza # Stopped containers. Docker's name filter matches part of the name: the exact start is checked here. Without -f:
# -f: Docker non toglie un contenitore acceso. # Docker does not remove a running container.
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
@@ -408,7 +407,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
# Volumi che nessun contenitore usa, nemmeno fermo. # Volumes no container uses, not even a stopped one.
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
@@ -420,8 +419,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
# Reti a cui nessun contenitore è collegato, nemmeno fermo. Created di una rete è un istante di Go, che il modello # Networks no container is attached to, not even a stopped one. Created of a network is a Go time, which the template
# stampa come «2026-10-21 06:17:03 +0200 CEST»: in JSON è RFC 3339. # prints as «2026-10-21 06:17:03 +0200 CEST»: in JSON it is 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
@@ -434,9 +433,8 @@ resti_di_act_runner() {
fi fi
} }
# Le immagini dei contenitori, accesi o fermi, tranne quelli che la pulizia toglierebbe: «identificativo immagine» una # The images of the containers, running or stopped, except those the cleanup would remove: «id image» one per line,
# per riga, l'immagine come la si è data a docker run (un nome o un identificativo). Solo lettura: serve all'elenco # the image as it was given to docker run (a name or an id). Read only: it serves the dry-run listing.
# 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
@@ -449,8 +447,8 @@ immagini_in_uso() {
return 0 return 0
} }
# Il nome completo di un nome d'immagine, come lo ordina Docker: docker.io/library/ o docker.io/ davanti ai nomi di # The full name of an image name, as Docker sorts it: docker.io/library/ or docker.io/ in front of Docker Hub names
# Docker Hub scritti senza dominio, :latest se manca l'etichetta. # written without a domain, :latest if the tag is missing.
nome_completo() { nome_completo() {
local nome="$1" primo local nome="$1" primo
[[ "${nome##*/}" == *:* ]] || nome="$nome:latest" [[ "${nome##*/}" == *:* ]] || nome="$nome:latest"
@@ -466,13 +464,13 @@ nome_completo() {
fi fi
} }
# In prova: i nomi che «image prune -a» toglierebbe a un'immagine che un contenitore usa (i nomi e le immagini dei # In a dry run: the names «image prune -a» would remove from an image a container uses (the names and the images of
# contenitori, come li scrivono docker image ls e docker container inspect), uno per riga. L'immagine resta, ma i nomi # the containers, as docker image ls and docker container inspect write them), one per line. The image stays, but the
# in più no (moby). Con lo store classico Docker toglie i nomi in ordine alfabetico del nome completo e si ferma # extra names do not (moby). With the classic store Docker removes the names in alphabetical order of the full name
# all'ultimo, l'unico che rifiuta di togliere perché un contenitore usa l'immagine (daemon/images/image_prune.go e # and stops at the last one, the only one it refuses to remove because a container uses the image
# image_delete.go, isSingleReference): può andarsene anche il nome da cui il contenitore è stato creato. Con containerd # (daemon/images/image_prune.go and image_delete.go, isSingleReference): even the name the container was created from
# restano i nomi da cui i contenitori sono stati creati e, se uno la usa per identificativo e nessun nome resterebbe, # may go. With containerd the names the containers were created from stay and, if one uses it by id and no name would
# l'ultimo in ordine alfabetico (daemon/containerd/image_prune.go). # stay, the last one in alphabetical order (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=()
@@ -508,10 +506,10 @@ nomi_che_perde() {
return 0 return 0
} }
# In prova: le immagini che la potatura toglierebbe, con dimensione ed età. Nessun contenitore le usa (a parte quelli # In a dry run: the images the pruning would remove, with size and age. No container uses them (apart from those this
# che questa pulizia toglierebbe) e sono state create più di N minuti fa; con «senza-nome» solo quelle senza nome. Con # cleanup would remove) and they were created more than N minutes ago; with «senza-nome» only the unnamed ones. With
# «tutte», di un'immagine che un contenitore usa, i nomi in più che Docker le toglierebbe. È una stima fatta qui: nella # «tutte», for an image a container uses, the extra names Docker would remove from it. It is an estimate made here: in
# pulizia vera decide Docker (image prune). # the real cleanup Docker decides (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=()
@@ -543,11 +541,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
# Un'immagine i cui nomi la pulizia toglie qui sopra se ne va già con l'ultimo. # An image whose names the cleanup removes above already goes away with the last one.
[[ -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
# Un contenitore la usa: resta. Con -a, però, Docker le toglie i nomi in più. # A container uses it: it stays. With -a, though, Docker removes its extra names.
[[ "$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
@@ -575,8 +573,8 @@ elenca_immagini() {
((quante > 0)) || echo " nessuna" ((quante > 0)) || echo " nessuna"
} }
# In prova: quanta cache di costruzione ha il demone. Quanta ne toglierebbe la potatura Docker non lo dice senza # In a dry run: how much build cache the daemon has. How much of it the pruning would remove Docker does not say
# toglierla: al più quella che nessuno sta usando («RECLAIMABLE» di docker system df). # without removing it: at most the part nobody is using («RECLAIMABLE» of 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|')
@@ -589,11 +587,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")
} }
# Lo store delle immagini del demone: «containerd» (io.containerd.snapshotter.v1, predefinito nelle installazioni nuove # The daemon's image store: «containerd» (io.containerd.snapshotter.v1, the default in new Docker Engine installations
# di Docker Engine dalla 29) o «classico» (overlay2 e gli altri driver di prima). Ne dipende da quando contano le 24 ore # since 29) or «classico» (overlay2 and the other earlier drivers). It decides from when the 24 hours of image prune
# di image prune --filter until: con lo store classico dalla costruzione dell'immagine (Created della configurazione), # --filter until count: with the classic store from the image build (Created of the configuration), with containerd
# con containerd da quando il nome è arrivato sul demone (CreatedAt del suo record, che un nuovo pull dello stesso nome # from when the name arrived on the daemon (CreatedAt of its record, which a new pull of the same name does not
# non cambia). # change).
store="" store=""
rileva_store() { rileva_store() {
local stato local stato
@@ -611,21 +609,21 @@ rileva_store() {
esac esac
} }
# Ogni immagine con ciascuno dei suoi nomi, «identificativo nome» una per riga (<none>:<none> se non ne ha). # Every image with each of its names, «id name» one per line (<none>:<none> if it has none).
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
} }
# Lo spazio recuperato secondo Docker: «Total reclaimed space: 1.2GB» (docker) o «Total: 1.2GB» (buildx). # The space reclaimed according to Docker: «Total reclaimed space: 1.2GB» (docker) or «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}"
} }
# Una potatura di immagini di Docker: i nomi tolti, quante immagini e quanto spazio. Un errore è un avviso. I nomi si # A Docker image pruning: the names removed, how many images and how much space. An error is a warning. The names are
# confrontano prima e dopo: con -a Docker toglie anche i nomi in più di un'immagine che un contenitore usa e che resta, # compared before and after: with -a Docker also removes the extra names of an image a container uses and that stays,
# e il registro del lavoro lo dice. # and the job log says so.
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
@@ -659,7 +657,7 @@ pota_immagini() {
fi fi
} }
# Una potatura della cache di costruzione: quanto spazio. Un errore è un avviso. # A build cache pruning: how much space. An error is a warning.
pota_cache() { pota_cache() {
local cosa="$1" uscita recuperato local cosa="$1" uscita recuperato
shift shift
@@ -672,8 +670,8 @@ pota_cache() {
note+=("$cosa: $recuperato recuperati") note+=("$cosa: $recuperato recuperati")
} }
# Una chiamata all'API di Gitea con il token del registro, che sta solo nell'intestazione di curl e mai nel registro # A call to the Gitea API with the registry token, which is only in the curl header and never in the job log. Prints
# del lavoro. Stampa il codice HTTP: 000 se Gitea non risponde. # the HTTP code: 000 if Gitea does not answer.
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" \
@@ -690,21 +688,22 @@ spiega() {
esac esac
} }
# Le etichette sha- del pacchetto febe oltre le 10 più recenti, con l'API dei pacchetti di Gitea 28: # The sha- tags of the febe package beyond the 10 most recent, with the package API of Gitea 28:
# GET /api/v1/packages/{proprietario}/container/febe?page=N&limit=50 le versioni, una pagina alla volta finché # GET /api/v1/packages/{proprietario}/container/febe?page=N&limit=50 the versions, one page at a time until an
# ne arriva una vuota (il server può darne # empty one arrives (the server may give
# meno di 50 per pagina) # fewer than 50 per page)
# DELETE /api/v1/packages/{proprietario}/container/febe/{versione} una versione (risponde 204) # DELETE /api/v1/packages/{proprietario}/container/febe/{versione} one version (answers 204)
# Quali togliere lo sceglie versioni-registro.sh (awk POSIX con json.awk: niente Node, niente jq); qui si ricontrolla # Which ones to remove is chosen by versioni-registro.sh (POSIX awk with json.awk: no Node, no jq); here the
# la forma sha-<esadecimale> prima di ogni DELETE. Ogni rifiuto dell'API è un avviso che non fa diventare rosso il # sha-<hexadecimal> form is checked again before every DELETE. Every refusal by the API is a warning that does not
# lavoro, e dopo un rifiuto il registro non si tocca più (il token è lo stesso). Le versioni sha256:… senza etichetta (i # turn the job red, and after a refusal the registry is not touched any more (the token is the same). The sha256:…
# manifest figli di un indice, con gli strati) non si toccano mai: l'API non dice se un'etichetta le usa ancora. Si # versions without a tag (the child manifests of an index, with the layers) are never touched: the API does not say
# dice solo quante sono; la CI pubblica manifest semplici (costruisci-immagine.sh), quindi non dovrebbero essercene, e # whether a tag still uses them. Only their number is reported; the CI publishes plain manifests
# quelle che nessuna etichetta usa le toglie una regola di pulizia di Gitea (docs/processo.md, «Registro dei container»). # (costruisci-immagine.sh), so there should be none, and those no tag uses are removed by a Gitea cleanup rule
# Poi gli artefatti della CI (artefatti.sh): le versioni del pacchetto generico febe-ci create più di 14 giorni fa, # (docs/processo.md, «Registro dei container»).
# 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} la versione con i suoi file (204) # DELETE /api/v1/packages/{proprietario}/generic/febe-ci/{versione} the version with its files (204)
# solo con la forma <x.y.z>-ci.<n> o <x.y.z>-rilascio.<n>, ricontrollata prima di ogni DELETE. # only with the form <x.y.z>-ci.<n> or <x.y.z>-rilascio.<n>, checked again before every 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"
@@ -737,9 +736,9 @@ registro() {
artefatti_della_ci artefatti_della_ci
} }
# Le pagine delle versioni di un pacchetto nella cartella, pagina-<n>.json, fino alla prima vuota (il server può darne # The pages of the versions of a package in the folder, pagina-<n>.json, up to the first empty one (the server may give
# 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 # 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
# rifiuta (e lo segnala). # the API refuses (and reports it).
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
@@ -761,7 +760,7 @@ pagine() {
done done
} }
# Le etichette sha- del contenitore febe, dalle pagine già lette. # The sha- tags of the febe container, from the pages already read.
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) \
@@ -800,8 +799,8 @@ contenitore() {
done <<< "$scelte" done <<< "$scelte"
} }
# Gli artefatti della CI (artefatti.sh): le versioni del pacchetto generico febe-ci create più di 14 giorni fa, come la # The CI artifacts (artefatti.sh): the versions of the generic febe-ci package created more than 14 days ago, like the
# scadenza degli artefatti di una volta. # artifact expiry of the old days.
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"
@@ -841,8 +840,8 @@ artefatti_della_ci() {
done <<< "$scelte" done <<< "$scelte"
} }
# La cache con lo stesso limite del lunedì: senza, a ogni push di ogni ramo se ne andrebbero gli strati intermedi e le # The cache with the same limit as on Monday: without it, every push of every branch would remove the intermediate
# cache montate (RUN --mount=type=cache) che le costruzioni degli altri progetti hanno appena usato. # layers and the mounted caches (RUN --mount=type=cache) that the builds of the other projects have just used.
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
@@ -864,9 +863,9 @@ settimanale() {
fi fi
} }
# Tutto ciò che fa «settimanale» (le immagini senza nome più vecchie di 72 ore sono fra quelle che nessun contenitore # Everything «settimanale» does (the unnamed images older than 72 hours are among those no container uses created
# 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 # more than 24 hours ago) plus the act_runner leftovers, everyone's images and cache, and the registry. Containers
# contenitori, così le loro immagini, i loro volumi e le loro reti restano senza nessuno che li usi. # first, so that their images, volumes and networks are left with nobody using them.
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
# Riepilogo dei risultati delle prove (file .trx di «dotnet test --logger trx»): superate, fallite e saltate per ogni # Summary of the test results (.trx files of «dotnet test --logger trx»): passed, failed and skipped for each file,
# file, i nomi delle fallite e i motivi delle saltate. Lo scrive nel registro e, se il runner lo offre, nel riepilogo # the names of the failed ones and the reasons of the skipped ones. It writes it to the log and, if the runner offers
# del lavoro (GITHUB_STEP_SUMMARY). Nessun corpo di risposta né dato personale: solo nomi di prove e messaggi. # it, to the job summary (GITHUB_STEP_SUMMARY). No response body nor personal data: only test names and messages.
# #
# .gitea/scripts/riepilogo-prove.sh <cartella dei .trx> [saltate ammesse] # .gitea/scripts/riepilogo-prove.sh <cartella dei .trx> [saltate ammesse]
# #
# Esce con 1 se una prova è fallita, se le saltate sono più di quelle ammesse (predefinito 0: nella CI ci sono # Exits with 1 if a test failed, if the skipped ones are more than those allowed (default 0: the CI has Chromium and
# Chromium e Xvfb, quindi nessuna prova ha motivo di saltarsi) o se non c'è nessun risultato. Fa eccezione solo la # 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»
# categoria «da fare»: le inconclusive di FeaturesStillToDo (flussi di conformità H.264 delle parti che il # category: the inconclusive results of FeaturesStillToDo (H.264 conformance streams for the parts the decoder does
# decodificatore non gestisce ancora) il cui motivo comincia con «da fare: » si elencano e non contano fra le saltate. # not handle yet) whose reason starts with «da fare: » are listed and do not count among the skipped ones.
# Qualunque altra inconclusiva, anche con «da fare: » nel messaggio, è una saltata. # Any other inconclusive result, even with «da fare: » in its message, is a skipped one.
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»: una inconclusiva di FeaturesStillToDo il cui motivo comincia con «da fare: » subito dopo la cornice di MSTest # «Da fare»: an inconclusive result of FeaturesStillToDo whose reason starts with «da fare: » right after the MSTest
# («Assert.Inconclusive. », «Assert.Inconclusive failed. », «Assert.Inconclusive non riuscito. »): segna una parte non # frame («Assert.Inconclusive. », «Assert.Inconclusive failed. », «Assert.Inconclusive non riuscito. »): it marks a part
# ancora scritta, non un ambiente rotto, e si conta a parte. Il nome della prova e l'inizio del motivo sono entrambi # not written yet, not a broken environment, and is counted apart. Both the test name and the start of the reason are
# vincolati: nessun'altra prova può saltarsi in silenzio scrivendo «da fare: » nel messaggio. # constrained: no other test can skip silently by writing «da fare: » in its message.
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")"
# Un risultato per riga (i .trx sono XML su più righe), poi nome, esito e primo messaggio di ciascuno. # One result per line (the .trx files are XML over several lines), then name, outcome and first message of each.
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:"
# Le righe in più si leggono e si scartano (niente «head»: con pipefail il SIGPIPE fermerebbe lo script). # The extra lines are read and discarded (no «head»: with pipefail the SIGPIPE would stop the 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:"
# Il motivo senza la cornice di MSTest («Il metodo … ha generato un'eccezione. Assert.Inconclusive.»). # The reason without the MSTest frame («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
# Scansione delle vulnerabilità dell'immagine Docker con Trivy, a versione fissa (strumento.sh), sull'archivio prodotto # Vulnerability scan of the Docker image with Trivy, at a fixed version (strumento.sh), on the archive produced by
# dalla costruzione (docker save o buildx --output type=docker): non serve il demone, e si scansiona proprio # the build (docker save or buildx --output type=docker): no daemon is needed, and the very image that was tested is
# l'immagine provata. Pacchetti di Debian e dipendenze .NET di Febe (i file *.deps.json). # scanned. Debian packages and Febe's .NET dependencies (the *.deps.json files).
# #
# .gitea/scripts/scansione-immagine.sh <immagine.tar> [cartella dei rapporti] # .gitea/scripts/scansione-immagine.sh <immagine.tar> [cartella dei rapporti]
# #
# La regola (docs/processo.md, «Rilievi di sicurezza»): # The rule (docs/processo.md, «Rilievi di sicurezza»):
# - CRITICAL con una correzione disponibile: il lavoro fallisce e l'immagine non si pubblica; # - CRITICAL with a fix available: the job fails and the image is not published;
# - HIGH, e CRITICAL ancora senza correzione: si riportano nel registro e in trivy.json, senza fermare nulla. # - HIGH, and CRITICAL still without a fix: reported in the log and in trivy.json, without stopping anything.
# Le eccezioni stanno solo in .trivyignore, alla radice del repository: un identificativo per riga, con la scadenza # The exceptions live only in .trivyignore, at the repository root: one identifier per line, with the expiry
# (exp:AAAA-MM-GG) e, sulla riga sopra, il motivo scritto e chi l'ha deciso. # (exp:AAAA-MM-GG) and, on the line above, the written reason and who decided it.
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"
# Niente barre di avanzamento, niente controllo di versioni nuove, niente dati d'uso. # No progress bars, no check for new versions, no usage data.
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"
# Il conteggio con il lettore JSON nostro (json.sh, awk): niente jq. Una riga per vulnerabilità, gravità e versione # The count with our own JSON reader (json.sh, awk): no jq. One line per vulnerability, severity and the version that
# che la corregge (vuota o null se non c'è). Un rapporto illeggibile non ferma nulla: lo dice e basta. # fixes it (empty or null if there is none). An unreadable report stops nothing: it just says so.
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++ }
+9 -8
View File
@@ -1,14 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Cerca segreti (gettoni, chiavi, password) con gitleaks, a versione fissa (strumento.sh), in tutta la storia del # Looks for secrets (tokens, keys, passwords) with gitleaks, at a fixed version (strumento.sh), in the whole history
# commit verificato: ogni commit da cui discende, non solo l'ultimo. Ogni ramo si controlla al suo push (main a ogni # of the commit being verified: every commit it descends from, not only the last one. Each branch is checked on its
# unione), così un rilievo su un ramo non blocca gli altri. Un segreto non compare mai per intero: --redact lo # own push (main at every merge), so a finding on one branch does not block the others. A secret never appears in
# sostituisce con REDACTED nel registro e nel rapporto, e qui si stampano solo regola, file, riga, commit e impronta. # full: --redact replaces it with REDACTED in the log and in the report, and here only rule, file, line, commit and
# fingerprint are printed.
# #
# .gitea/scripts/segreti.sh [cartella del rapporto] # .gitea/scripts/segreti.sh [cartella del rapporto]
# #
# Che cosa fare con un rilievo: docs/processo.md, «Rilievi di sicurezza». In breve: un segreto vero si revoca subito # What to do with a finding: docs/processo.md, «Rilievi di sicurezza». In short: a real secret is revoked at once
# (toglierlo dalla storia non basta); un falso allarme già controllato (un dato di prova finto) si mette in # (removing it from the history is not enough); a false alarm already checked (fake test data) goes into
# .gitleaksignore con la sua impronta e, sulla riga sopra, un commento che dice che cos'è e chi l'ha controllato. # .gitleaksignore with its fingerprint and, on the line above, a comment saying what it is and who checked it.
set -euo pipefail set -euo pipefail
radice="$(git rev-parse --show-toplevel)" radice="$(git rev-parse --show-toplevel)"
@@ -37,7 +38,7 @@ if ((stato == 0)); then
exit 0 exit 0
fi fi
# Il riassunto con il lettore JSON nostro (json.sh, awk): niente jq. # The summary with our own JSON reader (json.sh, awk): no 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
# Installa uno dei due strumenti esterni della CI, gli unici approvati da Alberto e solo per la CI (20 ottobre 2026): # Installs one of the two external tools of the CI, the only ones Alberto approved and only for the CI (20 October
# gitleaks (segreti nella storia) e Trivy (vulnerabilità dell'immagine). Versione fissa, archivio scaricato dalla # 2026): gitleaks (secrets in the history) and Trivy (image vulnerabilities). Fixed version, archive downloaded from
# release del progetto e installato solo se la sua impronta SHA-256 coincide con quella scritta qui. Le impronte sono # the project's release and installed only if its SHA-256 hash matches the one written here. The hashes are those of
# quelle dei file *_checksums.txt delle release, ricontrollate il 20 ottobre 2026 sull'archivio scaricato e # the releases' *_checksums.txt files, checked again on 20 October 2026 against the downloaded archive and the hash
# sull'impronta che GitHub mostra per l'allegato. # GitHub shows for the attachment.
# #
# .gitea/scripts/strumento.sh gitleaks|trivy <cartella> # .gitea/scripts/strumento.sh gitleaks|trivy <cartella>
# #
# Per aggiornare uno strumento si cambiano versione e impronta insieme, in un commit solo, con una riga in # To update a tool, version and hash change together, in a single commit, with a line in docs/decisioni.md. Never
# docs/decisioni.md. Mai «latest», mai le azioni di terzi (trivy-action fu compromessa a marzo 2026, CVE-2026-33634), # «latest», never third-party actions (trivy-action was compromised in March 2026, CVE-2026-33634), never an install
# mai uno script di installazione scaricato al volo. # script downloaded on the fly.
set -euo pipefail set -euo pipefail
nome="${1:?Indica lo strumento: gitleaks o trivy.}" nome="${1:?Indica lo strumento: gitleaks o trivy.}"
+20 -19
View File
@@ -1,23 +1,24 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Sceglie le versioni da togliere dal registro dei pacchetti di Gitea (pulizia-docker.sh, modo «completa»). Legge solo # Chooses the versions to remove from Gitea's package registry (pulizia-docker.sh, «completa» mode). It reads only the
# i file che riceve, con json.awk e versioni-registro.awk (awk POSIX: niente jq, niente Node): niente rete, niente # files it is given, with json.awk and versioni-registro.awk (POSIX awk: no jq, no Node): no network, no writes, so it
# scritture, quindi si prova con un file JSON (PipelineTests). # is tested with a JSON file (PipelineTests).
# #
# versioni-registro.sh <quante tenere> <pagina.json>... le etichette sha-<da 7 a 40 cifre esadecimali> # versioni-registro.sh <quante tenere> <pagina.json>... the sha-<7 to 40 hexadecimal digits> tags of
# del contenitore febe oltre le N più recenti # the febe container beyond the N most recent
# versioni-registro.sh senza-etichetta <pagina.json>... le versioni sha256:<64 cifre> del contenitore # versioni-registro.sh senza-etichetta <pagina.json>... the sha256:<64 digits> versions of the febe
# febe (i manifest di un indice: solo da contare) # container (the manifests of an index: only to
# versioni-registro.sh scadute <giorni> <adesso> <pagina.json>... le versioni <x.y.z>-ci.<n> e # be counted)
# <x.y.z>-rilascio.<n> del pacchetto generico # versioni-registro.sh scadute <giorni> <adesso> <pagina.json>... the <x.y.z>-ci.<n> and <x.y.z>-rilascio.<n>
# febe-ci (gli artefatti della CI, artefatti.sh) # versions of the generic febe-ci package (the CI
# create più di <giorni> giorni prima di <adesso>, # artifacts, artefatti.sh) created more than
# in secondi dal 1970 # <giorni> days before <adesso>, in seconds since
# 1970
# #
# Ogni pagina è una risposta di GET /api/v1/packages/{proprietario}/{tipo}/{nome} di Gitea 28. Stampa, dalla più # Each page is a response of GET /api/v1/packages/{owner}/{type}/{name} of Gitea 28. Prints, oldest first and one per
# vecchia e una per riga, «versione<TAB>creata». Tutto il resto resta sempre: main, latest, le versioni X.Y.Z (anche # line, «version<TAB>created». Everything else always stays: main, latest, the X.Y.Z versions (also X.Y.Z-rc.N), the
# 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 # digests, every other tag, a sha- tag or an artifact without a readable date. Among the sha- tags the dates count,
# le date, non il testo; a parità di data l'identificativo. Se un file non è un elenco JSON esce con 2 e non stampa # not the text; with equal dates the identifier. If a file is not a JSON list it exits with 2 and prints nothing: when
# nulla: nel dubbio non si toglie niente. # in doubt nothing is removed.
set -euo pipefail set -euo pipefail
qui="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" qui="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -48,7 +49,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
# Righe: millisecondi (o «-»), identificativo, ordine, versione, data come scritta. # Lines: milliseconds (or «-»), identifier, order, version, date as written.
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" \
@@ -60,7 +61,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
;; ;;
*) *)
# Le più recenti prima (data, poi identificativo), si saltano le prime N, il resto dalla più vecchia. # The most recent first (date, then identifier), the first N are skipped, the rest from the oldest.
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
+23 -22
View File
@@ -1,22 +1,22 @@
# Pulizia del lunedì (alle 4:17, ora del server di Gitea) e a mano (Actions ▸ pulizia ▸ Esegui) del demone Docker del # Monday cleanup (at 4:17, Gitea server time) and by hand (Actions ▸ pulizia ▸ Esegui) of the runner's Docker daemon and
# runner e del registro dei container. A mano, con «Solo prova» spuntato, elenca che cosa toglierebbe e non toglie # of the container registry. By hand, with «Solo prova» ticked, it lists what it would remove and removes nothing: to
# nulla: da lanciare prima della prima pulizia vera e dopo ogni cambio dello script. # be run before the first real cleanup and after every change to the script.
# Ogni esecuzione di verifica e di rilascio toglie già ciò che crea e, per tutti, le immagini senza nome e la cache di # Every verification and release run already removes what it creates and, for everyone, the unnamed images and the
# costruzione penzolante non usata da 24 ore. Qui, dal 21 ottobre 2026 (decisione di Alberto: eliminare tutto ciò che # dangling build cache unused for 24 hours. Here, since 21 October 2026 (decision of Alberto: delete everything that
# non serve più), si toglie anche ciò che non serve più a nessuno, di qualunque progetto (pulizia-docker.sh completa): # is no longer needed), what nobody needs any more is removed too, of any project (pulizia-docker.sh completa):
# - i resti della CI di Febe: contenitori di prova fermi (etichetta febe.ci.prova e nome febe-prova-<esecuzione>, mai # - the leftovers of the Febe CI: stopped test containers (label febe.ci.prova and name febe-prova-<esecuzione>,
# le etichette febe.ci.* che un Febe vero eredita dall'immagine), nomi locali febe-ci:<esecuzione>, builder # never the febe.ci.* labels a real Febe inherits from the image), local names febe-ci:<esecuzione>, builders
# febe-ci-<esecuzione>, l'immagine febe:ci del vecchio flusso; # febe-ci-<esecuzione>, the febe:ci image of the old workflow;
# - i resti di act_runner: contenitori fermi, volumi e reti GITEA-ACTIONS-TASK-… che nessun contenitore usa, più # - the leftovers of act_runner: stopped containers, volumes and networks GITEA-ACTIONS-TASK-… no container uses,
# vecchi di 90 minuti; # older than 90 minutes;
# - le immagini che nessun contenitore usa, né acceso né fermo, create più di 24 ore fa (di un'immagine in uso Docker # - the images no container uses, running or stopped, created more than 24 hours ago (from an image in use Docker
# toglie i nomi in più), e la cache di costruzione del demone non usata da 24 ore. Le immagini di base # removes the extra names), and the daemon's build cache unused for 24 hours. The base images (debian:trixie,
# (debian:trixie, moby/buildkit, …) si riscaricano alla prima esecuzione che le chiede; # moby/buildkit, …) are downloaded again by the first run that asks for them;
# - con il segreto REGISTRY_TOKEN, le etichette sha- del registro oltre le 10 più recenti, mai main, latest o X.Y.Z, # - with the REGISTRY_TOKEN secret, the registry's sha- tags beyond the 10 most recent, never main, latest or X.Y.Z,
# e gli artefatti della CI (pacchetto generico febe-ci, artefatti.sh) creati più di 14 giorni fa. # and the CI artifacts (generic package febe-ci, artefatti.sh) created more than 14 days ago.
# Mai system prune, container prune, volume prune o network prune; mai un contenitore, un volume o una rete che non sia # Never system prune, container prune, volume prune or network prune; never a container, a volume or a network that
# della CI. Un contenitore di prova ancora acceso si segnala e il lavoro diventa rosso; un rifiuto dell'API del # does not belong to the CI. A test container still running is reported and the job turns red; a refusal by the
# registro è solo un avviso. Dettagli in .gitea/scripts/pulizia-docker.sh e in docs/processo.md, «Pulizia». # registry API is only a warning. Details in .gitea/scripts/pulizia-docker.sh and in docs/processo.md, «Pulizia».
name: pulizia name: pulizia
on: on:
@@ -67,9 +67,10 @@ 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 mette nell'evento la casella «prova» come testo, "true" o "false"; il lunedì l'evento non ha input e # Gitea 28 puts the «prova» checkbox in the event as text, "true" or "false"; on Monday the event has no inputs
# la pulizia è quella vera. Un avvio con l'API passa il valore così com'è: qualunque altro («True», «1») ferma il # and the cleanup is the real one. A start through the API passes the value as it is: any other («True», «1»)
# lavoro senza toccare nulla. Il token del registro va solo nell'ambiente di questo passo e non si stampa mai. # stops the job without touching anything. The registry token goes only into this step's environment and is
# 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 @@
# Rilascio a ogni tag vX.Y.Z (anche vX.Y.Z-qualcosa per un'anteprima): # Release at every vX.Y.Z tag (also vX.Y.Z-something for a preview):
# 1. prove: il tag coincide con <Version> di Directory.Build.props, la soluzione si compila con gli avvisi come errori # 1. prove: the tag matches <Version> in Directory.Build.props, the solution builds with warnings as errors and all
# e tutte le prove passano, nello stesso contenitore Debian 13 della verifica (Chromium e Xvfb veri) e # the tests pass, in the same Debian 13 container as the verification (real Chromium and Xvfb) and without any
# senza nessuna prova saltata. Senza prove verdi non si costruisce né si rilascia nulla; # skipped test. Without green tests nothing is built or released;
# 2. windows: Febe.exe in un file solo, il programma di installazione nostro (src/Febe.Installer) e lo zip portabile # 2. windows: Febe.exe in a single file, our own installer (src/Febe.Installer) and the portable zip
# (installer/costruisci.sh, gira su Linux con il solo .NET SDK): il cancello prima dell'immagine; # (installer/costruisci.sh, runs on Linux with the .NET SDK only): the gate before the image;
# 3. immagine: dopo l'installatore, l'immagine Docker (le prove girano anche dentro la build), provata senza rete e # 3. immagine: after the installer, the Docker image (the tests also run inside the build), tested without network
# scansionata con Trivy come nella verifica (una CRITICAL con correzione ferma tutto), poi pubblicata sul registro # and scanned with Trivy as in the verification (a CRITICAL with a fix stops everything), then published on the
# dei container di Gitea come <registro>/<proprietario>/febe:X.Y.Z e :latest (solo per le versioni senza # Gitea container registry as <registro>/<proprietario>/febe:X.Y.Z and :latest (only for versions without a
# trattino). Il lavoro dice se l'ha pubblicata, e alla fine toglie sempre immagini, contenitori, cache e builder # dash). The job says whether it published it, and at the end it always removes the run's images, containers,
# dell'esecuzione, poi le immagini senza nome e la cache di costruzione penzolante non usata da 24 ore di tutti i # cache and builder, then the unnamed images and the dangling build cache unused for 24 hours of all the
# progetti del demone; # daemon's projects;
# 4. release: solo dopo le prove, l'installatore e l'immagine. Ricostruisce installatore e zip dallo stesso commit con # 4. release: only after the tests, the installer and the image. It rebuilds installer and zip from the same commit
# lo stesso script (senza azioni non c'è un passaggio di artefatti fra i lavori che non dipenda da REGISTRY_TOKEN, # with the same script (without actions there is no way to pass artifacts between jobs that does not depend on
# e la release deve uscire anche senza), poi crea la release (o la completa, se esiste già) con installatore, zip # REGISTRY_TOKEN, and the release must come out without it too), then creates the release (or completes it, if
# portabile, modello Unraid e l'archivio per Docker Compose (compose.yml con il profilo seccomp accanto); le note # it already exists) with installer, portable zip, Unraid template and the Docker Compose archive (compose.yml
# dicono dove sta l'immagine, o che non è stata pubblicata. # with the seccomp profile next to it); the notes say where the image is, or that it was not published.
# #
# Niente azioni, come nella verifica (decisione del 18 novembre 2026): sorgenti con git e il gettone del lavoro, SDK con # No actions, as in the verification (decision of 18 November 2026): sources with git and the job token, SDK with
# .gitea/scripts/dotnet.sh, builder buildx con costruisci-immagine.sh builder, risultati delle prove e rapporto di Trivy # .gitea/scripts/dotnet.sh, buildx builder with costruisci-immagine.sh builder, test results and Trivy report in the
# nel pacchetto generico febe-ci (versione <versione>-rilascio.<numero>, con REGISTRY_TOKEN; artefatti.sh). # generic package febe-ci (version <versione>-rilascio.<numero>, with REGISTRY_TOKEN; artefatti.sh).
# #
# Segreto del repository (Impostazioni ▸ Actions ▸ Segreti): REGISTRY_TOKEN, un token dell'utente con i permessi # Repository secret (Impostazioni ▸ Actions ▸ Segreti): REGISTRY_TOKEN, a user token with the permissions
# «package: read and write». Senza, l'immagine si costruisce e si prova ma non si pubblica: la release esce lo stesso, # «package: read and write». Without it, the image is built and tested but not published: the release comes out
# con l'installatore per Windows, e le sue note dicono che l'immagine di questa versione non c'è. Aggiunto il segreto, # anyway, with the Windows installer, and its notes say the image of this version is missing. Once the secret is
# si rilancia il flusso del tag: l'immagine si pubblica e le note della release si correggono. # added, the tag's workflow is run again: the image is published and the release notes are corrected.
# Variabile facoltativa (Impostazioni ▸ Actions ▸ Variabili): REGISTRY, il nome del registro come lo raggiunge il # Optional variable (Impostazioni ▸ Actions ▸ Variabili): REGISTRY, the registry name as the runner reaches it (for
# runner (per esempio 192.168.30.23:3000); se manca si usa l'host dell'indirizzo del server Gitea (il suo ROOT_URL). # example 192.168.30.23:3000); if missing, the host of the Gitea server address (its ROOT_URL) is used.
# Il registro risponde in HTTP: la pubblicazione passa da buildx con un builder proprio (docker-container) a cui la # The registry answers in HTTP: publishing goes through buildx with a builder of its own (docker-container) whose
# configurazione di buildkit dice che quel registro è in HTTP e insicuro, così non serve che il Docker del runner lo # buildkit configuration says that registry is HTTP and insecure, so the runner's Docker does not need it among its
# abbia fra gli insecure-registries. Le credenziali vanno nella configurazione del client Docker, senza «docker login» # insecure-registries. The credentials go into the Docker client configuration, without «docker login» (which would
# (che passerebbe dal demone, e il demone proverebbe HTTPS). # go through the daemon, and the daemon would try HTTPS).
name: rilascio name: rilascio
on: on:
push: push:
tags: ["v*"] tags: ["v*"]
# Come la verifica e la pulizia: ogni passo con «bash -e -o pipefail», qualunque sia la shell predefinita del runner # Like the verification and the cleanup: every step with «bash -e -o pipefail», whatever the default shell of the
# o del contenitore (i Sorgenti usano gli array di bash; in un contenitore Debian la predefinita sarebbe dash). # runner or of the container (the Sorgenti step uses bash arrays; in a Debian container the default would be 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
# Lo stesso ambiente delle prove della verifica: Debian 13 con Chromium e Xvfb veri e il riepilogo che non # The same environment as the verification tests: Debian 13 with real Chromium and Xvfb and the summary that
# ammette prove saltate. Su ubuntu-latest le prove nel browser (fra cui il ritorno dopo l'accesso, return-path.js) # allows no skipped tests. On ubuntu-latest the browser tests (among them the return after sign-in,
# sarebbero inconcludenti e un rilascio uscirebbe senza averle fatte. # return-path.js) would be inconclusive and a release would come out without having run them.
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
# Nessuna prova saltata: una prova inconcludente (per esempio senza Chromium) ferma il rilascio. # No skipped test: an inconclusive test (for example without Chromium) stops the release.
- 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:
# Come l'installatore di verifica.yml: l'immagine del runner non garantisce ICU, e qui non serve. # Like the installer job of verifica.yml: the runner image does not guarantee ICU, and it is not needed here.
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
# Dopo l'installatore: :X.Y.Z e :latest escono solo se anche la release potrà uscire. # After the installer: :X.Y.Z and :latest come out only if the release can come out too.
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'
# Ciò che un'esecuzione interrotta non ha potuto togliere, e un tentativo precedente di questa stessa esecuzione. # What an interrupted run could not remove, and an earlier attempt of this same run.
- 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"
# Un builder buildx proprio, che sa che il registro di casa risponde in HTTP. # A buildx builder of our own, which knows that the home registry answers 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"
# Gli stessi argomenti ed etichette della pubblicazione (costruisci-immagine.sh): quella esce dalla cache di questa. # The same arguments and labels as the publication (costruisci-immagine.sh): that one comes from this one's cache.
- 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
# Le credenziali le mette costruisci-immagine.sh pubblica in una configurazione del client solo sua, tolta # costruisci-immagine.sh pubblica puts the credentials in a client configuration of its own, removed at the
# alla fine: buildx le passa al builder, il demone non c'entra. # end: buildx passes them to the builder, the daemon is not involved.
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
# La stessa costruzione di prima (dalla cache del builder), questa volta spinta sul registro da buildx. # The same build as before (from the builder's cache), this time pushed to the registry by 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: |
# La configurazione del client con le credenziali, se un'interruzione ha saltato la trap di chi l'ha scritta. # The client configuration with the credentials, if an interruption skipped the trap of whoever wrote it.
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"
# Poi, per tutti i progetti del demone, ciò che nessuno usa: immagini senza nome e cache di costruzione # Then, for all the daemon's projects, what nobody uses: unnamed images and dangling build cache unused for
# penzolante non usata da 24 ore. Non fa mai fallire il lavoro. # 24 hours. It never fails the job.
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
# Le prove sono verdi, l'installatore c'è e l'immagine si è costruita: pubblicata, o non pubblicata per la sola # The tests are green, the installer is there and the image was built: published, or not published only because
# mancanza del segreto (il lavoro «immagine» lo dice e le note lo riportano). Se la costruzione, la prova del # the secret is missing (the «immagine» job says so and the notes report it). If the build, the container test,
# contenitore, la scansione o la spinta sul registro falliscono, non esce nessuna release. # the scan or the push to the registry fail, no release comes out.
needs: [prove, windows, immagine] needs: [prove, windows, immagine]
timeout-minutes: 40 timeout-minutes: 40
env: env:
# Come «windows»: l'immagine del runner non garantisce ICU, e per costruire l'installatore non serve. # Like «windows»: the runner image does not guarantee ICU, and building the installer does not need it.
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
# Lo stesso commit e lo stesso script del lavoro «windows», che ha già fatto da cancello prima dell'immagine. # The same commit and the same script as the «windows» job, which already acted as the gate before the image.
- 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 # le versioni 0.x sono anteprime case "$VERSION" in *-*|0.*) PRE=true ;; *) PRE=false ;; esac # 0.x versions are previews
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}): \`: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." 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."
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 letto e scritto con .gitea/scripts/json.sh (awk), niente jq. Le risposte di Gitea in un file: il # JSON read and written with .gitea/scripts/json.sh (awk), no jq. Gitea's responses go to a file: the reader
# lettore legge file, non un flusso. # reads files, not a stream.
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; }
# Le note dicono come è andata questa volta (per esempio: l'immagine ora è pubblicata). # The notes say how it went this time (for example: the image is now published).
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 indica il profilo seccomp con un percorso relativo: l'archivio li porta insieme. # compose.yml points to the seccomp profile with a relative path: the archive carries them together.
COMPOSE="out/febe-compose-$VERSION" COMPOSE="out/febe-compose-$VERSION"
rm -rf "$COMPOSE" rm -rf "$COMPOSE"
mkdir -p "$COMPOSE/chromium" mkdir -p "$COMPOSE/chromium"
+56 -57
View File
@@ -1,34 +1,34 @@
# Verifica: a ogni push su qualunque ramo (i tag li prende rilascio.yml) e a mano (Actions ▸ verifica ▸ Esegui). # Verification: at every push on any branch (tags are taken by rilascio.yml) and by hand (Actions ▸ verifica ▸ Esegui).
# I suoi quattro lavori sono i controlli richiesti per unire in main (docs/processo.md): # Its four jobs are the checks required to merge into main (docs/processo.md):
# controlli sintassi degli script, flussi in YAML a blocchi e senza azioni, segni di conflitto, versione, # controlli script syntax, workflows in block YAML and without actions, conflict markers, version, projects of
# progetti della soluzione, JSON; segreti in tutta la storia con gitleaks (versione e impronta fissate); # the solution, JSON; secrets in the whole history with gitleaks (version and hash pinned);
# prove compilazione di tutta la soluzione con gli avvisi come errori e tutte le prove di tests/Febe.Tests # prove build of the whole solution with warnings as errors and all the tests of tests/Febe.Tests (never
# (mai «dotnet test» sulla soluzione intera: tests/Febe.Tests.Windows gira solo su Windows) con # «dotnet test» on the whole solution: tests/Febe.Tests.Windows runs only on Windows) with real
# Chromium e Xvfb veri in un contenitore Debian 13: nessuna prova deve saltarsi, tranne le «da fare» # Chromium and Xvfb in a Debian 13 container: no test may be skipped, except the «da fare» ones of
# di H264ConformanceTests.FeaturesStillToDo (riepilogo-prove.sh le conta a parte). # H264ConformanceTests.FeaturesStillToDo (riepilogo-prove.sh counts them apart).
# Il mondo sintetico del sito di prova ha il seme 13 e, per la categoria SitoDiProva, anche il seme di # The synthetic world of the test site has seed 13 and, for the SitoDiProva category, also the seed of
# questa esecuzione, scritto nel registro per rifare un errore; # this run, written in the log to reproduce a failure;
# installatore Febe-Setup-<versione>-ci.<numero>.exe (il programma di installazione nostro, src/Febe.Installer) e # installatore Febe-Setup-<versione>-ci.<numero>.exe (our own installer, src/Febe.Installer) and the portable zip;
# lo zip portabile; serve solo il .NET SDK; # only the .NET SDK is needed;
# immagine dopo l'installatore: l'immagine Docker costruita con buildx, provata senza rete (parte, salute, # immagine after the installer: the Docker image built with buildx, tested without network (start, health,
# Chromium, it_IT) e scansionata con Trivy (si ferma per una CRITICAL con correzione); solo dopo un push # Chromium, it_IT) and scanned with Trivy (it stops for a CRITICAL with a fix); only after a push on
# su main la pubblica come :main e :sha-<7 caratteri> (:latest resta al rilascio). Alla fine, sempre, # main it publishes it as :main and :sha-<7 characters> (:latest is left to the release). At the end,
# toglie immagini, contenitori, cache e builder di questa esecuzione, poi le immagini senza nome e la # always, it removes this run's images, containers, cache and builder, then the unnamed images and the
# cache di costruzione penzolante non usata da 24 ore di tutti i progetti del demone. # dangling build cache unused for 24 hours of all the daemon's projects.
# #
# Niente azioni (decisione di Alberto del 18 novembre 2026: niente componenti esterni): ogni passo è un comando. I # No actions (decision of Alberto of 18 November 2026: no external components): every step is a command. The sources
# sorgenti arrivano con git e il gettone del lavoro, l'SDK .NET con .gitea/scripts/dotnet.sh (verificato con l'impronta # arrive with git and the job token, the .NET SDK with .gitea/scripts/dotnet.sh (verified against the hash in
# dei metadati di Microsoft), il builder buildx con costruisci-immagine.sh builder. Gli artefatti (risultati delle # Microsoft's metadata), the buildx builder with costruisci-immagine.sh builder. The artifacts (test results,
# prove, installatore e zip, rapporti di gitleaks e di Trivy) vanno nel registro dei pacchetti di Gitea, pacchetto # installer and zip, gitleaks and Trivy reports) go to Gitea's package registry, generic package febe-ci, version
# generico febe-ci, versione <versione>-ci.<numero>, con REGISTRY_TOKEN (.gitea/scripts/artefatti.sh); la pulizia del # <versione>-ci.<numero>, with REGISTRY_TOKEN (.gitea/scripts/artefatti.sh); the Monday cleanup removes those older
# lunedì toglie quelli di più di 14 giorni. Senza il segreto un avviso, e il lavoro resta verde. Nessun passo usa Node. # than 14 days. Without the secret a warning, and the job stays green. No step uses Node.
# #
# Niente «pull_request»: in Gitea una richiesta di unione mostra lo stato del suo ultimo commit, che il push del ramo # No «pull_request»: in Gitea a pull request shows the status of its last commit, which the branch push has already
# ha già verificato; pull_request rifarebbe tutto sullo stesso commit (refs/pull/N/head) sull'unico runner. # verified; pull_request would redo everything on the same commit (refs/pull/N/head) on the only runner.
# Runner: act_runner con l'etichetta ubuntu-latest, un lavoro alla volta. I lavori parlano con il demone Docker del # Runner: act_runner with the ubuntu-latest label, one job at a time. The jobs talk to the server's Docker daemon, the
# server, lo stesso di Encelado, Mimante e degli altri progetti: niente montaggi della cartella del lavoro in altri # same as Encelado, Mimante and the other projects: no mounts of the job folder into other containers (on the server
# contenitori (sul server i percorsi sono diversi); le immagini passano come archivi e contesti di costruzione. # the paths are different); images travel as archives and build contexts.
# Che cosa di Gitea 28 si usa e perché: docs/decisioni.md (20 ottobre e 18 novembre 2026) e docs/processo.md. # What of Gitea 28 is used and why: docs/decisioni.md (20 October and 18 November 2026) and docs/processo.md.
name: verifica name: verifica
on: on:
@@ -44,10 +44,10 @@ on:
permissions: permissions:
contents: read contents: read
# Su un ramo conta l'ultimo push: l'esecuzione precedente si annulla. Su main ogni commit ha il suo gruppo, così ogni # On a branch the last push counts: the earlier run is cancelled. On main every commit has its own group, so every
# unione arriva fino in fondo e pubblica la sua :sha-. L'evento fa parte del gruppo: un'esecuzione a mano non annulla # merge runs to the end and publishes its :sha-. The event is part of the group: a run by hand never cancels the one
# mai quella di un push, che è l'unica a scrivere gli stati del commit richiesti per unire (un lavoro annullato lascia # of a push, which is the only one that writes the commit statuses required to merge (a cancelled job leaves the
# lo stato «failure», e workflow_dispatch non ne scrive). # «failure» status, and workflow_dispatch writes none).
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:
# I sorgenti del commit con git e il gettone del lavoro, che vale solo finché il lavoro gira e non resta nella # The commit's sources with git and the job token, which is valid only while the job runs and does not stay in
# configurazione del repository. Qui tutta la storia (PROFONDITA 0): gitleaks legge ogni commit da cui discende # the repository configuration. Here the whole history (PROFONDITA 0): gitleaks reads every commit the verified
# quello verificato. Lo stesso passo, lettera per lettera, apre ogni lavoro (lo controlla PipelineTests). # one descends from. The same step, letter for letter, opens every job (PipelineTests checks it).
- 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, nient'altro: Chromium vero della distribuzione, come nell'immagine di Febe (su Ubuntu è uno snap). Senza # Debian 13, nothing else: the distribution's real Chromium, as in the Febe image (on Ubuntu it is a snap). Without
# azioni non serve Node: git e curl prima dei sorgenti, il resto da ambiente-prove.sh, l'SDK da dotnet.sh. # actions Node is not needed: git and curl before the sources, the rest from ambiente-prove.sh, the SDK from
# Memoria condivisa più ampia dei 64 MB predefiniti: le prove dell'interfaccia usano un Chromium senza finestra. # dotnet.sh. Shared memory larger than the default 64 MB: the interface tests use a Chromium without a window.
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'
# Prima di tutto il resto, così un seme chiesto a mano e sbagliato ferma subito il lavoro. # Before everything else, so that a wrong seed asked by hand stops the job at once.
- 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 }}
# Questo lavoro gira sull'immagine del runner, che non garantisce ICU: pubblicare e impacchettare non ne hanno # This job runs on the runner image, which does not guarantee ICU: publishing and packaging do not need it, so
# bisogno, quindi .NET va in globalizzazione invariante invece di fermarsi («Couldn't find a valid ICU package»). # .NET goes into invariant globalization instead of stopping («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[@]}"
# Dopo l'installatore, non solo dopo le prove: :main e :sha- escono solo da un commit con tutta la verifica verde. # After the installer, not only after the tests: :main and :sha- come only from a commit with the whole verification
# Sull'unico runner i lavori vanno comunque uno alla volta, quindi la durata non cambia. # green. On the only runner the jobs go one at a time anyway, so the duration does not change.
immagine: immagine:
needs: [prove, installatore] needs: [prove, installatore]
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -288,14 +288,13 @@ 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'
# Ciò che un'esecuzione interrotta (annullata, scaduta) non ha potuto togliere, e un tentativo precedente di # What an interrupted run (cancelled, timed out) could not remove, and an earlier attempt of this same run.
# 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"
# Registro: la variabile REGISTRY delle Actions, se c'è, altrimenti l'host dell'indirizzo del server (ROOT_URL). # Registry: the REGISTRY variable of the Actions, if set, otherwise the host of the server address (ROOT_URL).
- name: Versione, registro e nomi - name: Versione, registro e nomi
env: env:
REGISTRO_SCELTO: ${{ vars.REGISTRY }} REGISTRO_SCELTO: ${{ vars.REGISTRY }}
@@ -315,7 +314,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"
# Un builder buildx di questa esecuzione (con la sua cache), che sa che il registro di casa risponde in HTTP. # A buildx builder of this run (with its cache), which knows that the home registry answers 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"
@@ -364,13 +363,13 @@ jobs:
REGISTRO_UTENTE: ${{ gitea.actor }} REGISTRO_UTENTE: ${{ gitea.actor }}
GITEA_TOKEN: ${{ gitea.token }} GITEA_TOKEN: ${{ gitea.token }}
run: | run: |
# Le credenziali le mette costruisci-immagine.sh pubblica in una configurazione del client solo sua, tolta # costruisci-immagine.sh pubblica puts the credentials in a client configuration of its own, removed at the
# alla fine: buildx le passa al builder, il demone non c'entra (e proverebbe HTTPS). Non si stampano mai. # end: buildx passes them to the builder, the daemon is not involved (and would try HTTPS). Never printed.
NOMI=("$IMAGE:sha-${GITHUB_SHA::7}") NOMI=("$IMAGE:sha-${GITHUB_SHA::7}")
# :main solo se main è ancora a questo commit: un'esecuzione arrivata in ritardo non lo riporta indietro. # :main only if main is still at this commit: a run that arrives late does not move it back.
# Il gettone del lavoro solo nell'ambiente di git, come per i sorgenti. Il passo gira con «bash -e -o # The job token only in git's environment, as for the sources. The step runs with «bash -e -o
# pipefail»: senza «|| CIMA=""» un errore di ls-remote chiuderebbe il passo prima dell'avviso, e non # pipefail»: without «|| CIMA=""» an ls-remote error would end the step before the warning, and not even
# uscirebbe nemmeno la :sha-. # the :sha- would come out.
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=""
@@ -386,10 +385,10 @@ jobs:
- name: Pulizia (sempre) - name: Pulizia (sempre)
if: always() if: always()
run: | run: |
# La configurazione del client con le credenziali, se un'interruzione ha saltato la trap di chi l'ha scritta. # The client configuration with the credentials, if an interruption skipped the trap of whoever wrote it.
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"
# Poi, per tutti i progetti del demone, ciò che nessuno usa: immagini senza nome e cache di costruzione # Then, for all the daemon's projects, what nobody uses: unnamed images and dangling build cache unused for
# penzolante non usata da 24 ore. Non fa mai fallire il lavoro. # 24 hours. It never fails the job.
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."
+25 -24
View File
@@ -1,24 +1,24 @@
#!/bin/sh #!/bin/sh
# Febe: avvio del contenitore (specifica §11). # Febe: container start (specification §11).
# #
# Fa solo tre cose e poi cede il posto al server: # It does only three things and then hands over to the server:
# 1. crea, se mancano, il gruppo PGID e l'utente PUID (su Unraid 99 e 100, «nobody:users»); # 1. creates, if missing, the group PGID and the user PUID (on Unraid 99 and 100, «nobody:users»);
# 2. rende /dati di quell'utente (la prima volta, o se PUID/PGID sono cambiati) e gli fa preparare /dati/home; # 2. makes /dati owned by that user (the first time, or if PUID/PGID changed) and has it prepare /dati/home;
# 3. exec del server con setpriv, come quell'utente: il server avvia e sorveglia da sé Xvfb e Chromium. # 3. execs the server with setpriv, as that user: the server starts and watches Xvfb and Chromium by itself.
# Sempre exec, mai un processo figlio: il server prende il posto di questo script come processo 1 del contenitore # Always exec, never a child process: the server takes the place of this script as process 1 of the container
# (niente tini), riceve SIGTERM da «docker stop» e, con il runtime .NET, raccoglie i processi rimasti orfani. # (no tini), receives SIGTERM from «docker stop» and, with the .NET runtime, reaps the orphaned processes.
# Nessun ciclo di sorveglianza qui: è il lavoro di Febe.Server (niente script di shell che facciano da supervisore). # No watch loop here: that is the job of Febe.Server (no shell script acting as a supervisor).
# /libreria non si cambia mai ricorsivamente (sono le foto di Alberto); /importa è in sola lettura e non si tocca; # /libreria is never changed recursively (it holds Alberto's photos); /importa is read only and is not touched;
# di /esporta (le copie esterne, specifica §4.10) si assegna solo la radice, mai ricorsivamente, e solo se le copie # of /esporta (the external copies, specification §4.10) only the root is assigned, never recursively, and only if
# esterne sono dichiarate (FEBE_ESPORTA=1 o --esporta). # the external copies are declared (FEBE_ESPORTA=1 or --esporta).
# Se /dati non si può sistemare (disco di rete, permessi) si parte lo stesso: è Febe a spiegare il problema nella sua # If /dati cannot be fixed (network disk, permissions) it starts anyway: Febe explains the problem on its page,
# pagina, invece di un contenitore che si riavvia senza dire perché. # instead of a container that restarts without saying why.
set -eu set -eu
PUID="${PUID:-99}" PUID="${PUID:-99}"
PGID="${PGID:-100}" PGID="${PGID:-100}"
# Già avviato come utente normale (docker run --user ...): niente da cambiare. # Already started as a normal user (docker run --user ...): nothing to change.
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 è dell'utente PUID, che dentro può mettere di tutto, anche collegamenti simbolici verso file del contenitore: # /dati belongs to the PUID user, who can put anything in it, even symbolic links to files of the container: as root
# da root qui dentro non si scrive niente. L'unica cosa fatta da root è il cambio di proprietario, ricorsivo e senza # nothing is written in there. The only thing done as root is the change of owner, recursive and without following
# seguire i collegamenti (-R senza -H/-L: cambia il collegamento, mai ciò a cui punta). Il resto lo fa l'utente stesso. # links (-R without -H/-L: it changes the link, never what it points to). The rest is done by the user itself.
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
# Una /dati/home di un altro proprietario (un avvio precedente come root): conta solo una cartella vera. # A /dati/home with another owner (an earlier start as root): only a real folder counts.
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,22 +51,23 @@ 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
# La HOME di Chromium la crea e la chiude l'utente, con i suoi permessi. # Chromium's HOME is created and locked by the user, with its own permissions.
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
# Il profilo seccomp non sta più in /dati: Docker lo legge sul server alla creazione del contenitore, e in /dati # The seccomp profile no longer lives in /dati: Docker reads it on the server when the container is created, and in
# l'utente del contenitore potrebbe allentarlo. Si tiene fuori dal volume dei dati (docs/docker.md, «Sandbox»). # /dati the container's user could loosen it. It is kept outside the data volume (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
# Una cartella della libreria appena creata da Docker appartiene a root: solo quella, senza ricorsione. # A library folder just created by Docker belongs to root: only that folder, without recursion.
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: solo la radice, mai ricorsivo, e solo se le copie esterne sono dichiarate (SPECIFICA §4.10). Dentro ci # /esporta: only the root, never recursive, and only if the external copies are declared (SPECIFICA §4.10). Inside
# sono file di Alberto copiati da Febe o messi da lui: non si cambiano mai. Febe non crea /esporta se manca. # there are Alberto's files copied by Febe or put there by him: they are never changed. Febe does not create /esporta
# 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 -1
View File
@@ -658,5 +658,5 @@ Ogni scelta tecnica presa strada facendo, con data e motivo (specifica §15).
| 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 | **Confermate le risposte proposte delle domande 19–38 di §16**, che le tappe D1, S4b, E2 ed E3 avevano già adottato: D1 (19 e 21) le raccolte in evidenza subito dopo le storie nell'ordine predefinito e il posto su otto della coda al file che aspetta da più tempo, senza quote per tipo; S4b (20) i 5 secondi di grazia prima che lasciare la pagina del browser in Docker copi la sessione; E2 (22–27) «Esporta questo account» spento salta anche le copie a mano, `/esporta` attiva su un montaggio in `/esporta` o sotto, «Automatica» nascosta fino a E5, «Copia di nuovo anche i N tolti o superati» spenta all'apertura, conteggi e segni sui soli file dovuti, margine di 64 MB; E3 (28–38) «già copiato» guarda il file e non il formato, «Solo i nuovi» per la conversione della libreria, i convertiti nel visualizzatore, CMYK e più di 8 bit copiati come sono verso PNG/WEBP, nomi, istanti e limiti dei fotogrammi, zip, PNG per i fotogrammi, WEBP con perdita copiato byte per byte, i convertiti riconosciuti «già in libreria» all'importazione. La riga di ogni domanda dice la risposta (§16) e i paragrafi che le citavano come proposte ora la citano come risposta | Risposta di Alberto del 29 novembre 2026: «Le confermo tutte». Nulla cambia nel codice: le tappe facevano già così | | 2026-11-29 | **Confermate le risposte proposte delle domande 19–38 di §16**, che le tappe D1, S4b, E2 ed E3 avevano già adottato: D1 (19 e 21) le raccolte in evidenza subito dopo le storie nell'ordine predefinito e il posto su otto della coda al file che aspetta da più tempo, senza quote per tipo; S4b (20) i 5 secondi di grazia prima che lasciare la pagina del browser in Docker copi la sessione; E2 (22–27) «Esporta questo account» spento salta anche le copie a mano, `/esporta` attiva su un montaggio in `/esporta` o sotto, «Automatica» nascosta fino a E5, «Copia di nuovo anche i N tolti o superati» spenta all'apertura, conteggi e segni sui soli file dovuti, margine di 64 MB; E3 (28–38) «già copiato» guarda il file e non il formato, «Solo i nuovi» per la conversione della libreria, i convertiti nel visualizzatore, CMYK e più di 8 bit copiati come sono verso PNG/WEBP, nomi, istanti e limiti dei fotogrammi, zip, PNG per i fotogrammi, WEBP con perdita copiato byte per byte, i convertiti riconosciuti «già in libreria» all'importazione. La riga di ogni domanda dice la risposta (§16) e i paragrafi che le citavano come proposte ora la citano come risposta | Risposta di Alberto del 29 novembre 2026: «Le confermo tutte». Nulla cambia nel codice: le tappe facevano già così |
| 2026-11-29 | **I commenti degli script di shell in `.gitea/` e `installer/` si scrivono in inglese** (#43), come il resto del codice; i messaggi che gli script stampano restano in italiano. È la sola decisione: da fare, gli script hanno ancora i commenti in italiano (`docs/stato.md`, «Rimandato») | Decisione di Alberto del 29 novembre 2026: la convenzione «codice e commenti in inglese, interfaccia e messaggi in italiano» vale anche per gli script di shell | | 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 |
| 2026-11-29 | **Subito dopo «Scollega», con l'indirizzo della pagina sconosciuto** (il browser non risponde ancora, `FullUrlAsync` dà `null`), Febe aspetta che il browser risponda, entro un limite; se ancora non risponde apre la pagina di accesso (#67). È la sola decisione: da fare, il codice oggi non aspetta (`OpenForAlbertoAsync` scrive «Alberto usa il browser» e non apre nulla; `docs/stato.md`, «Rimandato») | Decisione di Alberto del 29 novembre 2026: senza sapere quale pagina mostra il browser non si può dire se è già quella di accesso; aspettare un poco evita di ricaricare una pagina che sta arrivando, e il limite evita di restare fermi | | 2026-11-29 | **Subito dopo «Scollega», con l'indirizzo della pagina sconosciuto** (il browser non risponde ancora, `FullUrlAsync` dà `null`), Febe aspetta che il browser risponda, entro un limite; se ancora non risponde apre la pagina di accesso (#67). È la sola decisione: da fare, il codice oggi non aspetta (`OpenForAlbertoAsync` scrive «Alberto usa il browser» e non apre nulla; `docs/stato.md`, «Rimandato») | Decisione di Alberto del 29 novembre 2026: senza sapere quale pagina mostra il browser non si può dire se è già quella di accesso; aspettare un poco evita di ricaricare una pagina che sta arrivando, e il limite evita di restare fermi |
-5
View File
@@ -773,8 +773,6 @@ 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.
@@ -782,9 +780,6 @@ protezione di `main` sono in `docs/processo.md`.
## Rimandato, e perché ## Rimandato, e perché
- Gli script di shell di `.gitea/` e `installer/` hanno ancora i commenti in italiano: vanno tradotti in inglese
(decisione di Alberto del 29 novembre 2026, #43), in un ramo a parte; i messaggi stampati restano in italiano. Il ramo
che ha registrato la decisione cambiava solo i documenti.
- #67: deciso il 29 novembre 2026 (subito dopo «Scollega», con l'indirizzo della pagina sconosciuto, aspettare il - #67: deciso il 29 novembre 2026 (subito dopo «Scollega», con l'indirizzo della pagina sconosciuto, aspettare il
browser entro un limite, poi la pagina di accesso), non ancora fatto: oggi Febe scrive «Alberto usa il browser» e non browser entro un limite, poi la pagina di accesso), non ancora fatto: oggi Febe scrive «Alberto usa il browser» e non
apre nulla. Da fare in un ramo a parte, con la sua prova. apre nulla. Da fare in un ramo a parte, con la sua prova.
+11 -11
View File
@@ -1,16 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Febe per Windows: pubblica Febe.exe in un file solo e ne fa il programma di installazione e lo zip portabile. # Febe for Windows: publishes Febe.exe as a single file and makes the installer and the portable zip from it.
# #
# installer/costruisci.sh [versione] # installer/costruisci.sh [versione]
# #
# Gira su Linux (CI e rilascio) come su Windows con bash: serve solo il .NET SDK 10. Nessun altro programma: il # Runs on Linux (CI and release) as on Windows with bash: only the .NET SDK 10 is needed. No other program: the
# programma di installazione è nostro (src/Febe.Installer) e lo stesso progetto, compilato per il sistema che lo # installer is our own (src/Febe.Installer) and the same project, built for the system that builds it, makes the
# costruisce, fa il pacchetto, lo controlla e scrive lo zip. La versione, se non la si passa, è quella di # package, checks it and writes the zip. The version, if not given, is the one in Directory.Build.props (the tag must
# Directory.Build.props (il tag deve coincidere). # match).
# Risultato in out/: # Result in out/:
# Febe-Setup-<versione>.exe installazione per l'utente, senza permessi di amministratore # Febe-Setup-<versione>.exe per-user installation, without administrator rights
# Febe-<versione>-portabile.zip Febe.exe e LEGGIMI.txt, da copiare dove si vuole # Febe-<versione>-portabile.zip Febe.exe and LEGGIMI.txt, to copy wherever you like
# Ognuno deve restare sotto i 100 MB (limite degli allegati di Gitea). # Each must stay under 100 MB (the Gitea attachment limit).
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"
# Un file solo: niente accanto all'eseguibile. # A single file: nothing next to the executable.
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)"
# Le proprietà della pubblicazione (autosufficiente, un file solo, trimming, compressione) sono nel progetto. # The publish properties (self-contained, single file, trimming, compression) are in the project.
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
@@ -169,6 +169,10 @@ 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");