fix(ci): use Forgejo-supported variable for Renovate endpoint #334
No files matched your search
@@ -12,7 +12,7 @@ jobs:
|
||||
image: renovate/renovate:44.133.0
|
||||
env:
|
||||
RENOVATE_PLATFORM: gitea
|
||||
RENOVATE_ENDPOINT: ${{ vars.GITEA_API_ENDPOINT }}
|
||||
RENOVATE_ENDPOINT: ${{ vars.FORGEJO_API_ENDPOINT }}
|
||||
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
|
||||
RENOVATE_ONBOARDING: 'false'
|
||||
steps:
|
||||
|
||||
@@ -8,7 +8,7 @@ Les jobs exigent `runs-on: [ubuntu-latest, build-agent]`. Déclarer `build-agent
|
||||
|
||||
Chaque runner lit sa configuration au démarrage. Ne pas rediriger `sources.tordais.cc` vers `host-gateway` dans `container.options` : cela a empêché les checkouts. Le workflow ne publie pas de rapports comme artefacts distants : les fichiers `artifacts/` sont utilisés dans le job (par exemple pour le seuil de couverture), puis disparaissent avec celui-ci. Le run historique #442 a signalé `CreateArtifact: EHOSTUNREACH`; aucun job courant ne dépend du service artefacts pour réussir.
|
||||
|
||||
Le workflow Renovate lit l’API Gitea dans la variable d’action `GITEA_API_ENDPOINT` et le jeton du bot dans le secret `RENOVATE_TOKEN`; l’endpoint doit être l’URL HTTPS de l’API qui se termine par `/api/v1`. Avant de démarrer Renovate, il vérifie que le jeton authentifie `/user` et peut lire le dépôt `arnaud.dartois/Heimdall`. Une réponse HTTP 401/403 indique un secret manquant, invalide ou insuffisamment autorisé; le bot doit avoir lecture et écriture du dépôt pour créer des PR. Le précontrôle confirme seulement la lecture : un run qui ouvre ou actualise une PR reste nécessaire pour prouver l’accès en écriture. Le workflow ne journalise ni les jetons ni les réponses API.
|
||||
Le workflow Renovate lit l’API Forgejo dans la variable d’action `FORGEJO_API_ENDPOINT` et le jeton du bot dans le secret `RENOVATE_TOKEN`; l’endpoint doit être l’URL HTTPS de l’API qui se termine par `/api/v1`. Forgejo réserve les noms de variables commençant par `GITEA_`. Avant de démarrer Renovate, le workflow vérifie que le jeton authentifie `/user` et peut lire le dépôt `arnaud.dartois/Heimdall`. Une réponse HTTP 401/403 indique un secret manquant, invalide ou insuffisamment autorisé; le bot doit avoir lecture et écriture du dépôt pour créer des PR. Le précontrôle confirme seulement la lecture : un run qui ouvre ou actualise une PR reste nécessaire pour prouver l’accès en écriture. Le workflow ne journalise ni les jetons ni les réponses API.
|
||||
|
||||
`scripts/ci/cleanup-docker.sh` journalise l'espace et élimine avant/après les builds les anciennes images Heimdall, les volumes Trivy abandonnés, les couches de build inutilisées depuis plus de 30 minutes et les images pendantes. Il ne purge pas les volumes, réseaux ou images nommées des autres projets. Le run #194 sur `runner-odin` a récupéré 95,89 Go avant build et 7,703 Go après job ; les 1 965 tests, deux images et scans ont réussi.
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@ export function validateEndpoint(value) {
|
||||
try {
|
||||
parsed = new URL(value);
|
||||
} catch {
|
||||
throw new Error('GITEA_API_ENDPOINT must be a valid HTTPS URL ending in /api/v1.');
|
||||
throw new Error('FORGEJO_API_ENDPOINT must be a valid HTTPS URL ending in /api/v1.');
|
||||
}
|
||||
|
||||
if (parsed.protocol !== 'https:' || parsed.username || parsed.password ||
|
||||
parsed.search || parsed.hash || !parsed.pathname.replace(/\/$/, '').endsWith('/api/v1')) {
|
||||
throw new Error('GITEA_API_ENDPOINT must be a valid HTTPS URL ending in /api/v1.');
|
||||
throw new Error('FORGEJO_API_ENDPOINT must be a valid HTTPS URL ending in /api/v1.');
|
||||
}
|
||||
|
||||
return parsed.href.replace(/\/$/, '');
|
||||
@@ -38,7 +38,7 @@ export async function checkGiteaAccess(apiEndpoint, accessToken, fetchImpl = fet
|
||||
if (!response.ok) {
|
||||
const detail = response.status === 401 || response.status === 403
|
||||
? 'Check that RENOVATE_TOKEN is active and has repository read and write access.'
|
||||
: 'Check GITEA_API_ENDPOINT and the Gitea API availability.';
|
||||
: 'Check FORGEJO_API_ENDPOINT and the Forgejo API availability.';
|
||||
throw new Error(`Gitea API preflight failed with HTTP ${response.status}. ${detail}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { checkGiteaAccess, validateEndpoint } from './renovate-preflight.mjs';
|
||||
|
||||
test('accepts an HTTPS Gitea API endpoint and trims its trailing slash', () => {
|
||||
test('accepts an HTTPS Forgejo API endpoint and trims its trailing slash', () => {
|
||||
assert.equal(validateEndpoint('https://forge.example/api/v1/'), 'https://forge.example/api/v1');
|
||||
});
|
||||
|
||||
test('rejects non-HTTPS, malformed, and non-API endpoints', () => {
|
||||
for (const value of ['http://forge.example/api/v1', 'https://forge.example/', 'not a URL']) {
|
||||
assert.throws(() => validateEndpoint(value), /HTTPS URL ending in \/api\/v1/);
|
||||
assert.throws(() => validateEndpoint(value), /FORGEJO_API_ENDPOINT.*HTTPS URL ending in \/api\/v1/);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ For installer, Compose, image, and documentation work that can proceed independe
|
||||
- Optional Agent public-IP discovery has no built-in provider hostname; configure `Agent:PublicIpResolverUrl` with an HTTPS endpoint or leave it empty to report no public IP. Validate the URL before creating the HTTP client.
|
||||
- Server-side API calls from Blazor circuits must prefer the process's Kestrel loopback binding over a retained browser `Host`; a public reverse-proxy host may not be reachable from inside the Central container. Normalize wildcard Kestrel binds (`0.0.0.0`, `[::]`, and `+`) to loopback while preserving the bound port.
|
||||
- Installer scripts should embed the official Heimdall source base as their standalone default and allow `HEIMDALL_SOURCE_BASE_URL` to override it for reviewed revisions or mirrors. Use it only for Heimdall-owned source assets; keep vendor dependencies on their official distribution sources.
|
||||
- Configure the Gitea API endpoint used by Renovate through the Actions variable `GITEA_API_ENDPOINT`; do not embed the forge hostname in workflow YAML. Track credential/run validation in its Gitea issue.
|
||||
- Configure the Forgejo API endpoint used by Renovate through the Actions variable `FORGEJO_API_ENDPOINT`; Forgejo reserves variable names beginning with `GITEA_`. Do not embed the forge hostname in workflow YAML. Track credential/run validation in its Gitea issue.
|
||||
- Keep Compose network names project-scoped by omitting a fixed `networks.*.name`, especially for disposable validation projects.
|
||||
|
||||
## Deployment behavior
|
||||
|
||||
@@ -7,10 +7,11 @@ description: Diagnose and maintain Renovate dependency updates through Gitea Act
|
||||
|
||||
Use this skill for `.gitea/workflows/renovate.yml`, `renovate.json`, or dependency-update failures.
|
||||
|
||||
- Renovate runs only on its weekly schedule or manual dispatch, on `[ubuntu-latest, build-agent]`, in the pinned Renovate container. Keep `RENOVATE_TOKEN` in Actions secrets and `GITEA_API_ENDPOINT` in Actions variables; do not add either credential or forge hostname to repository files.
|
||||
- The endpoint must be the HTTPS Gitea API root ending in `/api/v1`. The workflow checks that the token can call `/user` and read `arnaud.dartois/Heimdall` before Renovate starts. Preflight logs only response status and a safe diagnosis; never print request headers, response bodies, or token values.
|
||||
- Renovate runs only on its weekly schedule or manual dispatch, on `[ubuntu-latest, build-agent]`, in the pinned Renovate container. Keep `RENOVATE_TOKEN` in Actions secrets and `FORGEJO_API_ENDPOINT` in Actions variables; do not add either credential or forge hostname to repository files. Forgejo reserves variable names beginning with `GITEA_` and rejects them.
|
||||
- The endpoint must be the HTTPS Forgejo API root ending in `/api/v1`. The workflow checks that the token can call `/user` and read `arnaud.dartois/Heimdall` before Renovate starts. Preflight logs only response status and a safe diagnosis; never print request headers, response bodies, or token values.
|
||||
- HTTP 401/403 means the secret is missing, expired, revoked, or lacks repository access. Configure a bot token with repository read and write access so Renovate can open pull requests. Read preflight success does not prove write access; confirm a successful run that opens or updates a PR.
|
||||
- Use `node --test scripts/ci/renovate-preflight.test.mjs` to test endpoint validation and sanitized auth failures locally. Do not run Renovate locally with production credentials.
|
||||
- Run `bash skills/renovate-automation/acceptance.sh` after changing the preflight or its endpoint wiring. It exercises valid and rejected synthetic credentials over an isolated HTTPS mock in Compose; the test container trusts only the generated self-signed certificate for its local fixture.
|
||||
- For a changed preflight/deployment path, validate a disposable Compose project with a mock HTTPS API, a synthetic token, no host-published ports or persistent data, and both accepted and rejected credentials. Install an EXIT cleanup trap before startup, preserve the test exit status, remove that exact project, and confirm it leaves no containers, volumes, or networks; if pulling the Node base image is unavailable, record the blocker and rerun the recipe when registry access is restored.
|
||||
- The mock-preflight recipe uses a shared upstream Node image and creates no local images. Retain that base image. If the recipe adds a locally built mock/helper/application image, record its unique tag and remove/verify only that exact tag in the same cleanup trap, including on failure. Do not use `--rmi all` or broad prune commands.
|
||||
- For operational changes, update the Renovate Gitea issue with the workflow run and the remaining remote-secret validation. Never claim the bot works based only on configuration presence.
|
||||
Executable
+95
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
project="heimdall-renovate-acceptance-$(date -u +%Y%m%d%H%M%S)-$RANDOM"
|
||||
repo_root=$(git rev-parse --show-toplevel)
|
||||
temp_dir=$(mktemp -d "${TMPDIR:-/tmp}/${project}.XXXXXX")
|
||||
compose_file="$temp_dir/compose.yml"
|
||||
runner_file="$temp_dir/acceptance.mjs"
|
||||
cert_file="$temp_dir/mock.crt"
|
||||
key_file="$temp_dir/mock.key"
|
||||
local_image_tags=()
|
||||
cleanup() {
|
||||
status=$?
|
||||
trap - EXIT
|
||||
cleanup_failed=0
|
||||
docker compose -p "$project" -f "$compose_file" down --volumes --remove-orphans || cleanup_failed=1
|
||||
containers=$(docker ps -aq --filter "label=com.docker.compose.project=$project") || cleanup_failed=1
|
||||
volumes=$(docker volume ls -q --filter "label=com.docker.compose.project=$project") || cleanup_failed=1
|
||||
networks=$(docker network ls -q --filter "label=com.docker.compose.project=$project") || cleanup_failed=1
|
||||
if [[ -n "$containers" || -n "$volumes" || -n "$networks" ]]; then cleanup_failed=1; fi
|
||||
for tag in "${local_image_tags[@]}"; do
|
||||
docker image rm "$tag" >/dev/null 2>&1 || true
|
||||
docker image inspect "$tag" >/dev/null 2>&1 && cleanup_failed=1
|
||||
done
|
||||
rm -f -- "$compose_file" "$runner_file" "$cert_file" "$key_file" || cleanup_failed=1
|
||||
rmdir -- "$temp_dir" || cleanup_failed=1
|
||||
if (( cleanup_failed )); then
|
||||
echo "Disposable Compose cleanup failed for $project" >&2
|
||||
status=1
|
||||
else
|
||||
echo "Verified no project containers, volumes, or networks; no local images built ($project)"
|
||||
fi
|
||||
exit "$status"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
openssl req -x509 -newkey rsa:2048 -nodes -keyout "$key_file" -out "$cert_file" \
|
||||
-subj "/CN=localhost" -addext "subjectAltName=IP:127.0.0.1" -days 1 >/dev/null 2>&1
|
||||
cat > "$runner_file" <<'NODE'
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { createServer } from 'node:https';
|
||||
import { checkGiteaAccess } from '/workspace/scripts/ci/renovate-preflight.mjs';
|
||||
|
||||
const requests = [];
|
||||
const server = createServer({
|
||||
key: readFileSync('/acceptance/mock.key'),
|
||||
cert: readFileSync('/acceptance/mock.crt'),
|
||||
}, (request, response) => {
|
||||
requests.push({ path: request.url, authorization: request.headers.authorization });
|
||||
if (request.headers.authorization !== 'token synthetic-valid') {
|
||||
response.writeHead(401, { 'content-type': 'application/json' });
|
||||
response.end('{"message":"credential rejected"}');
|
||||
return;
|
||||
}
|
||||
response.writeHead(200, { 'content-type': 'application/json' });
|
||||
response.end('{}');
|
||||
});
|
||||
|
||||
await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));
|
||||
try {
|
||||
const endpoint = `https://127.0.0.1:${server.address().port}/api/v1`;
|
||||
await checkGiteaAccess(endpoint, 'synthetic-valid');
|
||||
await assert.rejects(
|
||||
checkGiteaAccess(endpoint, 'synthetic-invalid'),
|
||||
error => error.message.includes('HTTP 401') &&
|
||||
error.message.includes('RENOVATE_TOKEN') &&
|
||||
!error.message.includes('synthetic-invalid') &&
|
||||
!error.message.includes('credential rejected'),
|
||||
);
|
||||
assert.deepEqual(requests.map(({ path }) => path), [
|
||||
'/api/v1/user', '/api/v1/repos/arnaud.dartois/Heimdall',
|
||||
'/api/v1/user',
|
||||
]);
|
||||
assert.ok(requests.every(({ authorization }) =>
|
||||
['token synthetic-valid', 'token synthetic-invalid'].includes(authorization)));
|
||||
console.log('HTTPS mock preflight accepted valid and rejected invalid synthetic credentials without exposing response details.');
|
||||
} finally {
|
||||
await new Promise((resolve, reject) => server.close(error => error ? reject(error) : resolve()));
|
||||
}
|
||||
NODE
|
||||
cat > "$compose_file" <<EOF
|
||||
services:
|
||||
acceptance:
|
||||
image: node:22-alpine
|
||||
working_dir: /workspace
|
||||
volumes:
|
||||
- "$repo_root:/workspace:ro"
|
||||
- "$temp_dir:/acceptance:ro"
|
||||
environment:
|
||||
NODE_EXTRA_CA_CERTS: /acceptance/mock.crt
|
||||
command: ["node", "/acceptance/acceptance.mjs"]
|
||||
EOF
|
||||
|
||||
docker compose -p "$project" -f "$compose_file" config --quiet
|
||||
docker compose -p "$project" -f "$compose_file" run --rm acceptance
|
||||
Reference in new issue
Block a user