CI senza azioni e senza Node, solo comandi scritti in casa (C6, 3/4)
Per la decisione di Alberto del 18 novembre 2026 (niente componenti esterni) i flussi di verifica, rilascio e pulizia non usano più azioni JavaScript, che vogliono Node: - sorgenti con git init/fetch e il gettone del lavoro, passato a git solo nell'ambiente del passo, mai scritto nella configurazione; - SDK .NET con .gitea/scripts/dotnet.sh, dai metadati di Microsoft e verificato con lo SHA-512 prima di installarlo nella cache degli strumenti del runner; - builder buildx creato da costruisci-immagine.sh builder; - artefatti nel pacchetto generico febe-ci del registro di Gitea (artefatti.sh, con REGISTRY_TOKEN), tolti dalla pulizia del lunedì dopo 14 giorni; la release ricostruisce installatore e zip invece di riceverli da un altro lavoro; - JSON letto con un lettore in awk POSIX (json.awk) per i controlli e per la scelta delle versioni del registro, al posto di versioni-registro.js; - contenitore delle prove debian:trixie al posto di node:24-trixie; - la prova della pagina di accesso gira in Chromium invece che in Node. controlli.sh rifiuta ora un flusso con uses:, tabulazioni o rientri dispari, e le prove nuove controllano l'assenza di Node, il passo dei sorgenti uguale in ogni lavoro, l'SDK prima di ogni dotnet, la scelta dell'SDK, il caricamento degli artefatti con un curl finto e la scadenza dei vecchi. Nessuna esecuzione vera di Gitea Actions: ciò che resta da vedere è in docs/processo.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7a54f1a460
commit
a4ad8a8bc4
27 files changed
+1763
-396
No files matched your search
@@ -1,9 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# A fake curl for PipelineTests: the registry part of .gitea/scripts/pulizia-docker.sh talks to the packages API of
|
||||
# Gitea 28 through it. No network. It knows only the options the cleanup uses and answers like Gitea:
|
||||
# GET <base>?page=<n>&limit=50 the page $FAKE_CURL_WORLD/page-<n>.json, or [] after the last one (200)
|
||||
# DELETE <base>/<version> 204, and the version is written to $FAKE_CURL_WORLD/deleted
|
||||
# where <base> is the content of $FAKE_CURL_WORLD/base (…/api/v1/packages/<owner>/container/febe). Without the header
|
||||
# A fake curl for PipelineTests: the registry part of .gitea/scripts/pulizia-docker.sh and .gitea/scripts/artefatti.sh
|
||||
# talk to the packages API of Gitea 28 through it. No network. It knows only the options those scripts use and answers
|
||||
# like Gitea:
|
||||
# GET <base>?page=<n>&limit=50 the page $FAKE_CURL_WORLD/page-<n>.json, or [] after the last one (200)
|
||||
# DELETE <base>/<version> 204, and the version is written to $FAKE_CURL_WORLD/deleted
|
||||
# GET <ci>?page=<n>&limit=50 the page $FAKE_CURL_WORLD/ci-page-<n>.json, or [] after the last one (200)
|
||||
# DELETE <ci>/<version> 204, and the version is written to $FAKE_CURL_WORLD/deleted-ci
|
||||
# PUT <upload>/<version>/<file> with --upload-file: 201, the file copied to $FAKE_CURL_WORLD/uploaded/<version>/;
|
||||
# 409 if that file is already there (as Gitea answers a second upload)
|
||||
# DELETE <upload>/<version>/<file> 204, and the uploaded file goes
|
||||
# where <base> is the content of $FAKE_CURL_WORLD/base (…/api/v1/packages/<owner>/container/febe), <ci> of
|
||||
# $FAKE_CURL_WORLD/base-ci (…/api/v1/packages/<owner>/generic/febe-ci) and <upload> of $FAKE_CURL_WORLD/upload
|
||||
# (…/api/packages/<owner>/generic/febe-ci); a base whose file is missing is unknown. Without the header
|
||||
# «Authorization: token <content of $FAKE_CURL_WORLD/token>» it answers 401; with $FAKE_CURL_WORLD/refuse it answers
|
||||
# 403 to every call; any other address is 404. Every call goes to $FAKE_CURL_WORLD/calls as «METHOD URL», never with
|
||||
# its headers. Any other option is an error (exit 3).
|
||||
@@ -11,7 +19,7 @@ set -uo pipefail
|
||||
|
||||
world="${FAKE_CURL_WORLD:?}"
|
||||
token="$(cat "$world/token" 2> /dev/null)"
|
||||
method=GET output="" write="" url="" authorized=0
|
||||
method=GET output="" write="" url="" authorized=0 upload=""
|
||||
while (($#)); do
|
||||
case "$1" in
|
||||
-s | -S | -sS) ;;
|
||||
@@ -20,6 +28,7 @@ while (($#)); do
|
||||
-H) [[ -n "$token" && "$2" == "Authorization: token $token" ]] && authorized=1; shift ;;
|
||||
-o) output="$2"; shift ;;
|
||||
-w) write="$2"; shift ;;
|
||||
--upload-file) upload="$2"; shift ;;
|
||||
-*) echo "fake curl: unexpected option $1" >&2; exit 3 ;;
|
||||
*)
|
||||
[[ -z "$url" ]] || { echo "fake curl: a second address $1" >&2; exit 3; }
|
||||
@@ -30,6 +39,7 @@ while (($#)); do
|
||||
done
|
||||
printf '%s %s\n' "$method" "$url" >> "$world/calls"
|
||||
[[ -z "$write" || "$write" == '%{http_code}' ]] || { echo "fake curl: unexpected -w $write" >&2; exit 3; }
|
||||
[[ -z "$upload" || "$method" == PUT ]] || { echo "fake curl: --upload-file without -X PUT" >&2; exit 3; }
|
||||
|
||||
answer() {
|
||||
local code="$1" body="${2:-}"
|
||||
@@ -45,19 +55,44 @@ answer() {
|
||||
[[ -f "$world/refuse" ]] && answer 403 '{"message":"token does not have at least one of required scope(s): [write:package]"}'
|
||||
((authorized)) || answer 401 '{"message":"token is required"}'
|
||||
|
||||
base="$(cat "$world/base")"
|
||||
known() { [[ -f "$world/$1" ]] && cat "$world/$1"; }
|
||||
base="$(known base)" || base="//nessuna-base"
|
||||
ci="$(known base-ci)" || ci="//nessuna-base"
|
||||
send="$(known upload)" || send="//nessuna-base"
|
||||
|
||||
page() {
|
||||
local prefix="$1" number="${url#*\?page=}"
|
||||
number="${number%%&*}"
|
||||
if [[ -f "$world/${prefix}page-$number.json" ]]; then
|
||||
answer 200 "$(cat "$world/${prefix}page-$number.json")"
|
||||
fi
|
||||
answer 200 "[]"
|
||||
}
|
||||
|
||||
case "$method $url" in
|
||||
"GET $base?page="*"&limit=50")
|
||||
page="${url#"$base?page="}"
|
||||
page="${page%%&*}"
|
||||
if [[ -f "$world/page-$page.json" ]]; then
|
||||
answer 200 "$(cat "$world/page-$page.json")"
|
||||
fi
|
||||
answer 200 "[]"
|
||||
;;
|
||||
"GET $base?page="*"&limit=50") page "" ;;
|
||||
"DELETE $base/"*)
|
||||
echo "${url#"$base/"}" >> "$world/deleted"
|
||||
answer 204
|
||||
;;
|
||||
"GET $ci?page="*"&limit=50") page "ci-" ;;
|
||||
"DELETE $ci/"*)
|
||||
echo "${url#"$ci/"}" >> "$world/deleted-ci"
|
||||
answer 204
|
||||
;;
|
||||
"PUT $send/"*/*)
|
||||
[[ -f "$upload" ]] || { echo "fake curl: no file to upload: $upload" >&2; exit 3; }
|
||||
target="$world/uploaded/${url#"$send/"}"
|
||||
[[ -f "$target" ]] && answer 409 '{"message":"package file already exists"}'
|
||||
mkdir -p "$(dirname "$target")"
|
||||
cp "$upload" "$target"
|
||||
answer 201
|
||||
;;
|
||||
"DELETE $send/"*/*)
|
||||
target="$world/uploaded/${url#"$send/"}"
|
||||
[[ -f "$target" ]] || answer 404 '{"message":"The target couldn'"'"'t be found."}'
|
||||
rm -f "$target"
|
||||
answer 204
|
||||
;;
|
||||
*) answer 404 '{"message":"The target couldn'"'"'t be found."}' ;;
|
||||
esac
|
||||
Reference in new issue
Block a user