-
Notifications
You must be signed in to change notification settings - Fork 7
[codex] Add runtime deploy local skill #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
117503445
wants to merge
4
commits into
main
Choose a base branch
from
add-agentrun-runtime-deploy-skill
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| --- | ||
| name: run-your-agents | ||
| description: 将当前项目整理并部署为 AgentRun Runtime,使用 agentrun-cli 的 ar runtime apply 与 cloudBuild 能力。Use when 用户要求把项目发布、部署、上线到 AgentRun runtime,提到 agentruntime.yaml、ar runtime apply、cloudBuild、docker-image-builder、AgentRun CLI runtime 部署,或需要补 scripts/setup.sh 和 scripts/start.sh。 | ||
| --- | ||
|
|
||
| # AgentRun CLI Runtime 部署 | ||
|
|
||
| ## 基本流程 | ||
|
|
||
| 1. 检查项目启动方式、依赖安装方式和运行端口,确定 runtime 名称、目标镜像和镜像仓库类型。 | ||
| 2. 补充可重复执行的 `scripts/setup.sh`。脚本在云端构建环境中运行,用于安装依赖、构建前端或准备运行目录。 | ||
| 3. 补充 `scripts/start.sh`。脚本必须读取环境变量 `PORT`,默认使用 `9000`,并绑定 `0.0.0.0`。 | ||
| 4. 编写 `agentruntime.yaml`,在 `spec.container.cloudBuild` 中声明云构建参数。 | ||
| 5. 运行 `ar runtime apply -f agentruntime.yaml --timeout 20m`。命令默认等待 runtime 和 endpoint 到终态。 | ||
| 6. 成功后从输出中的 `endpoints[].publicUrl` 获取公网访问地址,并按项目协议做访问验证。 | ||
|
|
||
| ## 脚本要求 | ||
|
|
||
| `scripts/setup.sh` 应该可重复执行。只做构建期动作,例如安装依赖、编译前端、生成静态资源、准备运行目录。不要在脚本中写入密钥;密钥放入 `.env` 或运行环境变量,并确保不会进入 VCS。 | ||
|
|
||
| `scripts/start.sh` 应该只负责启动服务。示例: | ||
|
|
||
| ```bash | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| PORT="${PORT:-9000}" | ||
| HOST="${HOST:-0.0.0.0}" | ||
|
|
||
| exec your-server-command --host "$HOST" --port "$PORT" | ||
| ``` | ||
|
|
||
| ## Runtime YAML 示例 | ||
|
|
||
| ```yaml | ||
| apiVersion: agentrun/v1 | ||
| kind: AgentRuntime | ||
| metadata: | ||
| name: my-runtime | ||
| spec: | ||
| container: | ||
| image: registry.cn-hangzhou.aliyuncs.com/my-ns/my-agent:v1 | ||
| command: ["bash", "-lc", "exec bash scripts/start.sh"] | ||
| cloudBuild: | ||
| dir: . | ||
| setupScript: scripts/setup.sh | ||
| timeoutMinutes: 20 | ||
| cpu: 4 | ||
| memory: 8192 | ||
| port: 9000 | ||
| ``` | ||
|
|
||
| `spec.container.cloudBuild` 会在部署前调用 docker-image-builder 云构建镜像;目标镜像就是 `spec.container.image`。 | ||
|
|
||
| ## 镜像仓库 | ||
|
|
||
| - `cloudBuild` YAML 不支持 `registryMode` 字段;仅支持标准 OCI registry 模式。 | ||
| - 如果设置了 `DOCKER_IMAGE_BUILDER_BINPATH`,agentrun-cli 会优先使用该路径的 docker-image-builder。 | ||
| - 镜像仓库推送账号可通过 `DOCKER_IMAGE_BUILDER_USERNAME` 和 `DOCKER_IMAGE_BUILDER_PASSWORD` 提供;docker-image-builder 也兼容 `DOCKER_IMAGE_BUILDER_REGISTRY_USERNAME` 和 `DOCKER_IMAGE_BUILDER_REGISTRY_PASSWORD`。 | ||
| - runtime 拉取私有镜像时,在 `spec.container.registryConfig.auth.userName` 和 `password` 中配置仓库账号密码;字段名必须是 `userName`,不是 `username`。 | ||
| - 使用 ACR 企业版镜像时,可设置 `spec.container.imageRegistryType: ACREE` 和 `spec.container.acrInstanceId`。 | ||
|
|
||
| ## 验证命令 | ||
|
|
||
| ```bash | ||
| ar runtime render -f agentruntime.yaml | ||
| ar runtime apply -f agentruntime.yaml --timeout 20m | ||
| ``` | ||
|
|
||
| `render` 用于部署前校验和预览 SDK 输入;`apply` 默认等待 runtime 和 endpoint 到终态。 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里需要在 YAML 示例后补上 closing fence(
)。当前 head 里 `yaml ` 没有关掉,后面的“镜像仓库”和“验证命令”都会被 Markdown 渲染进代码块。