Commit Graph
51 Commits
Author SHA1 Message Date
nanxun 96ed3396d9 ci: use domestic mirrors and persistent caches 2026-08-13 23:15:48 +08:00
nanxun e6068d93e0 ci: harden registry proxy credentials 2026-08-12 00:01:50 +08:00
nanxun 534f8030c1 fix: keep BuildKit no-proxy driver option scalar 2026-08-11 23:32:44 +08:00
nanxun dc9ab046c5 ci: route BuildKit registry traffic through proxy 2026-08-11 23:04:52 +08:00
nanxun 0eb47e9918 ci: increment fnOS package version per build 2026-08-11 18:03:57 +08:00
nanxun 5e2e0530f1 ci: recover sudo-owned build metadata 2026-08-11 14:26:12 +08:00
nanxun 40acd35ad7 ci: reduce Docker build disk usage 2026-08-11 14:22:44 +08:00
nanxun df75ab272f ci: use ASCII workspace for Buildx sessions 2026-08-11 14:07:42 +08:00
nanxun c3abb1f792 ci: scope Docker privilege to Jenkins credential 2026-08-11 13:54:24 +08:00
nanxun fd552ce2cc ci: expose local build tools to Jenkins agent 2026-08-11 13:43:25 +08:00
nanxun f2e55e46c4 ci: add Jenkins multi-architecture release pipeline 2026-08-11 13:34:58 +08:00
nanxunandClaude Opus 4.8 cee591b729 ci: use default docker builder instead of creating new one
docker driver only supports a single instance. Creating another fails with
'additional instances of driver docker cannot be created'. Just use the
default builder that ships with the docker daemon.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-03 16:14:36 +08:00
nanxunandClaude Opus 4.8 4312f23f85 ci: switch buildx back to docker driver to avoid pulling moby/buildkit from Docker Hub
The docker-container driver requires moby/buildkit:buildx-stable-1 from
Docker Hub, which is unreachable from the build network (EOF / timeout).
The docker driver runs buildkit inside the host daemon without needing
a separate container image.

Also explicitly rm + recreate the builder each run so stale
docker-container instances don't linger as the default.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-03 16:13:01 +08:00
nanxunandClaude Opus 4.8 83f16757e7 ci: add --no-cache to bypass stale build cache causing FileLoadException
Removing <RuntimeIdentifier> from the csproj changed the publish layout,
but the old registry build cache still contains the RID-poisoned layers.
Subsequent builds cached at the COPY/RUN layer boundary reuse those stale
layers, causing FileLoadException at runtime.

Add --no-cache to both API and Web buildx invocations so every build
produces fresh layers. Once the pipeline stabilizes, we can re-enable
cache-from with the updated cache tag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-03 16:08:41 +08:00
nanxunandClaude Opus 4.8 bcba0d752b fix: add --amend to docker manifest create for :latest tags, remove debug
:latest manifests already exist from the first successful run (build 123),
so subsequent docker manifest create without --amend fails with
'refusing to amend an existing manifest list'. Add --amend so every
pipeline run can update the :latest tag.

Also remove DEBUG config.json prints now that the auth path is verified.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-03 14:55:47 +08:00
nanxunandClaude Opus 4.8 4c6e730a08 fix: correct Harbor project path liverecorder -> live_recorder
The Harbor project is named 'live_recorder' (with underscore), matching
the robot account robot$live_recorder+live. The pipeline was pushing to
'liverecorder' (no underscore) — a different/nonexistent project path —
so the robot's push permission did not apply and every push got 401
despite 'Login Succeeded'.

This was THE root cause of the persistent 401s, not buildx auth
forwarding or token expiry (those were all red herrings).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-03 13:24:36 +08:00
nanxunandClaude Opus 4.8 e649fb7139 ci: bypass docker login, write base64 auth directly to config.json
Every variant of docker login (--password-stdin, -p) has shown
'Login Succeeded' but docker push consistently gets 401.
Write the base64-encoded user:pass directly into
/root/.docker/config.json, eliminating docker login as a
variable entirely. If push still 401s after this, the problem
is definitively on the Harbor side (robot permissions).

Also fixes broken heredoc escaping from previous commit where
<<'DOCKERCFG' prevented shell variable expansion of AUTH_B64.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 21:33:05 +08:00
nanxunandClaude Opus 4.8 02a0b1bd87 ci: use docker login -p instead of --password-stdin, add debug
Suspect that echo + pipe to --password-stdin may be mangling the Jenkins
masked password variable. Switch to -p (command-line password) for a
cleaner auth path and add debug output to inspect /root/.docker/config.json
after login.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 20:48:42 +08:00
nanxunandClaude Opus 4.8 06921cbb3e ci: re-login before each docker push, embed withCredentials in build stages
docker push is also getting 401 (not just buildx --push), suggesting
the Harbor login token expires during long builds or there is a
credential propagation gap between the standalone Login stage and the
build stages.

Move withCredentials into each build stage and re-login immediately
before every docker push / manifest push. This gives each push
operation a fresh token.

Pipeline is now: Checkout -> Prepare Buildx -> Build API (login + build
+ push + manifest) -> Build Web (same).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 20:46:32 +08:00
nanxunandClaude Opus 4.8 761041a70e ci: bypass buildx --push auth via per-platform --load + docker push + manifest
buildx build --push has failed 401 on every attempt. The buildkit auth
forwarding (whether via docker-container or docker driver) does not work
reliably on this builder.

New strategy: build each platform separately with --load (into local
docker, which can read /root/.docker/config.json), then push with
native docker push, then assemble a multi-arch manifest with
docker manifest create/push.

Per-platform tags are pushed as :<BUILD_ID>-amd64 / :<BUILD_ID>-arm64
and the manifest combines them under the canonical :<BUILD_ID> and :latest.

This replaces a single buildx --push call with:
  1. buildx build --platform linux/amd64 --load
  2. docker push (amd64)
  3. docker rmi  (free disk)
  4. buildx build --platform linux/arm64 --load
  5. docker push (arm64)
  6. docker rmi  (free disk)
  7. docker manifest create + push (multi-arch)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 20:24:27 +08:00
nanxun 75b07bf10e fix: remove stray closing brace from withCredentials cleanup 2026-07-02 20:03:19 +08:00
nanxunandClaude Opus 4.8 affc5adb4a ci: switch buildx to docker driver to fix registry auth
The docker-container driver runs buildkit in a separate container that
cannot reliably forward host Docker registry credentials via the buildx
session mechanism, causing every --push to fail with 401 Unauthorized.
The --auth flag doesn't exist in buildx 0.23.0 on this builder.

Fix: switch to 'docker' driver which runs buildkit inside the host
Docker daemon and naturally shares its registry auth state.

Changes:
- Login Registry stage restored (before Prepare Buildx)
- Prepare Buildx: driver docker (not docker-container), no driver-opts
- Build stages: stripped withCredentials wrappers and --auth flags
- Removed buildkitd.toml max-parallelism config (docker driver doesn't
  support it; swap provides the safety net for OOM)

Pipeline flow: Checkout -> Login -> Prepare Buildx -> Build API -> Build Web

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 20:01:51 +08:00
nanxunandClaude Opus 4.8 1b3512042c ci: pass registry auth directly to buildx via --auth flag
The docker-container driver's buildkit session mechanism does not reliably
forward host Docker credentials to the buildkit container, causing every
docker buildx build --push to fail with 401 Unauthorized on the manifest
HEAD request.

Fix: remove the standalone Login Registry stage and embed withCredentials
directly into each build stage, passing credentials to buildkit via the
docker buildx build --auth flag:
  --auth 'reg.nxsir.cn=:'

This sends auth directly to buildkit rather than relying on the implicit
docker login -> config.json -> session forwarding chain.

Each stage also does a docker login for the host CLI (needed for
buildx inspect --bootstrap to pull images from the registry, and for
cache-from/cache-to operations).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 19:57:44 +08:00
nanxunandClaude Opus 4.8 fbf6b52a08 ci: drop NO_PROXY from buildkit driver-opt to avoid comma parsing in docker CLI
Docker buildx create --driver-opt splits values on commas as list
separators, causing 'env.NO_PROXY=127.0.0.1,localhost,...' to be parsed
as separate key=value entries and failing with:
  invalid value "localhost", expecting k=v

The NO_PROXY hosts for build containers are already passed via build-arg
in the build stage; the buildkit container itself doesn't need them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 19:38:50 +08:00
nanxunandClaude Opus 4.8 293aa31f60 ci: login before Prepare Buildx to fix 401 Unauthorized push
Move Login Registry stage before Prepare Buildx so Docker credentials are
in /root/.docker/config.json BEFORE the buildx docker-container builder
is created and bootstrapped. Previously the builder started without auth,
causing buildx --push to fail with '401 Unauthorized' on the manifest
HEAD request (blob layers pushed but manifest rejected).

Also expand the NO_PROXY driver-opt from just 'reg.nxsir.cn' to the full
NO_PROXY_HOSTS list (Tsighua, MCR, daocloud) so the buildkit container
itself also bypasses the proxy for these direct-reachable registries.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 19:35:23 +08:00
nanxunandClaude Opus 4.8 1cb05292c0 ci: exclude direct-reachable mirrors from HTTP proxy to fix apt 502
The 7890 proxy intermittently returns '502 Bad Gateway' when tunneling to
mirrors.tuna.tsinghua.edu.cn (observed on libglapi-mesa during
apt-get install in the runtime layer). The Tsinghua mirror, MCR, and
daocloud are all directly reachable from this builder, so the proxy adds
no value and only introduces failure modes.

Add the following hosts to NO_PROXY_HOSTS so apt/curl inside the build
containers hit them directly:
  - mirrors.tuna.tsinghua.edu.cn, .tsinghua.edu.cn
  - mcr.microsoft.com
  - docker.m.daocloud.io

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 18:55:45 +08:00
nanxunandClaude Opus 4.8 fd1121bde0 ci: cap buildkit max-parallelism at 1 to avoid OOM on 4GB builder
Multi-platform buildx (linux/amd64 + linux/arm64) races both platforms in
parallel by default. On the 4GB build agent, QEMU-emulated 'dotnet restore'
for arm64 alone spikes to 2-3GB and racing amd64 apt-installs push us into
the OOM Killer ("cannot allocate memory" at build 4/5).

Fix: write a small buildkitd.toml with max-parallelism = 1 and pass it to
'docker buildx create --config'. buildkit now runs stages sequentially so
the two platforms don't step on each other's RSS.

Recreate the builder every run so the config always takes effect.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 18:49:39 +08:00
nanxunandClaude Opus 4.8 8a709bc217 ci: bypass Docker Hub for tonistiigi/binfmt in Prepare Buildx
The build agent cannot reach auth.docker.io from behind the local network,
causing 'docker run tonistiigi/binfmt --install arm64' to fail with a token
fetch timeout.

Fix: three-tier fallback for ARM64 binfmt registration:
  1. Skip if /proc/sys/fs/binfmt_misc/qemu-aarch64 already exists.
  2. Pull tonistiigi/binfmt via docker.m.daocloud.io mirror.
  3. Fall back to qemu-user-static via apt.

Add a post-registration sanity check (arm64 alpine + uname -m) so
misconfigured builders fail fast rather than at buildx invocation time.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 18:39:06 +08:00
nanxun f7fa02d13c fix: avoid jenkinsfile label mojibake 2026-05-31 19:53:01 +08:00
nanxun fd5be2cc8e ci: stabilize buildx heartbeat and cache 2026-05-31 16:48:35 +08:00
nanxun 9c2767f78c ci: restore polling heartbeat for buildx logs 2026-05-15 16:18:59 +08:00
nanxun d69c7d015e ci: stream buildx logs with tail heartbeat 2026-05-10 12:53:24 +08:00
nanxun 9e09c76a84 更新 Jenkinsfile 2026-05-08 20:33:03 +08:00
nanxun 96cfbf464f fix: surface buildx errors in jenkins heartbeat 2026-05-08 20:25:05 +08:00
nanxun 723bd3945e ci: move buildx heartbeat logs to tmp 2026-04-30 09:45:03 +08:00
nanxun 4ea250ae23 ci: keep buildx logs alive for jenkins 2026-04-30 02:40:03 +08:00
nanxun 2c05771c48 ci: reuse buildx builder cache 2026-04-25 00:25:44 +08:00
nanxun 6a96835e95 ci: use mirror images for web build 2026-04-24 19:54:14 +08:00
nanxun 2bf3c001c9 ci: use host network for buildx builder 2026-04-24 19:38:26 +08:00
nanxun c5c49d62bf ci: simplify buildx no-proxy config 2026-04-24 19:21:51 +08:00
nanxun 5279448fc7 ci: inline docker proxy settings 2026-04-24 19:18:40 +08:00
nanxun 8ae59a3b7a ci: inline docker proxy settings 2026-04-24 19:14:55 +08:00
nanxun fd6fed2474 ci: quote buildx driver opts 2026-04-24 19:11:26 +08:00
nanxun 35a31fdd79 ci: escape buildx no-proxy values 2026-04-24 19:08:24 +08:00
nanxun 8b605a32ca ci: configure docker build proxy 2026-04-24 19:02:44 +08:00
nanxun 1e48572321 更新 Jenkinsfile 2026-04-24 16:07:54 +08:00
nanxun 9b92834f81 更新 Jenkinsfile 2026-04-24 16:04:34 +08:00
nanxun 010ef6b068 更新 Jenkinsfile 2026-04-24 16:03:38 +08:00
nanxun b67ee45b48 更新 Jenkinsfile 2026-04-24 16:01:54 +08:00
nanxun 70f8fbf9bf 更新 Jenkinsfile 2026-04-24 16:00:20 +08:00