Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90ef58a8cb | ||
|
|
06e1d24977 | ||
|
|
7ffc6d73b6 | ||
|
|
1860e88156 | ||
|
|
e0c69c1b77 | ||
|
|
c00db55f98 | ||
|
|
700b1030fc | ||
|
|
5f7027bd86 | ||
|
|
e29927bef7 | ||
|
|
06508be0e0 | ||
|
|
8f4eb24e77 | ||
|
|
6dfa2c8aa6 | ||
|
|
8b7d9bce81 | ||
|
|
723c38d2e3 |
No files matched your search
@@ -18,8 +18,8 @@ concurrency:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
# Registry host + repository path. The path segment is the Gitea
|
# Registry host + repository path. The path segment is the Gitea
|
||||||
# organisation, so k3s pulls registry.noelsabia.dev/cv_website/nuxt:<tag>.
|
# organisation, so k3s pulls git.noelsabia.dev/cv_website/nuxt:<tag>.
|
||||||
IMAGE: registry.noelsabia.dev/cv_website/nuxt
|
IMAGE: git.noelsabia.dev/cv_website/nuxt
|
||||||
APP_DIR: .
|
APP_DIR: .
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -125,7 +125,7 @@ jobs:
|
|||||||
[ -n "$REGISTRY_USERNAME" ] || { echo "::error::secret REGISTRY_USERNAME is empty"; exit 1; }
|
[ -n "$REGISTRY_USERNAME" ] || { echo "::error::secret REGISTRY_USERNAME is empty"; exit 1; }
|
||||||
[ -n "$REGISTRY_PASSWORD" ] || { echo "::error::secret REGISTRY_PASSWORD is empty"; exit 1; }
|
[ -n "$REGISTRY_PASSWORD" ] || { echo "::error::secret REGISTRY_PASSWORD is empty"; exit 1; }
|
||||||
printf '%s' "$REGISTRY_PASSWORD" \
|
printf '%s' "$REGISTRY_PASSWORD" \
|
||||||
| docker login registry.noelsabia.dev -u "$REGISTRY_USERNAME" --password-stdin
|
| docker login git.noelsabia.dev -u "$REGISTRY_USERNAME" --password-stdin
|
||||||
|
|
||||||
- name: Refuse to overwrite a published version
|
- name: Refuse to overwrite a published version
|
||||||
env:
|
env:
|
||||||
@@ -143,7 +143,7 @@ jobs:
|
|||||||
# Debian 20.10 client fails that command on OCI indexes with
|
# Debian 20.10 client fails that command on OCI indexes with
|
||||||
# "unsupported manifest media type and no default available",
|
# "unsupported manifest media type and no default available",
|
||||||
# for existing and missing tags alike.
|
# for existing and missing tags alike.
|
||||||
url="https://registry.noelsabia.dev/v2/cv_website/nuxt/manifests/${VERSION}"
|
url="https://git.noelsabia.dev/v2/cv_website/nuxt/manifests/${VERSION}"
|
||||||
code=$(curl -s -o /dev/null -w '%{http_code}' \
|
code=$(curl -s -o /dev/null -w '%{http_code}' \
|
||||||
-u "${REGISTRY_USERNAME}:${REGISTRY_PASSWORD}" \
|
-u "${REGISTRY_USERNAME}:${REGISTRY_PASSWORD}" \
|
||||||
-H 'Accept: application/vnd.docker.distribution.manifest.v2+json' \
|
-H 'Accept: application/vnd.docker.distribution.manifest.v2+json' \
|
||||||
|
|||||||
@@ -17,6 +17,12 @@ jobs:
|
|||||||
release-please:
|
release-please:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
# The reconcile step below runs a file from this repository. The
|
||||||
|
# release-please action clones into its own temp directory and does not
|
||||||
|
# check the workspace out, so without this step the job fails with
|
||||||
|
# "Cannot find module .../scripts/reconcile-release-please.mjs".
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
# release-please marks its release PR with `autorelease: pending` and
|
# release-please marks its release PR with `autorelease: pending` and
|
||||||
# later finds the merged PR by that label. Gitea's label API resolves
|
# later finds the merged PR by that label. Gitea's label API resolves
|
||||||
# names and *silently ignores unknown ones* (GetLabelIDsInRepoByNames
|
# names and *silently ignores unknown ones* (GetLabelIDsInRepoByNames
|
||||||
@@ -49,6 +55,21 @@ jobs:
|
|||||||
echo "created label: ${name}"
|
echo "created label: ${name}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# The label fix above is not retroactive. PR #22 was merged with
|
||||||
|
# `autorelease: pending` but its head branch had already been deleted,
|
||||||
|
# so the action reports `Bad branch name: refs/pull/22/head`, creates no
|
||||||
|
# tag and leaves the label behind. Every later run then aborts with
|
||||||
|
# "There are untagged, merged release PRs outstanding" and never opens a
|
||||||
|
# new release PR - green, no tags. This step reconciles that state before
|
||||||
|
# the action runs: mark a pending PR tagged when its tag already exists,
|
||||||
|
# or recreate the tag when the head branch is gone and release-please
|
||||||
|
# therefore cannot. See scripts/reconcile-release-please.mjs and
|
||||||
|
# OKF_Nuxt/decisions/release-engineering.md.
|
||||||
|
- name: Reconcile stale release-please state
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.PR_GITEA_TOKEN }}
|
||||||
|
run: node scripts/reconcile-release-please.mjs
|
||||||
|
|
||||||
- uses: joaquinjsb/gitea-release-please-action@v4
|
- uses: joaquinjsb/gitea-release-please-action@v4
|
||||||
with:
|
with:
|
||||||
# One well-scoped token for all workflow API work (see
|
# One well-scoped token for all workflow API work (see
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ name: Renovate
|
|||||||
# Manual setup: create a bot account with its full name and email set, give
|
# Manual setup: create a bot account with its full name and email set, give
|
||||||
# it write access to this repository, and store a token with
|
# it write access to this repository, and store a token with
|
||||||
# repository read/write, issue read/write, user read and organization read
|
# repository read/write, issue read/write, user read and organization read
|
||||||
# as the RENOVATE_TOKEN Actions secret.
|
# as the RENOVATE_TOKEN Actions secret. Release notes also need a github.com
|
||||||
|
# token (any account, read-only, no scopes for public repositories) as the
|
||||||
|
# RENOVATE_GITHUB_COM_TOKEN secret.
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
# Daily at 04:00 UTC. Gitea only schedules workflows that exist on the
|
# Daily at 04:00 UTC. Gitea only schedules workflows that exist on the
|
||||||
@@ -35,6 +37,10 @@ jobs:
|
|||||||
# default branch through this endpoint.
|
# default branch through this endpoint.
|
||||||
RENOVATE_ENDPOINT: https://git.noelsabia.dev/api/v1
|
RENOVATE_ENDPOINT: https://git.noelsabia.dev/api/v1
|
||||||
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
|
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
|
||||||
|
# github.com is only used to fetch release notes and other public
|
||||||
|
# metadata. Anonymous requests are rate-limited, which is why the
|
||||||
|
# PR body warned that release notes were skipped.
|
||||||
|
RENOVATE_GITHUB_COM_TOKEN: ${{ secrets.RENOVATE_GITHUB_COM_TOKEN }}
|
||||||
# This workflow lives in the repository it updates, so scope the bot
|
# This workflow lives in the repository it updates, so scope the bot
|
||||||
# to it instead of every repository its account can see.
|
# to it instead of every repository its account can see.
|
||||||
RENOVATE_REPOSITORIES: CV_Website/CV_Site_Nuxt
|
RENOVATE_REPOSITORIES: CV_Website/CV_Site_Nuxt
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* [Vulnerability audit policy](vulnerability-audit-policy.md) - Blocking audit, reviewed ignore-list for unfixable advisories, and the pnpm-11 settings home.
|
* [Vulnerability audit policy](vulnerability-audit-policy.md) - Blocking audit, reviewed ignore-list for unfixable advisories, and the pnpm-11 settings home.
|
||||||
* [Release engineering](release-engineering.md) - release-please in manifest mode, conventional commits as input, message format enforced at commit time.
|
* [Release engineering](release-engineering.md) - release-please in manifest mode, conventional commits as input, message format enforced at commit time.
|
||||||
* [Snyk paused and secrets policy](snyk-paused-and-secrets-policy.md) - Why the job is skipped rather than deleted, and the token scopes every workflow secret needs.
|
* [Snyk paused and secrets policy](snyk-paused-and-secrets-policy.md) - Why the job is skipped rather than deleted, and the token scopes every workflow secret needs.
|
||||||
* [Publishing images to the own registry](registry-publishing.md) - A release tag builds and pushes to registry.noelsabia.dev; main pushes do not build.
|
* [Publishing images to the own registry](registry-publishing.md) - A release tag builds and pushes to git.noelsabia.dev; main pushes do not build.
|
||||||
* [Dev container shape](dev-container-shape.md) - The source is bind-mounted into a container that already holds the dependencies, and the dev server runs as the image's `node` user.
|
* [Dev container shape](dev-container-shape.md) - The source is bind-mounted into a container that already holds the dependencies, and the dev server runs as the image's `node` user.
|
||||||
* [Build layer order](build-layer-order.md) - Why the manifests are copied before the source, and what invalidates what.
|
* [Build layer order](build-layer-order.md) - Why the manifests are copied before the source, and what invalidates what.
|
||||||
* [Build context filter](build-context-filter.md) - What `.dockerignore` may exclude, and the one thing it must never exclude.
|
* [Build context filter](build-context-filter.md) - What `.dockerignore` may exclude, and the one thing it must never exclude.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
type: Decision
|
type: Decision
|
||||||
title: Publishing images to the own registry
|
title: Publishing images to the own registry
|
||||||
description: A release tag builds the production image and pushes it to registry.noelsabia.dev, because that is the only way Kubernetes can pull it.
|
description: A release tag builds the production image and pushes it to git.noelsabia.dev, because that is the only way Kubernetes can pull it.
|
||||||
tags: [decision, ci, docker, registry, gitea-actions]
|
tags: [decision, ci, docker, registry, gitea-actions]
|
||||||
status: draft
|
status: draft
|
||||||
generated: { by: opencode-go/deepseek-v4.1-flash, at: 2026-10-24T00:00:00Z }
|
generated: { by: opencode-go/deepseek-v4.1-flash, at: 2026-10-24T00:00:00Z }
|
||||||
@@ -20,13 +20,36 @@ sources:
|
|||||||
|
|
||||||
# Decision
|
# Decision
|
||||||
|
|
||||||
|
**The registry is Gitea's own, served on the Gitea host.** Gitea ships a
|
||||||
|
built-in container registry per owner/organisation
|
||||||
|
([docs.gitea.com - container](https://docs.gitea.com/usage/packages/container/)).
|
||||||
|
The endpoint is the Gitea hostname itself - `git.noelsabia.dev` - and the
|
||||||
|
`/cv_website/` path segment is the Gitea organisation; images live under
|
||||||
|
the package of the repository that pushed them:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker login git.noelsabia.dev
|
||||||
|
git.noelsabia.dev/cv_website/nuxt:<tag>
|
||||||
|
```
|
||||||
|
|
||||||
|
There is nothing to stand up and nothing to reinvent: no separate
|
||||||
|
Registry/Harbor deployment, no extra hostname, no extra certificate.
|
||||||
|
TLS and auth are the ones Gitea already serves. The publishing workflow
|
||||||
|
exists only to automate pushes to this built-in registry.
|
||||||
|
|
||||||
|
**Corrected 2026-10-31:** `registry.noelsabia.dev` was a separate
|
||||||
|
hostname set up before this was known. It is not needed and is being
|
||||||
|
removed on the server side; this repository now uses
|
||||||
|
`git.noelsabia.dev` everywhere. Any leftover `registry.noelsabia.dev`
|
||||||
|
reference is a bug.
|
||||||
|
|
||||||
`.gitea/workflows/publish-image.yml` builds `Dockerfile` and pushes the
|
`.gitea/workflows/publish-image.yml` builds `Dockerfile` and pushes the
|
||||||
result to the own registry:
|
result to the own registry:
|
||||||
|
|
||||||
```
|
```
|
||||||
registry.noelsabia.dev/cv_website/nuxt:v1.2.3
|
git.noelsabia.dev/cv_website/nuxt:v1.2.3
|
||||||
registry.noelsabia.dev/cv_website/nuxt:sha-<12-char-sha>
|
git.noelsabia.dev/cv_website/nuxt:sha-<12-char-sha>
|
||||||
registry.noelsabia.dev/cv_website/nuxt:latest # newest release only
|
git.noelsabia.dev/cv_website/nuxt:latest # newest release only
|
||||||
```
|
```
|
||||||
|
|
||||||
**Trigger is the release tag, not the main push.** release-please creates
|
**Trigger is the release tag, not the main push.** release-please creates
|
||||||
@@ -103,7 +126,7 @@ run.
|
|||||||
|
|
||||||
| Gitea secret | Use |
|
| Gitea secret | Use |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `REGISTRY_USERNAME` | basic-auth user for `docker login registry.noelsabia.dev` |
|
| `REGISTRY_USERNAME` | basic-auth user for `docker login git.noelsabia.dev` |
|
||||||
| `REGISTRY_PASSWORD` | basic-auth password (or token) for the same login |
|
| `REGISTRY_PASSWORD` | basic-auth password (or token) for the same login |
|
||||||
|
|
||||||
Both are repo secrets. The login uses `--password-stdin` so the value never
|
Both are repo secrets. The login uses `--password-stdin` so the value never
|
||||||
@@ -117,7 +140,7 @@ appears in the process list or the log.
|
|||||||
forever; without the socket it fails at `Check daemon access`.
|
forever; without the socket it fails at `Check daemon access`.
|
||||||
3. `pr-checker.yml` still runs on a label whose runner has no socket.
|
3. `pr-checker.yml` still runs on a label whose runner has no socket.
|
||||||
4. Namespace `cv` has an `imagePullSecret` for the same credentials.
|
4. Namespace `cv` has an `imagePullSecret` for the same credentials.
|
||||||
5. `registry.noelsabia.dev` answers over HTTPS.
|
5. `git.noelsabia.dev` answers over HTTPS.
|
||||||
|
|
||||||
# Guards in the workflow
|
# Guards in the workflow
|
||||||
|
|
||||||
@@ -153,7 +176,7 @@ appears in the process list or the log.
|
|||||||
* That the smoke test passes on arm64. The same script was run against an
|
* That the smoke test passes on arm64. The same script was run against an
|
||||||
x86_64 build of the merged tree and answered 2xx; the arm64 run is the
|
x86_64 build of the merged tree and answered 2xx; the arm64 run is the
|
||||||
first release.
|
first release.
|
||||||
* That `registry.noelsabia.dev` is reachable over HTTPS from the runner.
|
* That `git.noelsabia.dev` is reachable over HTTPS from the runner.
|
||||||
A plain-HTTP endpoint fails `docker login` with `server gave HTTP
|
A plain-HTTP endpoint fails `docker login` with `server gave HTTP
|
||||||
response to HTTPS client` and needs `insecure-registries` on the daemon
|
response to HTTPS client` and needs `insecure-registries` on the daemon
|
||||||
plus `registries.yaml` on k3s.
|
plus `registries.yaml` on k3s.
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ sources:
|
|||||||
- id: workflow
|
- id: workflow
|
||||||
resource: .gitea/workflows/release-please.yml
|
resource: .gitea/workflows/release-please.yml
|
||||||
title: release-please workflow
|
title: release-please workflow
|
||||||
|
- id: reconcile
|
||||||
|
resource: scripts/reconcile-release-please.mjs
|
||||||
|
title: release-please state reconciliation
|
||||||
---
|
---
|
||||||
|
|
||||||
# Decision
|
# Decision
|
||||||
@@ -97,6 +100,58 @@ confirmed by comparison, not inference: while `fix/release_please` still
|
|||||||
existed, PR #23 reported `head.ref = fix/release_please`; every PR whose
|
existed, PR #23 reported `head.ref = fix/release_please`; every PR whose
|
||||||
branch was gone reported `refs/pull/<n>/head`.
|
branch was gone reported `refs/pull/<n>/head`.
|
||||||
|
|
||||||
|
# A pending label outlives the branch and blocks every later release (2026-10-31)
|
||||||
|
|
||||||
|
Flipping `default_delete_branch_after_merge` to `false` only protects
|
||||||
|
branches deleted *after* the change. PR #22's branch was already gone, so
|
||||||
|
its `head.ref` stayed `refs/pull/22/head` and its `autorelease: pending`
|
||||||
|
label stayed attached. Run 143 (task 475, 2026-10-27, the run immediately
|
||||||
|
after #22 merged) shows the full deadlock:
|
||||||
|
|
||||||
|
```
|
||||||
|
❯ Found pull request #22: 'chore: release main'
|
||||||
|
✖ Bad branch name: refs/pull/22/head
|
||||||
|
...
|
||||||
|
✔ Building candidate release pull request for path: .
|
||||||
|
❯ Found pull request #22: 'chore: release main'
|
||||||
|
⚠ There are untagged, merged release PRs outstanding - aborting
|
||||||
|
::set-output:: prs_created=false
|
||||||
|
::set-output:: releases_created=false
|
||||||
|
```
|
||||||
|
|
||||||
|
The first block fails the tagging phase. The second finds the same
|
||||||
|
still-pending PR and aborts the propose phase, so no new release PR is
|
||||||
|
even opened. Every later run (145, 148, 151, 153, 162, 164, 167) has the
|
||||||
|
same shape. The hand-created `v1.4.0` tag restores the baseline (`found:
|
||||||
|
v1.4.0`) but does not clear the label, so it does not break the
|
||||||
|
deadlock. This is the current reason the pipeline is still healthy-looking
|
||||||
|
and tagless.
|
||||||
|
|
||||||
|
The workflow now reconciles that state before the action runs
|
||||||
|
(`scripts/reconcile-release-please.mjs`):
|
||||||
|
|
||||||
|
* merged + `autorelease: pending` + a tag already at the merge commit ->
|
||||||
|
replace the label with `autorelease: tagged`;
|
||||||
|
* merged + `autorelease: pending` + head branch gone + no tag -> create
|
||||||
|
the tag from the version recorded in the manifest at the merge commit
|
||||||
|
(the exact tag release-please would have made), then swap the label;
|
||||||
|
* merged + `autorelease: pending` + head branch still present -> leave
|
||||||
|
it; release-please tags it in the same run.
|
||||||
|
|
||||||
|
The step is idempotent and runs on every push to `main` and every manual
|
||||||
|
dispatch, so a deleted branch cannot silently poison the release pipeline
|
||||||
|
again. #20 and #21 are not labelled pending, so they do not block; their
|
||||||
|
tags remain the one-time manual recovery in the table below.
|
||||||
|
|
||||||
|
Two details keep the reconciliation from suppressing a real release:
|
||||||
|
|
||||||
|
* pending PRs are fetched through the `autorelease: pending` label filter,
|
||||||
|
not by paging every closed PR, so concurrent PR closes cannot shift a
|
||||||
|
page and hide one;
|
||||||
|
* a tag at the merge commit counts only when its name is exactly
|
||||||
|
`v<manifest version>`. A CI or annotation tag on the same commit is
|
||||||
|
logged and ignored, and the release tag is still created.
|
||||||
|
|
||||||
# Recovering the versions that never got a tag
|
# Recovering the versions that never got a tag
|
||||||
|
|
||||||
The label alone cannot recover them — #20, #21 and #22 all lost their head
|
The label alone cannot recover them — #20, #21 and #22 all lost their head
|
||||||
@@ -123,6 +178,11 @@ whole history.
|
|||||||
|
|
||||||
* That the release phase tags correctly once the head branch survives a
|
* That the release phase tags correctly once the head branch survives a
|
||||||
merge. The next release cycle proves it.
|
merge. The next release cycle proves it.
|
||||||
|
* That the reconcile step's tag-creation fallback works with a live
|
||||||
|
token. Only the tag-already-exists path was exercised, in dry-run,
|
||||||
|
against the live PR #22. The fallback is written from the same Gitea
|
||||||
|
API shapes (`POST /tags`, `PUT /issues/{index}/labels`) the rest of the
|
||||||
|
workflow uses.
|
||||||
* That `RELEASE_PLEASE_TOKEN_CV_SITE_NUXT` carries the `write:issue`
|
* That `RELEASE_PLEASE_TOKEN_CV_SITE_NUXT` carries the `write:issue`
|
||||||
scope the same way `PR_GITEA_TOKEN` needed it; the previous failure
|
scope the same way `PR_GITEA_TOKEN` needed it; the previous failure
|
||||||
was an immediate API rejection consistent with a scope problem.
|
was an immediate API rejection consistent with a scope problem.
|
||||||
|
|||||||
@@ -31,23 +31,32 @@ patched 7.1.6 was already in the tree via `postcss-nesting` and proved
|
|||||||
API-compatible through a full build. The override is removed when
|
API-compatible through a full build. The override is removed when
|
||||||
`tailwindcss` ships `>= 7.1.6` itself or the site moves to Tailwind v4.
|
`tailwindcss` ships `>= 7.1.6` itself or the site moves to Tailwind v4.
|
||||||
|
|
||||||
Currently ignored (both verified against the advisory database and the npm
|
Currently ignored (verified against the advisory database and the npm
|
||||||
registries on 2026-10-18 - the newest published versions are the vulnerable
|
registries on 2026-10-31):
|
||||||
ones):
|
|
||||||
|
|
||||||
* `GHSA-86w9-cpqp-85rv` - node-forge <= 1.4.0, high. Path:
|
|
||||||
`nuxt > @nuxt/nitro-server > nitropack > listhen > node-forge` - listhen
|
|
||||||
generates dev certificates; build/dev-time only, not in the server bundle.
|
|
||||||
* `GHSA-vfj7-8cjw-p6xm` - braces <= 3.0.3, high. Path:
|
* `GHSA-vfj7-8cjw-p6xm` - braces <= 3.0.3, high. Path:
|
||||||
`nitropack > globby > micromatch > braces` - globbing during build, no
|
`nitropack > globby > micromatch > braces` - globbing during build, no
|
||||||
attacker-controlled patterns at runtime.
|
attacker-controlled patterns at runtime.
|
||||||
|
* `GHSA-g3hv-75wg-m249` - minimatch < 11.0.1, moderate. The patch
|
||||||
|
(11.0.1) dropped the `makeRe` export that `eslint-plugin-import-x`
|
||||||
|
imports, so forcing it breaks `pnpm lint` with "does not provide an
|
||||||
|
export named 'makeRe'"; it also breaks ESLint's config loader. All
|
||||||
|
affected paths are build/lint-time (Nitro, i18n, ESLint via
|
||||||
|
vite-plugin-checker), never in the running server.
|
||||||
|
|
||||||
|
The 2026-10-31 round also upgraded `nuxt` 4.6.2 -> 4.6.3 (fixes the Nuxt
|
||||||
|
dot-segment, dev-server and appSecret advisories) and added overrides for
|
||||||
|
`node-forge: 1.4.1` (the old node-forge ignore, `GHSA-86w9-cpqp-85rv`,
|
||||||
|
is gone - a patch now exists) and `glob: 14.0.2` for
|
||||||
|
`GHSA-3g3m-2fjr-6pw4` (scoped to `>=9.0.0 <=14.0.1` so
|
||||||
|
tailwind-config-viewer keeps glob 7).
|
||||||
|
|
||||||
# Why
|
# Why
|
||||||
|
|
||||||
A red job that can never go green trains everyone to ignore red - the same
|
A red job that can never go green trains everyone to ignore red - the same
|
||||||
silent-failure outcome "nothing fails silently" exists to prevent. The
|
silent-failure outcome "nothing fails silently" exists to prevent. The
|
||||||
ignore list is the opposite of silence: the audit still names what it
|
ignore list is the opposite of silence: the audit still names what it
|
||||||
skipped ("2 ignored: 2 high") and the decision lives in a reviewable file.
|
skipped ("1 ignored: 1 high") and the decision lives in a reviewable file.
|
||||||
|
|
||||||
# The pnpm 11 lesson
|
# The pnpm 11 lesson
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ config files — the configs say what, these documents say why.
|
|||||||
* [Vulnerability audit policy](decisions/vulnerability-audit-policy.md) - Blocking audit; reviewed ignore-list for unfixable advisories in pnpm-workspace.yaml.
|
* [Vulnerability audit policy](decisions/vulnerability-audit-policy.md) - Blocking audit; reviewed ignore-list for unfixable advisories in pnpm-workspace.yaml.
|
||||||
* [Release engineering](decisions/release-engineering.md) - release-please in manifest mode; conventional commits enforced at commit time.
|
* [Release engineering](decisions/release-engineering.md) - release-please in manifest mode; conventional commits enforced at commit time.
|
||||||
* [Snyk paused and secrets policy](decisions/snyk-paused-and-secrets-policy.md) - Quota-paused job kept in place; `write:issue` scope required on every workflow token.
|
* [Snyk paused and secrets policy](decisions/snyk-paused-and-secrets-policy.md) - Quota-paused job kept in place; `write:issue` scope required on every workflow token.
|
||||||
* [Publishing images to the own registry](decisions/registry-publishing.md) - A release tag builds the image and pushes it to registry.noelsabia.dev; the runner socket it needs is root-equivalent and belongs on a separate label.
|
* [Publishing images to the own registry](decisions/registry-publishing.md) - A release tag builds the image and pushes it to git.noelsabia.dev; the runner socket it needs is root-equivalent and belongs on a separate label.
|
||||||
|
|
||||||
## Docker and development environment
|
## Docker and development environment
|
||||||
|
|
||||||
|
|||||||
+28
-1
@@ -1,5 +1,25 @@
|
|||||||
# Update Log
|
# Update Log
|
||||||
|
|
||||||
|
## 2026-10-31 (release-please reconcile step needs a checkout)
|
||||||
|
|
||||||
|
* **Fix**: [release-please.yml](../.gitea/workflows/release-please.yml) - added `actions/checkout@v4` before the reconcile step. The job had no checkout because the release-please action clones the repository into its own temp directory; the new step runs `scripts/reconcile-release-please.mjs` from the workspace, so the first post-merge run failed with `Cannot find module '/workspace/CV_Website/CV_Site_Nuxt/scripts/reconcile-release-please.mjs'` (task 571). The checkout supplies the file; the action still uses its own temp clone for the release branch.
|
||||||
|
|
||||||
|
## 2026-10-31 (PR #33 second review: release tag validated, pending PRs queried by label)
|
||||||
|
|
||||||
|
* **Fix**: [reconcile-release-please.mjs](../scripts/reconcile-release-please.mjs) - both PR-Agent findings were confirmed. A tag at the merge commit now counts only when it is exactly `v<manifest version>`; a foreign CI/annotation tag is logged and ignored. Pending release PRs are fetched through the `autorelease: pending` label filter instead of paging every closed PR, so a concurrent close cannot shift a page and hide one.
|
||||||
|
* **Guard**: a merged PR without `merge_commit_sha`, or a manifest without a version, now fails loudly instead of producing `vundefined`.
|
||||||
|
* **Verified locally**: dry-run against the live repo still matches #22 to `v1.4.0`; `pnpm lint`, `pnpm typecheck`, `pnpm build` and `pnpm audit --prod --audit-level moderate` pass on the rebased tree.
|
||||||
|
* **Known issue**: PR-Agent's `/describe` posts `Failed to update PR description`; the bot token has `write:issue` but not the PR-edit scope. Recorded with the fix in [PR-Agent operations](pr-agent.md).
|
||||||
|
|
||||||
|
## 2026-10-31 (registry host corrected: Gitea's built-in registry on git.noelsabia.dev)
|
||||||
|
|
||||||
|
* **Correction**: `registry.noelsabia.dev` is gone from the documentation and the workflow. Gitea's built-in container registry is served on the Gitea hostname itself, so the image is **`git.noelsabia.dev/cv_website/nuxt:<tag>`** ([docs.gitea.com/usage/packages/container](https://docs.gitea.com/usage/packages/container/)). `registry.noelsabia.dev` was a separate hostname set up before that was known; the server-side setup is being reverted. No separate registry, no extra hostname, no extra certificate - Gitea already provides this by default.
|
||||||
|
* **Update**: [publish-image.yml](../.gitea/workflows/publish-image.yml) - `IMAGE`, `docker login` and the v2 `manifests/<version>` immutability check all point at `git.noelsabia.dev`. [Publishing images to the own registry](decisions/registry-publishing.md) records the corrected host and the reason.
|
||||||
|
|
||||||
|
## 2026-10-31 (registry confirmed: Gitea's built-in container registry)
|
||||||
|
|
||||||
|
* **Confirmation**: Logged in and pushed by hand - push access works. The registry is **Gitea's built-in container registry** ([docs.gitea.com/usage/packages/container](https://docs.gitea.com/usage/packages/container/)), not a separately deployed component: it is served on the Gitea host, and the `/cv_website/` path segment is the organisation namespace. This is the default - no Registry/Harbor to stand up, nothing to reinvent. Host corrected in the entry above; see [Publishing images to the own registry](decisions/registry-publishing.md).
|
||||||
|
|
||||||
## 2026-10-30 (PR-Agent moved into the Gitea compose stack)
|
## 2026-10-30 (PR-Agent moved into the Gitea compose stack)
|
||||||
|
|
||||||
* **Refactor**: the `pr-agent` service now lives in `/home/noel/self-hosted/gitea/docker-compose.yml` with `/home/noel/self-hosted/gitea/pr-agent.env`. The separate `/home/noel/self-hosted/pr-agent` stack and the unused `/opt` operator-access scripts were removed; the service is managed with the Gitea stack.
|
* **Refactor**: the `pr-agent` service now lives in `/home/noel/self-hosted/gitea/docker-compose.yml` with `/home/noel/self-hosted/gitea/pr-agent.env`. The separate `/home/noel/self-hosted/pr-agent` stack and the unused `/opt` operator-access scripts were removed; the service is managed with the Gitea stack.
|
||||||
@@ -21,6 +41,13 @@
|
|||||||
* **Creation**: `deploy/pr-agent/` (later removed; the service now lives in the Gitea compose stack) - compose service, example environment and operator README. The real `.env` lived only at `/home/noel/self-hosted/pr-agent/.env` (mode 600) on `server0`.
|
* **Creation**: `deploy/pr-agent/` (later removed; the service now lives in the Gitea compose stack) - compose service, example environment and operator README. The real `.env` lived only at `/home/noel/self-hosted/pr-agent/.env` (mode 600) on `server0`.
|
||||||
* **State**: the container is running and the webhook signature path is verified. Gitea gained `[webhook] ALLOWED_HOST_LIST = private:3000` (one restart, healthy) and the repository has a signed webhook. The OpenCode Go API key was still missing at commit time, so no model call or real review has run yet.
|
* **State**: the container is running and the webhook signature path is verified. Gitea gained `[webhook] ALLOWED_HOST_LIST = private:3000` (one restart, healthy) and the repository has a signed webhook. The OpenCode Go API key was still missing at commit time, so no model call or real review has run yet.
|
||||||
|
|
||||||
|
## 2026-10-31 (audit green again: nuxt 4.6.3 and dependency overrides)
|
||||||
|
|
||||||
|
* **Fix**: `pnpm audit --prod --audit-level moderate` failed on every branch (#30, #31, #33 and this PR) - new advisories plus a Nuxt patch release. `nuxt` 4.6.2 -> **4.6.3** clears GHSA-9v7c-q64q-vv33 (dot-segment middleware bypass), GHSA-3xf4-9g3c-4h4w and GHSA-x287-wcfc-q46c (dev-server file read/runtime config).
|
||||||
|
* **Fix**: [pnpm-workspace.yaml](../pnpm-workspace.yaml) - overrides for `node-forge: 1.4.1` (the old GHSA-86w9-cpqp-85rv ignore is removed - a patch exists now) and `glob@>=9.0.0 <=14.0.1: 14.0.2` (GHSA-3g3m-2fjr-6pw4; glob 7 is kept for tailwind-config-viewer).
|
||||||
|
* **Decision**: minimatch GHSA-g3hv-75wg-m249 stays a reviewed ignore. Its patch (11.0.1) dropped `makeRe`, which `eslint-plugin-import-x` imports - forcing it makes `pnpm lint` fail with "does not provide an export named 'makeRe'" (measured). All affected paths are build/lint-time. See [Vulnerability audit policy](decisions/vulnerability-audit-policy.md).
|
||||||
|
* **Verified locally**: `pnpm lint`, `pnpm typecheck`, `pnpm build` and the exact audit command all pass on the merged tree.
|
||||||
|
|
||||||
## 2026-10-27 (release-please still never tagged: the deleted head branch)
|
## 2026-10-27 (release-please still never tagged: the deleted head branch)
|
||||||
|
|
||||||
* **Fix**: [release-please-config.json](../release-please-config.json) gained `"changelog-host": "https://git.noelsabia.dev"` - the changelog compare links were generated against `github.com/CV_Website/CV_Site_Nuxt`, a host this repository does not live on. Root cause of the missing tags: **Gitea rewrites `head.ref` to `refs/pull/<n>/head` when the merged PR's branch is deleted**, and release-please parses that field as the release branch, so `BranchName.parse` fails and the release is dropped - silently, exit code 0. Evidence: run 143 (task 475) logs `✖ Bad branch name: refs/pull/22/head` right after `Found pull request #22`, then `Expected 1 releases, only found 0`; #22 did carry `autorelease: pending`. The repository deleted every merged branch (`default_delete_branch_after_merge: true`); it is `false` now. Four versions (1.1.0-1.4.0) were consumed by the manifest with no tag ever created, so the release baseline has to be restored by hand. See [Release engineering](decisions/release-engineering.md).
|
* **Fix**: [release-please-config.json](../release-please-config.json) gained `"changelog-host": "https://git.noelsabia.dev"` - the changelog compare links were generated against `github.com/CV_Website/CV_Site_Nuxt`, a host this repository does not live on. Root cause of the missing tags: **Gitea rewrites `head.ref` to `refs/pull/<n>/head` when the merged PR's branch is deleted**, and release-please parses that field as the release branch, so `BranchName.parse` fails and the release is dropped - silently, exit code 0. Evidence: run 143 (task 475) logs `✖ Bad branch name: refs/pull/22/head` right after `Found pull request #22`, then `Expected 1 releases, only found 0`; #22 did carry `autorelease: pending`. The repository deleted every merged branch (`default_delete_branch_after_merge: true`); it is `false` now. Four versions (1.1.0-1.4.0) were consumed by the manifest with no tag ever created, so the release baseline has to be restored by hand. See [Release engineering](decisions/release-engineering.md).
|
||||||
@@ -31,7 +58,7 @@
|
|||||||
|
|
||||||
## 2026-10-24 (release publishes an image)
|
## 2026-10-24 (release publishes an image)
|
||||||
|
|
||||||
* **Creation**: [publish-image.yml](../.gitea/workflows/publish-image.yml) - a `vX.Y.Z` tag push builds `Dockerfile` on the arm64 runner and pushes `registry.noelsabia.dev/cv_website/nuxt` as the version and `sha-<12>`, plus `latest` when that tag is the newest release. Main pushes deliberately do not build: the registry holds releases, not commits. The job uses the runner's own Docker daemon (client only in the `node:22-bookworm` container), so the act_runner needs `container.docker_host: automount`; the first step fails with that cause if it is missing. That socket is root-equivalent, so it may only sit on a label PR jobs cannot use - recorded under the trust boundary in [Publishing images to the own registry](decisions/registry-publishing.md). Repo secrets: `REGISTRY_USERNAME`, `REGISTRY_PASSWORD`.
|
* **Creation**: [publish-image.yml](../.gitea/workflows/publish-image.yml) - a `vX.Y.Z` tag push builds `Dockerfile` on the arm64 runner and pushes `git.noelsabia.dev/cv_website/nuxt` as the version and `sha-<12>`, plus `latest` when that tag is the newest release. Main pushes deliberately do not build: the registry holds releases, not commits. The job uses the runner's own Docker daemon (client only in the `node:22-bookworm` container), so the act_runner needs `container.docker_host: automount`; the first step fails with that cause if it is missing. That socket is root-equivalent, so it may only sit on a label PR jobs cannot use - recorded under the trust boundary in [Publishing images to the own registry](decisions/registry-publishing.md). Repo secrets: `REGISTRY_USERNAME`, `REGISTRY_PASSWORD`.
|
||||||
* **Review follow-up** (PR #19, 1 BLOCKER + 4 WARN + 2 NIT): applied the strict `vMAJOR.MINOR.PATCH` check, the newest-release rule for `latest`, a smoke test that starts the image and requires 2xx on `/`, and `timeout-minutes: 20`. Rejected with evidence: the `.dockerignore` leak (`.env*`, `*.pem`, `.git` are excluded) and the Docker-client/daemon API mismatch (20.10.24 client against a 29.9.2 daemon built successfully over the socket).
|
* **Review follow-up** (PR #19, 1 BLOCKER + 4 WARN + 2 NIT): applied the strict `vMAJOR.MINOR.PATCH` check, the newest-release rule for `latest`, a smoke test that starts the image and requires 2xx on `/`, and `timeout-minutes: 20`. Rejected with evidence: the `.dockerignore` leak (`.env*`, `*.pem`, `.git` are excluded) and the Docker-client/daemon API mismatch (20.10.24 client against a 29.9.2 daemon built successfully over the socket).
|
||||||
* **Second review follow-up** (PR #19): the job now runs on the dedicated `publish` label instead of `ubuntu-latest`, so the host socket it needs can never be shared with PR jobs - the earlier version required a runner configuration its own trust boundary forbade. Added the immutability guard (registry v2 `manifests/<version>`: `200` aborts, `404` continues) after measuring that `docker manifest inspect` fails on OCI indexes with the pinned 20.10 client; the smoke test now also requires a rendered body (10 kB floor) rather than a bare 2xx. `.github/actionlint.yaml` declares the custom label, and the hook passes it with `-config-file` because this repo keeps workflows in `.gitea/`.
|
* **Second review follow-up** (PR #19): the job now runs on the dedicated `publish` label instead of `ubuntu-latest`, so the host socket it needs can never be shared with PR jobs - the earlier version required a runner configuration its own trust boundary forbade. Added the immutability guard (registry v2 `manifests/<version>`: `200` aborts, `404` continues) after measuring that `docker manifest inspect` fails on OCI indexes with the pinned 20.10 client; the smoke test now also requires a rendered body (10 kB floor) rather than a bare 2xx. `.github/actionlint.yaml` declares the custom label, and the hook passes it with `-config-file` because this repo keeps workflows in `.gitea/`.
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,16 @@ access is a separate change.
|
|||||||
it, Gitea's default egress policy refuses deliveries to the Docker
|
it, Gitea's default egress policy refuses deliveries to the Docker
|
||||||
network.
|
network.
|
||||||
|
|
||||||
|
# Known issue: "Failed to update PR description"
|
||||||
|
|
||||||
|
On PR #33 (2026-10-31) `/describe` posted `Failed to update PR description`
|
||||||
|
before the reviewer guide. Comments work because the bot token has
|
||||||
|
`write:issue`; editing the PR body is a repository-route write and needs
|
||||||
|
`write:repository` as well. Add that scope to the `pr-agent` token and
|
||||||
|
restart the service, or remove `/describe` from `GITEA__PR_COMMANDS` if the
|
||||||
|
description update is not wanted. The review comment is still posted; this
|
||||||
|
affects only the description sync.
|
||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
|
|
||||||
| Trigger | What runs |
|
| Trigger | What runs |
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@
|
|||||||
"@nuxtjs/i18n": "10.6.0",
|
"@nuxtjs/i18n": "10.6.0",
|
||||||
"@nuxtjs/seo": "6.0.1",
|
"@nuxtjs/seo": "6.0.1",
|
||||||
"@nuxtjs/tailwindcss": "6.14.0",
|
"@nuxtjs/tailwindcss": "6.14.0",
|
||||||
"nuxt": "^4.6.2",
|
"nuxt": "^4.6.3",
|
||||||
"vue": "^3.5.43",
|
"vue": "^3.5.43",
|
||||||
"vue-router": "^5.4.0"
|
"vue-router": "^5.4.0"
|
||||||
},
|
},
|
||||||
|
|||||||
Generated
+484
-485
File diff suppressed because it is too large.
Load diff
+23
-7
@@ -2,15 +2,21 @@ allowBuilds:
|
|||||||
esbuild: true
|
esbuild: true
|
||||||
unrs-resolver: true
|
unrs-resolver: true
|
||||||
auditConfig:
|
auditConfig:
|
||||||
# Reviewed ignores for advisories with NO patched release (verified against
|
# Reviewed ignores for advisories with NO patched release, or whose patch
|
||||||
# the advisory database and npm registries on 2026-10-18: node-forge 1.4.0
|
# is incompatible with a consumer in this tree. braces is unfixable
|
||||||
# and braces 3.0.3 are the newest published versions). Both packages are
|
# (3.0.3 is still newest); minimatch's patch (11.0.1) breaks ESLint -
|
||||||
# build-time-only paths under nitropack (listhen dev-cert generation,
|
# both are build-time-only paths. node-forge was removed from this list
|
||||||
# globby file globbing) - not in the running server's bundle. Remove an
|
# on 2026-10-31 when 1.4.1 shipped and is now forced through `overrides`.
|
||||||
# entry when a patched version ships.
|
# Remove an entry when a compatible patched version ships.
|
||||||
ignoreGhsas:
|
ignoreGhsas:
|
||||||
- GHSA-86w9-cpqp-85rv
|
|
||||||
- GHSA-vfj7-8cjw-p6xm
|
- GHSA-vfj7-8cjw-p6xm
|
||||||
|
# GHSA-g3hv-75wg-m249 (minimatch DoS): the patched 11.0.1 dropped the
|
||||||
|
# `makeRe` export that eslint-plugin-import-x imports, so `pnpm lint`
|
||||||
|
# fails with "does not provide an export named 'makeRe'"; forcing it
|
||||||
|
# also breaks ESLint's config loader. Affected paths are build/lint
|
||||||
|
# only (Nitro, i18n, ESLint via vite-plugin-checker), never in the
|
||||||
|
# server bundle.
|
||||||
|
- GHSA-g3hv-75wg-m249
|
||||||
overrides:
|
overrides:
|
||||||
# Fixable advisories get the patched version forced here, not an ignore
|
# Fixable advisories get the patched version forced here, not an ignore
|
||||||
# (audit policy: upgrade when a patch exists).
|
# (audit policy: upgrade when a patch exists).
|
||||||
@@ -27,6 +33,16 @@ overrides:
|
|||||||
# smallest version that clears both advisories. Remove this when Nuxt ships
|
# smallest version that clears both advisories. Remove this when Nuxt ships
|
||||||
# a vite-builder that resolves >= 1.6.11 itself.
|
# a vite-builder that resolves >= 1.6.11 itself.
|
||||||
seroval: 1.6.11
|
seroval: 1.6.11
|
||||||
|
# GHSA-g3hv-75wg-m249 (moderate, 2026-10-31): minimatch < 11.0.1 has a
|
||||||
|
# globparts amplification DoS. Deliberately NOT overridden - see the
|
||||||
|
# auditConfig ignore note above.
|
||||||
|
# GHSA-3g3m-2fjr-6pw4 (moderate, 2026-10-31): glob 9.0.0-14.0.1 bypasses
|
||||||
|
# AbortSignal cancellation. Patched in 14.0.2; the range keeps glob 7 for
|
||||||
|
# tailwind-config-viewer.
|
||||||
|
"glob@>=9.0.0 <=14.0.1": 14.0.2
|
||||||
|
# node-forge 1.4.1 shipped (2026-10-31) and clears every node-forge
|
||||||
|
# advisory that was previously ignored - no ignore needed anymore.
|
||||||
|
node-forge: 1.4.1
|
||||||
minimumReleaseAgeExclude:
|
minimumReleaseAgeExclude:
|
||||||
- '@rollup/rollup-darwin-x64@4.64.8'
|
- '@rollup/rollup-darwin-x64@4.64.8'
|
||||||
- '@rollup/rollup-freebsd-arm64@4.64.8'
|
- '@rollup/rollup-freebsd-arm64@4.64.8'
|
||||||
|
|||||||
@@ -0,0 +1,205 @@
|
|||||||
|
// Repairs the release-please state that its Gitea fork cannot recover from.
|
||||||
|
//
|
||||||
|
// Why this exists (evidence in OKF_Nuxt/decisions/release-engineering.md):
|
||||||
|
//
|
||||||
|
// Gitea rewrites a merged PR's `head.ref` to `refs/pull/<n>/head` when the
|
||||||
|
// head branch is deleted. The fork parses that field as the release branch,
|
||||||
|
// logs `Bad branch name`, creates no tag - and still exits successfully.
|
||||||
|
// The merged PR keeps `autorelease: pending`, so every later run aborts with
|
||||||
|
// `There are untagged, merged release PRs outstanding` and opens no new
|
||||||
|
// release PR. That is a permanent deadlock, not a transient failure.
|
||||||
|
//
|
||||||
|
// This script runs before the action and reconciles the state:
|
||||||
|
//
|
||||||
|
// * a merged pending PR whose merge commit already has the expected
|
||||||
|
// `v<manifest version>` tag -> swap `autorelease: pending` for
|
||||||
|
// `autorelease: tagged` (the release exists, only the label is stale);
|
||||||
|
// * a merged pending PR whose head branch is gone and has no expected tag
|
||||||
|
// -> create the tag from the version recorded in the manifest at that
|
||||||
|
// merge commit. This is exactly the tag release-please would have made if
|
||||||
|
// the branch had survived; without it the PR blocks every future release;
|
||||||
|
// * a merged pending PR whose head branch still exists -> leave it alone,
|
||||||
|
// release-please tags it in the same run.
|
||||||
|
//
|
||||||
|
// Pending PRs are looked up by the label itself, not by paging through every
|
||||||
|
// closed PR: the set is tiny (normally zero or one) and cannot race with PRs
|
||||||
|
// closing while the pages are being read.
|
||||||
|
//
|
||||||
|
// Run locally against the public API with:
|
||||||
|
// DRY_RUN=1 node scripts/reconcile-release-please.mjs
|
||||||
|
// Reads work unauthenticated for a public repository; writes are skipped.
|
||||||
|
|
||||||
|
const API_URL = process.env.GITHUB_API_URL
|
||||||
|
const REPOSITORY = process.env.GITHUB_REPOSITORY
|
||||||
|
const TOKEN = process.env.GITEA_TOKEN
|
||||||
|
const DRY_RUN = process.env.DRY_RUN === '1' || process.argv.includes('--dry-run')
|
||||||
|
|
||||||
|
const PENDING = 'autorelease: pending'
|
||||||
|
const TAGGED = 'autorelease: tagged'
|
||||||
|
const MANIFEST = '.release-please-manifest.json'
|
||||||
|
|
||||||
|
if (!API_URL || !REPOSITORY) {
|
||||||
|
console.error('::error::GITHUB_API_URL and GITHUB_REPOSITORY must be set')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
if (!TOKEN && !DRY_RUN) {
|
||||||
|
console.error('::error::GITEA_TOKEN is required (or set DRY_RUN=1)')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
const repoUrl = `${API_URL}/repos/${REPOSITORY}`
|
||||||
|
|
||||||
|
const api = async (path, init = {}) => {
|
||||||
|
const response = await fetch(`${repoUrl}${path}`, {
|
||||||
|
...init,
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
...(TOKEN ? { Authorization: `token ${TOKEN}` } : {}),
|
||||||
|
...(init.headers ?? {}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const body = await response.text()
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`${init.method ?? 'GET'} ${path} -> HTTP ${response.status}: ${body.slice(0, 300)}`)
|
||||||
|
}
|
||||||
|
return body ? JSON.parse(body) : null
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gitea caps page size at 50. The label-filtered issue list is normally one
|
||||||
|
// page; loop anyway so a backlog of stale pending PRs is still reconciled.
|
||||||
|
const listAll = async (path, params = {}) => {
|
||||||
|
const items = []
|
||||||
|
for (let page = 1; ; page++) {
|
||||||
|
const query = new URLSearchParams({ ...params, limit: '50', page: String(page) })
|
||||||
|
const batch = await api(`${path}?${query}`)
|
||||||
|
items.push(...batch)
|
||||||
|
if (batch.length < 50) return items
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const replaceLabels = async (number, labels) => {
|
||||||
|
if (DRY_RUN) {
|
||||||
|
console.log(`[dry-run] #${number}: labels -> ${labels.join(', ')}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await api(`/issues/${number}/labels`, {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ labels }),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const createTag = async (name, sha) => {
|
||||||
|
if (DRY_RUN) {
|
||||||
|
console.log(`[dry-run] create tag ${name} at ${sha}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await api('/tags', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ tag_name: name, target: sha, message: `Release ${name}` }),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const versionAt = async (sha) => {
|
||||||
|
const file = await api(`/contents/${MANIFEST}?ref=${sha}`)
|
||||||
|
if (!file?.content) throw new Error(`no manifest content at ${sha}`)
|
||||||
|
const manifest = JSON.parse(Buffer.from(file.content, 'base64').toString('utf8'))
|
||||||
|
// Single-package repository: the root path is ".". Keep a fallback so a
|
||||||
|
// future second package cannot silently produce `vundefined`.
|
||||||
|
const version = manifest['.'] ?? Object.values(manifest)[0]
|
||||||
|
if (!version) throw new Error(`manifest at ${sha} has no version`)
|
||||||
|
return version
|
||||||
|
}
|
||||||
|
|
||||||
|
const run = async () => {
|
||||||
|
// One tag can point at the merge commit for a non-release reason (CI
|
||||||
|
// tooling, a manual annotation). Only the `v<manifest version>` tag proves
|
||||||
|
// the release exists; every other tag at that commit is ignored.
|
||||||
|
const tags = await listAll('/tags')
|
||||||
|
const tagsAtSha = new Map()
|
||||||
|
const tagSha = new Map()
|
||||||
|
for (const tag of tags) {
|
||||||
|
const sha = tag.commit?.sha
|
||||||
|
if (!sha) continue
|
||||||
|
if (!tagsAtSha.has(sha)) tagsAtSha.set(sha, [])
|
||||||
|
tagsAtSha.get(sha).push(tag.name)
|
||||||
|
tagSha.set(tag.name, sha)
|
||||||
|
}
|
||||||
|
|
||||||
|
const pendingIssues = await listAll('/issues', {
|
||||||
|
state: 'closed',
|
||||||
|
type: 'pulls',
|
||||||
|
labels: PENDING,
|
||||||
|
})
|
||||||
|
if (pendingIssues.length === 0) {
|
||||||
|
console.log('No merged release PR is pending - nothing to reconcile.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const failures = []
|
||||||
|
const versionCache = new Map()
|
||||||
|
|
||||||
|
for (const issue of pendingIssues) {
|
||||||
|
const pull = await api(`/pulls/${issue.number}`)
|
||||||
|
if (!pull.merged_at) continue
|
||||||
|
|
||||||
|
const mergeSha = pull.merge_commit_sha
|
||||||
|
if (!mergeSha) {
|
||||||
|
failures.push(`#${pull.number}: merged PR has no merge_commit_sha`)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
const headRef = pull.head?.ref ?? ''
|
||||||
|
const branchGone = headRef.startsWith('refs/pull/') || headRef === ''
|
||||||
|
const labels = (pull.labels ?? []).map(label => label.name)
|
||||||
|
if (!versionCache.has(mergeSha)) versionCache.set(mergeSha, await versionAt(mergeSha))
|
||||||
|
const expectedTag = `v${versionCache.get(mergeSha)}`
|
||||||
|
const tagsHere = tagsAtSha.get(mergeSha) ?? []
|
||||||
|
|
||||||
|
if (tagsHere.includes(expectedTag)) {
|
||||||
|
console.log(`#${pull.number}: ${expectedTag} already points at merge commit ${mergeSha} - marking as tagged`)
|
||||||
|
const next = labels.filter(name => name !== PENDING)
|
||||||
|
if (!next.includes(TAGGED)) next.push(TAGGED)
|
||||||
|
await replaceLabels(pull.number, next)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tagsHere.length > 0) {
|
||||||
|
console.log(`#${pull.number}: ignoring non-release tag(s) at merge commit: ${tagsHere.join(', ')}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!branchGone) {
|
||||||
|
console.log(`#${pull.number}: head branch ${headRef} still exists - leaving it for release-please to tag`)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// The branch is gone and the expected tag is missing, so release-please
|
||||||
|
// will never get past `Bad branch name` for this PR. Recreate the tag it
|
||||||
|
// should have made, using the version the merged release PR wrote into the
|
||||||
|
// manifest.
|
||||||
|
try {
|
||||||
|
if (tagSha.has(expectedTag)) {
|
||||||
|
throw new Error(`${expectedTag} already exists at ${tagSha.get(expectedTag)}, not at merge commit ${mergeSha}; refusing to move a release tag`)
|
||||||
|
}
|
||||||
|
console.log(`#${pull.number}: head branch is gone (${headRef}) - creating ${expectedTag} at ${mergeSha}`)
|
||||||
|
await createTag(expectedTag, mergeSha)
|
||||||
|
const next = labels.filter(name => name !== PENDING)
|
||||||
|
if (!next.includes(TAGGED)) next.push(TAGGED)
|
||||||
|
await replaceLabels(pull.number, next)
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
failures.push(`#${pull.number}: ${error.message}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (failures.length > 0) {
|
||||||
|
for (const failure of failures) console.error(`::error::${failure}`)
|
||||||
|
console.error('::error::release-please state is unrecoverable automatically; repair the PR/tag by hand before the next release')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
run().catch((error) => {
|
||||||
|
console.error(`::error::${error.message}`)
|
||||||
|
process.exit(1)
|
||||||
|
})
|
||||||
Reference in new issue
Block a user