Skip to content

Enable runtime YAML export for copy workflows#15

Merged
Sodawyx merged 2 commits into
Serverless-Devs:mainfrom
zoeshawwang:feat/runtime-export-yaml
Jun 9, 2026
Merged

Enable runtime YAML export for copy workflows#15
Sodawyx merged 2 commits into
Serverless-Devs:mainfrom
zoeshawwang:feat/runtime-export-yaml

Conversation

@zoeshawwang

Copy link
Copy Markdown

Add a read-only runtime export command that emits apply-compatible YAML for existing container runtimes and endpoints, plus docs and integration coverage. Keep the implementation bounded to fields already accepted by the runtime YAML parser.

Constraint: Export output must round-trip through ar runtime apply without carrying server-owned IDs or status fields.

Rejected: Reconstructing cloudBuild from remote runtime state | cloudBuild depends on local source and build settings that are not recoverable from the service.

Confidence: high

Scope-risk: narrow

Directive: Treat exported registry auth as sensitive if returned by the service; review YAML before sharing.

Tested: ruff check src/ tests/; ruff format --check src/ tests/; mypy src/agentrun_cli; pytest tests/integration/test_runtime_cmd.py -v; pytest tests/unit tests/integration --cov=agentrun_cli --cov-fail-under=95; live cn-hangzhou export/apply/status smoke for cli-export-verify-20260609213323.

Change-Id: Ib7d4b629bbb2e377213b3aa302d7d78d13c7f066
Co-developed-by: Codex noreply@openai.com
Not-tested: cleanup/delete of live verification runtime was intentionally not performed without explicit deletion confirmation.

Add a read-only runtime export command that emits apply-compatible YAML for existing container runtimes and endpoints, plus docs and integration coverage. Keep the implementation bounded to fields already accepted by the runtime YAML parser.

Constraint: Export output must round-trip through ar runtime apply without carrying server-owned IDs or status fields.

Rejected: Reconstructing cloudBuild from remote runtime state | cloudBuild depends on local source and build settings that are not recoverable from the service.

Confidence: high

Scope-risk: narrow

Directive: Treat exported registry auth as sensitive if returned by the service; review YAML before sharing.

Tested: ruff check src/ tests/; ruff format --check src/ tests/; mypy src/agentrun_cli; pytest tests/integration/test_runtime_cmd.py -v; pytest tests/unit tests/integration --cov=agentrun_cli --cov-fail-under=95; live cn-hangzhou export/apply/status smoke for cli-export-verify-20260609213323.

Change-Id: Ib7d4b629bbb2e377213b3aa302d7d78d13c7f066
Co-developed-by: Codex <noreply@openai.com>
Not-tested: cleanup/delete of live verification runtime was intentionally not performed without explicit deletion confirmation.
Signed-off-by: congxiao.wxx <congxiao.wxx@alibaba-inc.com>
Copilot AI review requested due to automatic review settings June 9, 2026 13:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new ar runtime export command to export an existing Agent Runtime into apply-ready YAML, and updates docs/tests accordingly.

Changes:

  • Introduced runtime export CLI subcommand and YAML conversion helper (runtime_to_yaml_doc).
  • Added integration tests covering stdout export, file output, and error cases.
  • Documented the new command in English and Chinese runtime docs.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/integration/test_runtime_cmd.py Adds integration tests validating runtime export output and edge cases.
src/agentrun_cli/commands/runtime/export_cmd.py Implements ar runtime export and runtime-to-YAML conversion helpers.
src/agentrun_cli/commands/runtime/init.py Registers the new export command in the runtime command group.
src/agentrun_cli/_utils/cloud_build.py Minor normalization of sys.platform handling in _go_platform().
docs/zh/runtime.md Documents the new export command (Chinese).
docs/en/runtime.md Documents the new export command (English).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +184 to +188
auth = _get(registry, "auth_config", "authConfig", "auth")
auth_out: dict[str, Any] = {}
_set_if_present(auth_out, "userName", _get(auth, "user_name", "userName"))
_set_if_present(auth_out, "password", _get(auth, "password"))
_set_if_present(out, "auth", auth_out)
Comment on lines +147 to +148
if hasattr(runtime, "list_endpoints"):
spec["endpoints"] = [_export_endpoint(ep) for ep in runtime.list_endpoints()]
Comment thread tests/integration/test_runtime_cmd.py Outdated
)
assert result.exit_code == 0, result.output
assert result.output == ""
out = yaml.safe_load(open("runtime.yaml", encoding="utf-8"))
Default export output now omits registry passwords unless the caller explicitly passes --include-secrets. Empty endpoint lists are omitted so apply keeps its default endpoint behavior, and the file-output test closes handles explicitly.

Constraint: Review feedback identified secret leakage and empty-endpoint semantic drift risks.

Rejected: Always exporting passwords with only documentation warnings | stdout/file exports can leak secrets by default.

Confidence: high

Scope-risk: narrow

Directive: Keep sensitive fields opt-in for future export surfaces.

Tested: ruff check src/ tests/; ruff format --check src/ tests/; mypy src/agentrun_cli; pytest tests/integration/test_runtime_cmd.py -v; pytest tests/unit tests/integration --cov=agentrun_cli --cov-fail-under=95
Signed-off-by: congxiao.wxx <congxiao.wxx@alibaba-inc.com>

Change-Id: I3fb430af1fc41cf581911a5b84a1dd1c0941760b
Co-developed-by: Codex <noreply@openai.com>
@Sodawyx Sodawyx merged commit 9473e6b into Serverless-Devs:main Jun 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants