# Monday cleanup (at 4:17, Gitea server time) and by hand (Actions ▸ pulizia ▸ Esegui) of the runner's Docker daemon and # of the container registry. By hand, with «Solo prova» ticked, it lists what it would remove and removes nothing: to # be run before the first real cleanup and after every change to the script. # Every verification and release run already removes what it creates and, for everyone, the unnamed images and the # dangling build cache unused for 24 hours. Here, since 21 October 2026 (decision of Alberto: delete everything that # is no longer needed), what nobody needs any more is removed too, of any project (pulizia-docker.sh completa): # - the leftovers of the Febe CI: stopped test containers (label febe.ci.prova and name febe-prova-, # never the febe.ci.* labels a real Febe inherits from the image), local names febe-ci:, builders # febe-ci-, the febe:ci image of the old workflow; # - the leftovers of act_runner: stopped containers, volumes and networks GITEA-ACTIONS-TASK-… no container uses, # older than 90 minutes; # - the images no container uses, running or stopped, created more than 24 hours ago (from an image in use Docker # removes the extra names), and the daemon's build cache unused for 24 hours. The base images (debian:trixie, # moby/buildkit, …) are downloaded again by the first run that asks for them; # - with the REGISTRY_TOKEN secret, the registry's sha- tags beyond the 10 most recent, never main, latest or X.Y.Z, # and the CI artifacts (generic package febe-ci, artefatti.sh) created more than 14 days ago. # Never system prune, container prune, volume prune or network prune; never a container, a volume or a network that # does not belong to the CI. A test container still running is reported and the job turns red; a refusal by the # registry API is only a warning. Details in .gitea/scripts/pulizia-docker.sh and in docs/processo.md, «Pulizia». name: pulizia on: schedule: - cron: "17 4 * * 1" workflow_dispatch: inputs: prova: description: "Solo prova: elenca che cosa toglierebbe e non toglie nulla" type: boolean required: false default: false permissions: contents: read concurrency: group: pulizia cancel-in-progress: false defaults: run: shell: bash jobs: docker: runs-on: ubuntu-latest timeout-minutes: 30 steps: - name: Sorgenti env: TOKEN: ${{ gitea.token }} SERVER: ${{ gitea.server_url }} REPOSITORY: ${{ gitea.repository }} PROFONDITA: "1" run: | git config --global --add safe.directory "$PWD" git init -q . git remote add origin "$SERVER/$REPOSITORY.git" 2> /dev/null || git remote set-url origin "$SERVER/$REPOSITORY.git" GIT_CONFIG_VALUE_0="Authorization: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)" export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=http.extraHeader GIT_CONFIG_VALUE_0 profondita=() [ "$PROFONDITA" = 0 ] || profondita=(--depth "$PROFONDITA") if ! git fetch -q --no-tags "${profondita[@]}" origin "$GITHUB_SHA"; then echo "Il server non dà il commit per identificativo: prendo $GITHUB_REF con tutta la storia." git fetch -q --no-tags origin "+$GITHUB_REF:refs/remotes/origin/lavoro" fi git checkout -q --force --detach "$GITHUB_SHA" git log -1 --format='Commit %h: %s' # Gitea 28 puts the «prova» checkbox in the event as text, "true" or "false"; on Monday the event has no inputs # and the cleanup is the real one. A start through the API passes the value as it is: any other («True», «1») # 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 env: PROVA: ${{ gitea.event.inputs.prova }} REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} GITEA_API: ${{ gitea.server_url }}/api/v1 PROPRIETARIO: ${{ gitea.repository_owner }} run: | case "${PROVA:-}" in true) bash .gitea/scripts/pulizia-docker.sh completa --prova ;; "" | false) bash .gitea/scripts/pulizia-docker.sh completa ;; *) VALORE=$(printf '%s' "$PROVA" | tr -c 'A-Za-z0-9' '_' | cut -c 1-20) echo "::error::La casella «prova» vale true o false, non «$VALORE»: non tolgo nulla." exit 2 ;; esac