buildah unshare fails on the CI host with memfd_create: Invalid argument, so extract-node-binaries.sh failed right after a successful native build. Exporting an OCI archive needs no mount (the toolchain archive already works that way); extract-oci-files.py reads the files from the layers, later layers win and whiteouts delete.
12 lines
658 B
Bash
Executable File
12 lines
658 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# 从构建出的镜像里取出 moshiro-agent 和 fleet-enroll,不挂载镜像:
|
|
# buildah unshare / mount 在 CI 主机上报 memfd_create: Invalid argument,而导出 OCI 归档不需要挂载(工具链归档也是这样做的)。
|
|
set -euo pipefail
|
|
image="${1:?usage: extract-node-binaries.sh <image> <destination>}"
|
|
destination="${2:?}"
|
|
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
work="$(mktemp -d)"
|
|
trap 'rm -rf "$work"' EXIT
|
|
buildah push --format oci "$image" "oci-archive:$work/image.tar"
|
|
python3 "$root/ci/extract-oci-files.py" "$work/image.tar" "$destination" out/agent/moshiro-agent out/enroll/fleet-enroll
|