ci: bake cached toolchain into Podman agent and fix nested Buildah [CI]
This commit is contained in:
1 parent
2e1dbcf4ce
commit
1975253beb
18 files changed
+215
-29
No files matched your search
@@ -26,7 +26,7 @@ steps:
|
||||
- name: build-linux-amd64-backend
|
||||
image: bash
|
||||
environment:
|
||||
NUGET_PACKAGES: /home/justme/.nuget/packages
|
||||
NUGET_PACKAGES: /home/justme/woodpecker/cache/nuget/packages
|
||||
ZOT_REGISTRY: registry.oeo.one
|
||||
ZOT_USERNAME: justme
|
||||
ZOT_SECRET:
|
||||
@@ -134,7 +134,7 @@ steps:
|
||||
when:
|
||||
- evaluate: 'not (CI_COMMIT_MESSAGE contains "[SKIP TESTS]")'
|
||||
environment:
|
||||
NUGET_PACKAGES: /home/justme/.nuget/packages
|
||||
NUGET_PACKAGES: /home/justme/woodpecker/cache/nuget/packages
|
||||
commands:
|
||||
- bash ci/verify-backend.sh slow
|
||||
depends_on:
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ steps:
|
||||
when:
|
||||
- evaluate: 'not (CI_COMMIT_MESSAGE contains "[SKIP TESTS]")'
|
||||
environment:
|
||||
NUGET_PACKAGES: /home/justme/.nuget/packages
|
||||
NUGET_PACKAGES: /home/justme/woodpecker/cache/nuget/packages
|
||||
commands:
|
||||
# 标了 Category=Slow 的端到端测试,见 ci/verify-backend.sh
|
||||
- bash ci/verify-backend.sh slow
|
||||
@@ -31,7 +31,7 @@ steps:
|
||||
- name: linux-amd64-backend
|
||||
image: bash
|
||||
environment:
|
||||
NUGET_PACKAGES: /home/justme/.nuget/packages
|
||||
NUGET_PACKAGES: /home/justme/woodpecker/cache/nuget/packages
|
||||
ZOT_REGISTRY: registry.oeo.one
|
||||
ZOT_USERNAME: justme
|
||||
ZOT_SECRET:
|
||||
@@ -44,7 +44,7 @@ steps:
|
||||
- name: linux-arm64-backend
|
||||
image: bash
|
||||
environment:
|
||||
NUGET_PACKAGES: /home/justme/.nuget/packages
|
||||
NUGET_PACKAGES: /home/justme/woodpecker/cache/nuget/packages
|
||||
ZOT_REGISTRY: registry.oeo.one
|
||||
ZOT_USERNAME: justme
|
||||
ZOT_SECRET:
|
||||
|
||||
@@ -21,7 +21,7 @@ steps:
|
||||
when:
|
||||
- evaluate: 'not (CI_COMMIT_MESSAGE contains "[SKIP TESTS]")'
|
||||
environment:
|
||||
NUGET_PACKAGES: /home/justme/.nuget/packages
|
||||
NUGET_PACKAGES: /home/justme/woodpecker/cache/nuget/packages
|
||||
commands:
|
||||
# 增量编译 + 快的那批测试(约 20 秒);慢的端到端测试在 e2e workflow 里和出镜像并行跑。见 ci/verify-backend.sh
|
||||
- bash ci/verify-backend.sh fast
|
||||
+24
-9
@@ -97,6 +97,8 @@ fi
|
||||
|
||||
export HOME="$base_home"
|
||||
export BUILDAH_HOME="$base_home"
|
||||
source "$root/ci/buildah-env.sh"
|
||||
moshiro_setup_buildah "$base_home"
|
||||
export REGISTRY_AUTH_FILE="$work/$component-auth.json"
|
||||
context="$work/$component"
|
||||
local_image="localhost/moshiro-$component:dev-$arch-check"
|
||||
@@ -106,15 +108,28 @@ node_rid="linux-musl-x64"
|
||||
# Buildah store. Keeping NuGet inside image layers avoids a shared writable
|
||||
# package mount being corrupted by canceled or parallel builds.
|
||||
builder_image="localhost/moshiro-dotnet10-nativeaot-aotanywhere:ci"
|
||||
builder_context="$work/nativeaot-builder"
|
||||
mkdir -p "$builder_context/backend"
|
||||
install -m 0644 "$root/global.json" "$builder_context/global.json"
|
||||
install -m 0644 "$root/Directory.Packages.props" "$builder_context/Directory.Packages.props"
|
||||
install -m 0644 "$root/backend/Directory.Build.props" "$builder_context/backend/Directory.Build.props"
|
||||
install -m 0644 "$root/backend/BannedSymbols.txt" "$builder_context/backend/BannedSymbols.txt"
|
||||
run_bounded 30m buildah bud --layers --network host --tls-verify=true --arch amd64 \
|
||||
-f "$root/packaging/container/NativeAot.Builder.Containerfile" \
|
||||
-t "$builder_image" "$builder_context"
|
||||
source "$root/ci/nativeaot-toolchain.sh"
|
||||
moshiro_nativeaot_settings "$root"
|
||||
builder_cache="${MOSHIRO_RUNNER_IMAGE_CACHE:-/home/justme/woodpecker/cache/runner-image}"
|
||||
cached_key="$(cat "$builder_cache/nativeaot-builder.key" 2>/dev/null || true)"
|
||||
builder_id="$(cat "$builder_cache/nativeaot-builder.id" 2>/dev/null || true)"
|
||||
if [[ "$cached_key" == "$MOSHIRO_NATIVEAOT_BUILDER_KEY" && "$builder_id" =~ ^[0-9a-f]{64}$ && -f "$builder_cache/nativeaot-builder-$builder_id.oci" ]]; then
|
||||
local_builder_id="$(buildah images --noheading --no-trunc --format '{{.ID}}' "$builder_image" 2>/dev/null || true)"
|
||||
if [[ "${local_builder_id#sha256:}" != "$builder_id" ]]; then
|
||||
run_bounded 10m buildah pull "oci-archive:$builder_cache/nativeaot-builder-$builder_id.oci"
|
||||
buildah tag "$builder_id" "$builder_image"
|
||||
fi
|
||||
echo "using cached NativeAOT toolchain $builder_id"
|
||||
else
|
||||
builder_context="$work/nativeaot-builder"
|
||||
mkdir -p "$builder_context"
|
||||
tr -d '\r' < "$root/global.json" > "$builder_context/global.json"
|
||||
run_bounded 30m buildah bud --layers --network host --tls-verify=true --arch amd64 \
|
||||
--build-arg "AOTANYWHERE_VERSION=$MOSHIRO_AOTANYWHERE_VERSION" \
|
||||
--build-arg "ZIG_TOOLSET_VERSION=$MOSHIRO_ZIG_TOOLSET_VERSION" \
|
||||
-f "$root/packaging/container/NativeAot.Builder.Containerfile" \
|
||||
-t "$builder_image" "$builder_context"
|
||||
fi
|
||||
|
||||
# A stable timestamp lets a retry of the same commit reuse the publish layer.
|
||||
commit_epoch="$(git -C "$root" show -s --format=%ct "$CI_COMMIT_SHA")"
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run as the WSL Podman user; retain image layers and tool archives across runs.
|
||||
set -euo pipefail
|
||||
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cache="${MOSHIRO_RUNNER_IMAGE_CACHE:-/home/justme/woodpecker/cache/runner-image}"
|
||||
builder_image=localhost/moshiro-dotnet10-nativeaot-aotanywhere:ci
|
||||
runner_image=localhost/moshiro-woodpecker-agent:ci
|
||||
mkdir -p "$cache/context/ci"
|
||||
exec 9> "$cache/.lock"
|
||||
flock -w 900 9
|
||||
tr -d '\r' < "$root/global.json" > "$cache/context/global.json"
|
||||
install -m 0644 "$root/ci/fetch-quic-test-runtime.sh" "$root/ci/woodpecker-agent-entrypoint.sh" "$cache/context/ci/"
|
||||
source "$root/ci/nativeaot-toolchain.sh"
|
||||
moshiro_nativeaot_settings "$root"
|
||||
podman build --layers --pull=missing --isolation chroot --network host \
|
||||
--build-arg "AOTANYWHERE_VERSION=$MOSHIRO_AOTANYWHERE_VERSION" --build-arg "ZIG_TOOLSET_VERSION=$MOSHIRO_ZIG_TOOLSET_VERSION" \
|
||||
-f "$root/packaging/container/NativeAot.Builder.Containerfile" -t "$builder_image" "$cache/context"
|
||||
# Export once per image ID. Isolated Buildah stores import this local archive,
|
||||
# so parallel architecture builds never download their toolchain from NuGet.
|
||||
builder_id="$(podman image inspect --format '{{.Id}}' "$builder_image")"
|
||||
builder_id="${builder_id#sha256:}"
|
||||
archive="$cache/nativeaot-builder-$builder_id.oci"
|
||||
if [[ ! -f "$archive" ]]; then
|
||||
podman save --format oci-archive -o "$archive.tmp" "$builder_image"
|
||||
mv "$archive.tmp" "$archive"
|
||||
fi
|
||||
printf '%s\n' "$builder_id" > "$cache/nativeaot-builder.id.tmp"
|
||||
mv "$cache/nativeaot-builder.id.tmp" "$cache/nativeaot-builder.id"
|
||||
printf '%s\n' "$MOSHIRO_NATIVEAOT_BUILDER_KEY" > "$cache/nativeaot-builder.key.tmp"
|
||||
mv "$cache/nativeaot-builder.key.tmp" "$cache/nativeaot-builder.key"
|
||||
podman build --layers --pull=missing --isolation chroot --network host \
|
||||
--build-arg "NATIVEAOT_BUILDER_IMAGE=$builder_image" \
|
||||
-f "$root/packaging/container/Woodpecker.Agent.Containerfile" -t "$runner_image" "$cache/context"
|
||||
echo "built $runner_image; unchanged tool layers are reused"
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
# Explicit storage paths also work when a rootless Podman agent runs as UID 0
|
||||
# inside its user namespace. Changing HOME alone then selects the system store.
|
||||
moshiro_setup_buildah() {
|
||||
local store_home="${1:?Buildah cache directory is required}"
|
||||
local config="$store_home/.config/containers/moshiro-storage.conf"
|
||||
local key runroot
|
||||
key="$(printf '%s' "$store_home" | sha256sum | cut -c1-16)"
|
||||
runroot="${XDG_RUNTIME_DIR:-/tmp}/moshiro-buildah-$(id -u)/$key"
|
||||
mkdir -p "$store_home/.local/share/containers/storage" "$(dirname "$config")" "$runroot"
|
||||
(
|
||||
umask 077
|
||||
printf '[storage]\ndriver = "%s"\ngraphroot = "%s"\nrunroot = "%s"\n' \
|
||||
"${STORAGE_DRIVER:-overlay}" "$store_home/.local/share/containers/storage" "$runroot" > "$config"
|
||||
)
|
||||
chmod 700 "$runroot"
|
||||
export CONTAINERS_STORAGE_CONF="$config"
|
||||
# The outer Podman container provides the user namespace and capabilities;
|
||||
# RUN does not need a second OCI runtime or nested cgroup management.
|
||||
export BUILDAH_ISOLATION="${BUILDAH_ISOLATION:-chroot}"
|
||||
buildah info >/dev/null
|
||||
echo "Buildah store: $store_home/.local/share/containers/storage ($BUILDAH_ISOLATION)"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
moshiro_nativeaot_settings() {
|
||||
local repo_root="${1:?repository root}"
|
||||
read -r MOSHIRO_AOTANYWHERE_VERSION MOSHIRO_ZIG_TOOLSET_VERSION < <(python3 - "$repo_root" <<'PY'
|
||||
import json, sys, xml.etree.ElementTree as ET
|
||||
from pathlib import Path
|
||||
root = Path(sys.argv[1])
|
||||
aot = json.loads((root / 'global.json').read_text())['msbuild-sdks']['StuDev.AotAnywhere']
|
||||
zig = next(p.attrib['VersionOverride'] for p in ET.parse(root / 'backend/Directory.Build.props').iter('PackageReference') if p.attrib.get('Include') == 'Vezel.Zig.Toolsets.linux-x64')
|
||||
print(aot, zig)
|
||||
PY
|
||||
)
|
||||
MOSHIRO_NATIVEAOT_BUILDER_KEY="$(
|
||||
{ cat "$repo_root/global.json" "$repo_root/packaging/container/NativeAot.Builder.Containerfile";
|
||||
printf '%s\n' "$MOSHIRO_AOTANYWHERE_VERSION" "$MOSHIRO_ZIG_TOOLSET_VERSION"; } \
|
||||
| tr -d '\r' | sha256sum | cut -d' ' -f1
|
||||
)"
|
||||
}
|
||||
@@ -25,10 +25,12 @@ source "$root/ci/version.sh"
|
||||
registry="${ZOT_REGISTRY:-registry.oeo.one}"
|
||||
repository="$registry/moshiro-dev/moshiro-$component"
|
||||
work="$root/.release/dev-image-index/$component"
|
||||
home="/home/justme/woodpecker/buildah-home/dev-node-index-$component"
|
||||
export HOME="$home"
|
||||
buildah_home="/home/justme/woodpecker/buildah-home/dev-node-index-$component"
|
||||
export HOME="$buildah_home"
|
||||
export REGISTRY_AUTH_FILE="$work/auth.json"
|
||||
mkdir -p "$work" "$home"
|
||||
mkdir -p "$work" "$buildah_home"
|
||||
source "$root/ci/buildah-env.sh"
|
||||
moshiro_setup_buildah "$buildah_home"
|
||||
|
||||
logged_in=false
|
||||
for attempt in 1 2 3 4; do
|
||||
|
||||
@@ -13,6 +13,11 @@ dir="${3:?manifest dir}"
|
||||
[[ -s "$dir/manifest.json" && -s "$dir/manifest.sig" ]] || { echo "$dir needs manifest.json and manifest.sig" >&2; exit 2; }
|
||||
|
||||
ref="${repository}-manifest:${channel}"
|
||||
if [[ -z "${CONTAINERS_STORAGE_CONF:-}" ]]; then
|
||||
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
source "$root/ci/buildah-env.sh"
|
||||
moshiro_setup_buildah "${BUILDAH_HOME:-/home/justme/woodpecker/buildah-home/manifest-${repository##*/}-$channel}"
|
||||
fi
|
||||
local_name="localhost/moshiro-manifest-build:$$"
|
||||
container="$(buildah from scratch)"
|
||||
trap 'buildah rm "$container" >/dev/null 2>&1 || true; buildah rmi "$local_name" >/dev/null 2>&1 || true' EXIT
|
||||
|
||||
@@ -66,6 +66,8 @@ install -m 0755 "$output/moshiro-backend" "$container_context/app/moshiro-backen
|
||||
buildah_home="${BUILDAH_HOME:-/home/justme/woodpecker/buildah-home/$arch}"
|
||||
mkdir -p "$buildah_home"
|
||||
export HOME="$buildah_home"
|
||||
source "$root/ci/buildah-env.sh"
|
||||
moshiro_setup_buildah "$buildah_home"
|
||||
|
||||
local_image="localhost/moshiro-backend:$version-$arch"
|
||||
buildah bud --tls-verify=true --arch "$arch" \
|
||||
|
||||
@@ -32,6 +32,8 @@ netrc="$work/netrc"
|
||||
buildah_home="/home/justme/woodpecker/buildah-home/node-images"
|
||||
mkdir -p "$buildah_home"
|
||||
export HOME="$buildah_home"
|
||||
source "$root/ci/buildah-env.sh"
|
||||
moshiro_setup_buildah "$buildah_home"
|
||||
mkdir -p "$work"
|
||||
chmod 700 "$work"
|
||||
printf 'machine %s login justme password %s\n' "$gitea_host" "$GITEA_TOKEN" > "$netrc"
|
||||
|
||||
@@ -73,9 +73,13 @@ fi
|
||||
|
||||
# 测试在缓存目录里跑完整的解决方案(不再重复编译)
|
||||
log="$cache/last-test.log"
|
||||
quic_runtime="$cache/quic-runtime"
|
||||
bash "$root/ci/fetch-quic-test-runtime.sh" "$quic_runtime"
|
||||
export LD_LIBRARY_PATH="$quic_runtime/runtime${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||
if [[ -n "${MOSHIRO_QUIC_TEST_RUNTIME:-}" ]]; then
|
||||
quic_runtime="$MOSHIRO_QUIC_TEST_RUNTIME"
|
||||
else
|
||||
quic_runtime="$cache/quic-runtime/runtime"
|
||||
bash "$root/ci/fetch-quic-test-runtime.sh" "$cache/quic-runtime"
|
||||
fi
|
||||
export LD_LIBRARY_PATH="$quic_runtime${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||
status=0
|
||||
# Each test module can spawn its own testhost. Run the whole command in a new
|
||||
# session and time out its process group, so orphaned testhosts cannot keep the
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
mkdir -p /home/justme/woodpecker/work "$NUGET_PACKAGES" "$NUGET_SCRATCH"
|
||||
chmod 700 "$NUGET_SCRATCH"
|
||||
# Seed the persistent application restore cache from the baked SDK/Zig packs.
|
||||
# Existing package versions are reused; this copies files without downloading.
|
||||
cp -a -n /root/.nuget/packages/. "$NUGET_PACKAGES/"
|
||||
exec /usr/local/bin/woodpecker-agent "$@"
|
||||
@@ -0,0 +1,24 @@
|
||||
[Unit]
|
||||
Description=Woodpecker agent in rootless Podman (WSL local backend)
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=justme
|
||||
Group=justme
|
||||
WorkingDirectory=/home/justme/woodpecker
|
||||
Environment=HOME=/home/justme
|
||||
Environment=XDG_RUNTIME_DIR=/run/user/1000
|
||||
ExecStartPre=-/usr/bin/podman rm --force woodpecker-agent-podman
|
||||
ExecStart=/usr/bin/podman run --rm --pull=never --name woodpecker-agent-podman --security-opt=seccomp=unconfined --cap-add=SYS_ADMIN --device=/dev/fuse --network=host --volume=/home/justme:/home/justme:rw,rslave --env-file=/home/justme/woodpecker/agent-podman.env localhost/moshiro-woodpecker-agent:ci
|
||||
ExecStop=-/usr/bin/podman stop --time 30 woodpecker-agent-podman
|
||||
ExecStopPost=-/usr/bin/podman rm --force woodpecker-agent-podman
|
||||
Restart=always
|
||||
RestartSec=10s
|
||||
TimeoutStopSec=45s
|
||||
KillMode=control-group
|
||||
UMask=0022
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
+11
-1
@@ -76,6 +76,16 @@ Woodpecker 在 `vMAJOR.MINOR.PATCH` tag 上,由 Windows runner 使用 AotAnywh
|
||||
|
||||
## CI 工作流
|
||||
|
||||
### Linux runner 的运行环境
|
||||
|
||||
Linux workflow 使用 `ci=domain-linux-native`、`platform=linux/amd64` 标签和 Woodpecker `local` backend;步骤里的 `image: bash` 是执行程序,构建工具来自 runner 环境。测试、前端和 Backend 编译使用 .NET 10、Node/npm、Python、clang 和 Zig;Agent/Probe 开发镜像通过 Buildah 构建独立的 NativeAOT builder,再在镜像里编译。
|
||||
|
||||
WSL 的 agent 通过 rootless Podman 运行,systemd 模板见 `ci/woodpecker-agent-podman.service`。工具全部在 `packaging/container/Woodpecker.Agent.Containerfile` 中安装,包括 .NET 10 SDK、Node/npm、Buildah、Git、Python、clang、Woodpecker agent/clone 插件和测试用 MsQuic 库;AotAnywhere SDK、Zig 与四个 Linux RID 的 NativeAOT 包由 `NativeAot.Builder.Containerfile` 预热。容器只把 `/home/justme` 作为可写工作区和缓存,不挂载宿主工具目录。连接信息与 7897 代理配置放在宿主 `/home/justme/woodpecker/agent-podman.env`,不要提交密钥。容器允许 `unshare`、提供 `SYS_ADMIN` 和 `/dev/fuse`,以便 Buildah 挂载镜像层;不要通过 `chroot /host` 启动 agent,因为 Linux 会拒绝 chroot 进程创建新的用户命名空间。
|
||||
|
||||
以 WSL 的 `justme` 用户运行 `bash ci/build-runner-image.sh` 构建工具镜像,验证后安装 systemd 模板并重启 agent。该脚本使用 Podman 的持久镜像层缓存和 `--pull=missing`,服务启动使用 `--pull=never`;流水线和服务重启都不会执行工具安装。NativeAOT builder 只在 SDK/工具版本或 Containerfile 改变时更新,不受每次开发构建的版本号影响。它按镜像 ID 导出到 `woodpecker/cache/runner-image`,各并行组件/架构的 Buildah store 从本地归档导入一次,之后直接复用镜像。只有所需归档不存在或工具配置改变时,构建脚本才回退到 Containerfile 构建。应用的 NuGet restore 缓存独立持久化在 `woodpecker/cache/nuget/packages`,启动时从镜像复制已有工具包作为初始缓存。
|
||||
|
||||
所有镜像构建、索引及签名清单发布脚本通过 `ci/buildah-env.sh` 显式配置 Buildah 的 `graphroot` 和 `runroot`。镜像层继续按组件/架构存放在各自的 `buildah-home` 下,运行状态留在当前 runner 的临时目录;容器内 UID 0 不再使各步骤落到同一个 `/var/lib/containers/storage`。`RUN` 默认使用 `chroot` isolation,避免额外的 OCI runtime/cgroup 嵌套;这与上面禁止的 agent 启动方式是不同阶段。
|
||||
|
||||
### Pull request 与 main 验证
|
||||
|
||||
Pull request 和 `main` 的 push 会跑三个 workflow:
|
||||
@@ -109,7 +119,7 @@ Pull request 和 `main` 的 push 会跑三个 workflow:
|
||||
| Agent | `registry.oeo.one/moshiro-dev/moshiro-agent:latest` | `registry.oeo.one/moshiro-dev/moshiro-agent:<版本>` |
|
||||
| Probe | `registry.oeo.one/moshiro-dev/moshiro-probe:latest` | `registry.oeo.one/moshiro-dev/moshiro-probe:<版本>` |
|
||||
|
||||
Agent、Probe 也发布架构固定标签 `:<版本>-amd64` 与 `:<版本>-arm64`。它们按对应 RID 在 `sdk:10.0-alpine-aot` 中构建,运行基底为 `runtime-deps:10.0-alpine`。开发镜像不创建 Gitea Release,也不修改正式版 `moshiro/` 仓库中的标签。普通 main push 不会构建镜像。节点和 Backend 判断自己是不是开发构建,看构建信息里的 tag 含 `-dev.`(旧的 `dev-<sha>`、`main-<sha>` 也认)。
|
||||
Agent、Probe 也发布架构固定标签 `:<版本>-amd64` 与 `:<版本>-arm64`。它们在 amd64 的 `sdk:10.0-noble-aot` 衍生 builder 中使用 AotAnywhere 编译 `linux-musl-x64` 和 `linux-musl-arm64`,ARM64 无需 QEMU;builder 预热项目固定版本的 AotAnywhere SDK、Zig 和 NativeAOT 包,不挂载宿主可写 NuGet 缓存。运行基底为 `runtime-deps:10.0-alpine`。开发镜像不创建 Gitea Release,也不修改正式版 `moshiro/` 仓库中的标签。普通 main push 不会构建镜像。节点和 Backend 判断自己是不是开发构建,看构建信息里的 tag 含 `-dev.`(旧的 `dev-<sha>`、`main-<sha>` 也认)。
|
||||
|
||||
### 正式版发布
|
||||
|
||||
|
||||
@@ -10,23 +10,29 @@ ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 \
|
||||
|
||||
WORKDIR /opt/aotanywhere
|
||||
COPY global.json ./global.json
|
||||
COPY Directory.Packages.props ./Directory.Packages.props
|
||||
COPY backend/Directory.Build.props ./backend/Directory.Build.props
|
||||
COPY backend/BannedSymbols.txt ./backend/BannedSymbols.txt
|
||||
|
||||
WORKDIR /opt/aotanywhere/backend
|
||||
ARG AOTANYWHERE_VERSION=1.0.5
|
||||
ARG ZIG_TOOLSET_VERSION=0.16.0.2
|
||||
# Only SDK/tool versions affect this layer. Application versions and sources
|
||||
# must not invalidate the expensive toolchain downloads on every pipeline.
|
||||
RUN printf '%s\n' \
|
||||
'<Project Sdk="Microsoft.NET.Sdk">' \
|
||||
' <Sdk Name="StuDev.AotAnywhere" />' \
|
||||
" <Sdk Name=\"StuDev.AotAnywhere\" Version=\"$AOTANYWHERE_VERSION\" />" \
|
||||
' <PropertyGroup>' \
|
||||
' <TargetFramework>net10.0</TargetFramework>' \
|
||||
' <OutputType>Exe</OutputType>' \
|
||||
' <PublishAot>true</PublishAot>' \
|
||||
' <UseAotAnywhere>true</UseAotAnywhere>' \
|
||||
' <NuGetAudit>false</NuGetAudit>' \
|
||||
' </PropertyGroup>' \
|
||||
' <ItemGroup>' \
|
||||
" <PackageReference Include=\"Vezel.Zig.Toolsets.linux-x64\" Version=\"$ZIG_TOOLSET_VERSION\" GeneratePathProperty=\"true\" />" \
|
||||
' </ItemGroup>' \
|
||||
'</Project>' > Warmup.csproj \
|
||||
&& dotnet restore Warmup.csproj -p:PublishAot=true -p:UseAotAnywhere=true -r linux-musl-x64 \
|
||||
&& dotnet restore Warmup.csproj -p:PublishAot=true -p:UseAotAnywhere=true -r linux-musl-arm64 \
|
||||
&& dotnet restore Warmup.csproj -p:PublishAot=true -p:UseAotAnywhere=true -r linux-x64 \
|
||||
&& dotnet restore Warmup.csproj -p:PublishAot=true -p:UseAotAnywhere=true -r linux-arm64 \
|
||||
&& rm Warmup.csproj \
|
||||
&& rm -rf artifacts
|
||||
&& rm -rf bin obj
|
||||
|
||||
WORKDIR /src/backend
|
||||
@@ -0,0 +1,33 @@
|
||||
ARG NATIVEAOT_BUILDER_IMAGE=localhost/moshiro-dotnet10-nativeaot-aotanywhere:ci
|
||||
FROM docker.io/library/node:24-bookworm-slim AS node
|
||||
FROM quay.io/woodpeckerci/woodpecker-agent:v3.18.1 AS agent
|
||||
FROM docker.io/woodpeckerci/plugin-git:2.6.0 AS clone
|
||||
FROM ${NATIVEAOT_BUILDER_IMAGE}
|
||||
|
||||
# Installed once when this image changes, never in a pipeline step.
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
buildah fuse-overlayfs uidmap runc python3 git git-lfs openssh-client \
|
||||
curl ca-certificates openssl util-linux binutils xz-utils unzip make \
|
||||
clang lld zlib1g-dev libssl-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=node /usr/local/ /usr/local/
|
||||
COPY --from=agent /bin/woodpecker-agent /usr/local/bin/woodpecker-agent
|
||||
COPY --from=clone /bin/plugin-git /usr/local/bin/plugin-git
|
||||
|
||||
# Test sidecars are also downloaded into a reusable image layer.
|
||||
COPY ci/fetch-quic-test-runtime.sh /opt/moshiro/fetch-quic-test-runtime.sh
|
||||
RUN bash /opt/moshiro/fetch-quic-test-runtime.sh /opt/moshiro/quic
|
||||
COPY ci/woodpecker-agent-entrypoint.sh /usr/local/bin/moshiro-ci-entrypoint
|
||||
RUN chmod 0755 /usr/local/bin/moshiro-ci-entrypoint
|
||||
|
||||
ENV WOODPECKER_IN_CONTAINER=true \
|
||||
WOODPECKER_BACKEND=local \
|
||||
WOODPECKER_AGENT_LABELS=ci=domain-linux-native \
|
||||
WOODPECKER_BACKEND_LOCAL_TEMP_DIR=/home/justme/woodpecker/work \
|
||||
MOSHIRO_QUIC_TEST_RUNTIME=/opt/moshiro/quic/runtime \
|
||||
NUGET_SCRATCH=/home/justme/woodpecker/cache/nuget/scratch \
|
||||
NUGET_PACKAGES=/home/justme/woodpecker/cache/nuget/packages \
|
||||
BUILDAH_ISOLATION=chroot
|
||||
WORKDIR /home/justme/woodpecker
|
||||
ENTRYPOINT ["/usr/local/bin/moshiro-ci-entrypoint"]
|
||||
Reference in new issue
Block a user