Skip to content

cli: Implement cloud build functionality in BuildRuntime#435

Open
singhshresth26 wants to merge 2 commits into
volcano-sh:mainfrom
singhshresth26:feat/cli-cloud-build
Open

cli: Implement cloud build functionality in BuildRuntime#435
singhshresth26 wants to merge 2 commits into
volcano-sh:mainfrom
singhshresth26:feat/cli-cloud-build

Conversation

@singhshresth26

Copy link
Copy Markdown

What type of PR is this?

/kind enhancement

What this PR does / why we need it:
This PR implements the simulated cloud build strategy (_build_cloud method) in the CLI BuildRuntime.

When a user specifies --build-mode cloud (or configures it in agent_metadata.yaml), the CLI will:

  1. Simulate packaging and archiving the agent workspace.
  2. Simulate triggering and running a remote build on the configured cloud provider (default: Huawei Cloud).
  3. Resolve the remote image destination (using a default cloud SWR registry template if no registry URL is set).
  4. Persist the image build information with build_mode: cloud to agent_metadata.yaml.

It also adds comprehensive unit tests in cmd/cli/tests/test_build_runtime.py covering both the local and cloud build paths.

Which issue(s) this PR fixes:
Fixes #434

Special notes for your reviewer:
This resolves the first code issue/TODO placeholder (# TODO: Implement cloud build functionality) in build_runtime.py.

Does this PR introduce a user-facing change?:

cli: Implement cloud build mode support in build command

Copilot AI review requested due to automatic review settings July 10, 2026 16:13
@volcano-sh-bot volcano-sh-bot added the kind/enhancement New feature or request label Jul 10, 2026
@volcano-sh-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign yaozengzeng for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@volcano-sh-bot

Copy link
Copy Markdown
Contributor

Welcome @singhshresth26! It looks like this is your first PR to volcano-sh/agentcube 🎉

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request implements the cloud build functionality in _build_cloud for BuildRuntime and adds corresponding unit tests. The feedback suggests returning the fully qualified image name (including the tag) instead of just the registry URL in _build_cloud to maintain consistency with local builds, and updating the unit test assertions accordingly.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +244 to +250
return {
"image_name": registry_url,
"image_tag": tag,
"image_size": build_size,
"build_time": build_time,
"build_mode": "cloud"
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The return dictionary for _build_cloud returns registry_url as the image_name. However, in _build_local, the returned image_name is the fully qualified image name including the tag (e.g., image_name:tag). To maintain consistency across local and cloud build modes, _build_cloud should return the fully qualified image_name (which is already constructed on line 227 as f"{registry_url}:{tag}") instead of just the registry_url.

Suggested change
return {
"image_name": registry_url,
"image_tag": tag,
"image_size": build_size,
"build_time": build_time,
"build_mode": "cloud"
}
return {
"image_name": image_name,
"image_tag": tag,
"image_size": build_size,
"build_time": build_time,
"build_mode": "cloud"
}

Comment on lines +85 to +87
assert result["build_mode"] == "cloud"
assert result["image_name"] == "swr.cn-east-3.myhuaweicloud.com/agentcube/test-agent"
assert result["image_tag"] == "0.0.3"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Update the test assertion to expect the fully qualified image name (including the tag) to align with the consistency improvement in _build_cloud.

Suggested change
assert result["build_mode"] == "cloud"
assert result["image_name"] == "swr.cn-east-3.myhuaweicloud.com/agentcube/test-agent"
assert result["image_tag"] == "0.0.3"
assert result["build_mode"] == "cloud"
assert result["image_name"] == "swr.cn-east-3.myhuaweicloud.com/agentcube/test-agent:0.0.3"
assert result["image_tag"] == "0.0.3"

@codecov-commenter

codecov-commenter commented Jul 10, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.56%. Comparing base (3b19390) to head (3f5033f).
⚠️ Report is 21 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #435      +/-   ##
==========================================
+ Coverage   58.41%   58.56%   +0.14%     
==========================================
  Files          36       36              
  Lines        3463     3463              
==========================================
+ Hits         2023     2028       +5     
+ Misses       1231     1227       -4     
+ Partials      209      208       -1     
Flag Coverage Δ
unittests 58.56% <ø> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a simulated cloud build path to the AgentCube CLI BuildRuntime so users can run agentcube build with --build-mode cloud and have the CLI resolve a cloud registry destination and persist build information into agent_metadata.yaml.

Changes:

  • Implemented _build_cloud() in BuildRuntime to simulate a remote build and update metadata with cloud build details.
  • Added unit tests covering local and cloud build flows.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
cmd/cli/agentcube/runtime/build_runtime.py Implements the cloud build strategy and metadata persistence for cloud builds.
cmd/cli/tests/test_build_runtime.py Adds tests for both local and cloud build paths.


# For MVP, fall back to local build
return self._build_local(workspace_path, metadata, options)
cloud_provider = options.get("cloud_provider") or metadata.region or "huawei"
Comment on lines +234 to +250
image_info = {
"repository_url": registry_url,
"tag": tag,
"build_mode": "cloud",
"build_size": build_size,
"build_time": build_time
}
updates = {"image": image_info}
self.metadata_service.update_metadata(workspace_path, updates)

return {
"image_name": registry_url,
"image_tag": tag,
"image_size": build_size,
"build_time": build_time,
"build_mode": "cloud"
}
"agent_name": "test-agent",
"entrypoint": "python main.py",
"build_mode": "local",
"version": "0.0.1",
Comment on lines +85 to +94
assert result["build_mode"] == "cloud"
assert result["image_name"] == "swr.cn-east-3.myhuaweicloud.com/agentcube/test-agent"
assert result["image_tag"] == "0.0.3"

# Check metadata got updated with cloud build mode
metadata = runtime.metadata_service.load_metadata(ws)
assert metadata.image is not None
assert metadata.image["build_mode"] == "cloud"
assert metadata.image["repository_url"] == "swr.cn-east-3.myhuaweicloud.com/agentcube/test-agent"
assert metadata.image["tag"] == "0.0.3"
Copilot AI review requested due to automatic review settings July 10, 2026 16:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment on lines +221 to +227
# If registry_url is defined, use it. Otherwise construct a cloud SWR registry URL.
registry_url = metadata.registry_url
if not registry_url:
region = metadata.region or "cn-east-3"
registry_url = f"swr.{region}.myhuaweicloud.com/agentcube/{agent_name}"

image_name = f"{registry_url}:{tag}"
Comment on lines +209 to +213
cloud_provider = options.get("cloud_provider") or "huawei"

logger.info(f"Initiating cloud build using provider: {cloud_provider}")
logger.info(f"Packaging workspace {workspace_path} for cloud build...")
logger.info(f"Uploading workspace to {cloud_provider} build service...")
Comment on lines +70 to +94
with tempfile.TemporaryDirectory() as tmpdir:
ws = Path(tmpdir)
self._write_yaml(ws / "agent_metadata.yaml", {
"agent_name": "test-agent",
"entrypoint": "python main.py",
"build_mode": "cloud",
"version": "0.0.2",
})
(ws / "main.py").touch()
(ws / "requirements.txt").touch()
(ws / "Dockerfile").touch()

runtime = BuildRuntime(verbose=True)
result = runtime.build(ws, cloud_provider="huawei")

assert result["build_mode"] == "cloud"
assert result["image_name"] == "swr.cn-east-3.myhuaweicloud.com/agentcube/test-agent:0.0.3"
assert result["image_tag"] == "0.0.3"

# Check metadata got updated with cloud build mode
metadata = runtime.metadata_service.load_metadata(ws)
assert metadata.image is not None
assert metadata.image["build_mode"] == "cloud"
assert metadata.image["repository_url"] == "swr.cn-east-3.myhuaweicloud.com/agentcube/test-agent:0.0.3"
assert metadata.image["tag"] == "0.0.3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement New feature or request size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement cloud build functionality in BuildRuntime

4 participants