需要ci cd #3

Closed
opened 2026-04-07 09:31:27 +00:00 by fam · 9 comments
Owner

@ms 这样合并主线以后,自动部署到线上。

@ms 这样合并主线以后,自动部署到线上。
Owner

PR 开好了:#4

做了什么:

新增 .gitea/workflows/deploy.yml,push 到 master 自动触发:

checkout → npm ci → make deploy-oci

make deploy-oci 内部干的事:

  1. Rust cross-compile → aarch64-unknown-linux-musl
  2. Vite 打包前端
  3. scp 上传到 oci.euphon.net
  4. 在 OCI 上构建 Alpine 镜像 + import 进 k3s
  5. kubectl apply 全部 manifests + rollout restart

Runner 用的 self-hosted(host 模式跑在 cpc-i7),SSH 密钥直接用机器上的,不用额外配 secrets,干净。

看看 PR 没问题就合了~

PR 开好了:https://git.euphon.cloud/euphon/repo-vis/pulls/4 **做了什么:** 新增 `.gitea/workflows/deploy.yml`,push 到 `master` 自动触发: ``` checkout → npm ci → make deploy-oci ``` `make deploy-oci` 内部干的事: 1. Rust cross-compile → `aarch64-unknown-linux-musl` 2. Vite 打包前端 3. scp 上传到 `oci.euphon.net` 4. 在 OCI 上构建 Alpine 镜像 + import 进 k3s 5. `kubectl apply` 全部 manifests + rollout restart Runner 用的 `self-hosted`(host 模式跑在 cpc-i7),SSH 密钥直接用机器上的,不用额外配 secrets,干净。 看看 PR 没问题就合了~
Author
Owner

已经合了?@ms

已经合了?@ms
Owner

Claude timed out after 10 minutes.

*Claude timed out after 10 minutes.*
Author
Owner

@ms

@ms
Owner

Claude timed out after 10 minutes.

*Claude timed out after 10 minutes.*
Author
Owner

pipeline 失败了

pipeline 失败了
Author
Owner

再看看,怎么回事

再看看,怎么回事
Author
Owner

@ms

@ms
Owner

找到了,bug 很清楚。

根因: Makefile 第 43 行用 heredoc 通过 SSH 写 Dockerfile,但 make recipe 里行尾的 \ 是续行符,\n\ 这个组合导致整个内容被展开成一行传给远端 shell。远端收到的是 <<DEOF\nFROM alpine...,shell 把 DEOF\nFROM 当成了 heredoc 结束符,所以报:

wanted `DEOFnFROM'
cat: unrecognized option '--no-cache'

修法: 把 Dockerfile 提取成独立文件 Dockerfile.oci,直接 scp 过去,heredoc 问题彻底消失。

PR 开好了:#7

找到了,bug 很清楚。 **根因:** Makefile 第 43 行用 heredoc 通过 SSH 写 Dockerfile,但 make recipe 里行尾的 `\` 是续行符,`\n\` 这个组合导致整个内容被展开成**一行**传给远端 shell。远端收到的是 `<<DEOF\nFROM alpine...`,shell 把 `DEOF\nFROM` 当成了 heredoc 结束符,所以报: ``` wanted `DEOFnFROM' cat: unrecognized option '--no-cache' ``` **修法:** 把 Dockerfile 提取成独立文件 `Dockerfile.oci`,直接 `scp` 过去,heredoc 问题彻底消失。 PR 开好了:https://git.euphon.cloud/euphon/repo-vis/pulls/7
fam closed this issue 2026-04-09 20:32:32 +00:00
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: euphon/repo-vis#3