Skip to content

Commit 5b33127

Browse files
committed
fix: update CR instance set instance type to Micro and release 0.1.14
- Change provider tag value from "veadk" to "agentkit-cli" for better identification - Add Type field set to "Micro" for CR instance creation - Bump version from 0.1.13 to 0.1.14 (cherry picked from commit 83344e71ecf2a7cc046a5e7616ef6303b501e542)
1 parent 3c03c54 commit 5b33127

File tree

10 files changed

+95
-62
lines changed

10 files changed

+95
-62
lines changed

agentkit/toolkit/builders/ve_pipeline.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class VeCPCRBuilderConfig(AutoSerializableMixin):
5454
cr_instance_name: str = field(default=AUTO_CREATE_VE, metadata={"description": "CR instance name", "render_template": True})
5555
cr_namespace_name: str = field(default=AUTO_CREATE_VE, metadata={"description": "CR namespace", "render_template": True})
5656
cr_repo_name: str = field(default=AUTO_CREATE_VE, metadata={"description": "CR repository name"})
57+
cr_auto_create_instance_type: str = field(default="Micro", metadata={"description": "CR instance type when auto-creating (Micro or Enterprise)"})
5758
cr_region: str = field(default="cn-beijing", metadata={"description": "CR region"})
5859

5960
cp_workspace_name: str = field(default=DEFAULT_WORKSPACE_NAME, metadata={"description": "Code Pipeline workspace name"})
@@ -702,6 +703,7 @@ def _prepare_cr_resources(self, config: VeCPCRBuilderConfig) -> CRServiceConfig:
702703
instance_name=config.cr_instance_name,
703704
namespace_name=config.cr_namespace_name,
704705
repo_name=config.cr_repo_name,
706+
auto_create_instance_type=config.cr_auto_create_instance_type,
705707
region=config.cr_region
706708
)
707709

@@ -730,17 +732,14 @@ def config_updater(service: str, cr_config_dict: Dict[str, Any]) -> None:
730732
cr_result = cr_service.ensure_cr_resources(cr_config, common_config)
731733

732734
if not cr_result.success:
733-
error_msg = f"CR resource preparation failed: {cr_result.error}"
734-
self.reporter.error(error_msg)
735-
raise Exception(error_msg)
735+
raise Exception(cr_result.error)
736736

737737
# Ensure public endpoint access for image pulls
738738
self.reporter.info("Ensuring CR public endpoint access...")
739739
public_result = cr_service.ensure_public_endpoint(cr_config)
740740

741741
if not public_result.success:
742742
error_msg = f"Public endpoint configuration failed: {public_result.error}"
743-
self.reporter.error(error_msg)
744743
raise Exception(error_msg)
745744

746745
self.reporter.success("CR resource preparation completed")

agentkit/toolkit/cli/cli_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ def _handle_global_config(show: bool, set_field: Optional[str], init_global: boo
272272
console.print(" [dim]CR:[/dim]")
273273
console.print(" • [green]cr.instance_name[/green] - CR instance name")
274274
console.print(" • [green]cr.namespace_name[/green] - CR namespace")
275+
console.print(" • [green]cr.auto_create_instance_type[/green] - Instance type when auto-creating (Micro/Enterprise)")
275276
console.print(" [dim]TOS:[/dim]")
276277
console.print(" • [green]tos.bucket[/green] - Bucket name")
277278
console.print(" • [green]tos.prefix[/green] - Object prefix")
@@ -315,6 +316,7 @@ def _init_global_config():
315316
console.print("\n[bold]📦 CR Configuration[/bold]")
316317
console.print(" instance_name: '' # CR instance name")
317318
console.print(" namespace_name: '' # CR namespace")
319+
console.print(" auto_create_instance_type: Micro # Instance type when auto-creating (Micro/Enterprise)")
318320

319321
console.print("\n[bold]🗂️ TOS Configuration[/bold]")
320322
console.print(" bucket: '' # TOS bucket name")
@@ -363,6 +365,7 @@ def _show_global_config():
363365
console.print("\n[bold]📦 CR Configuration[/bold]")
364366
console.print(f" Instance: [yellow]{config.cr.instance_name or '[dim](not set)[/dim]'}[/yellow]")
365367
console.print(f" Namespace: [yellow]{config.cr.namespace_name or '[dim](not set)[/dim]'}[/yellow]")
368+
console.print(f" Auto-create Type: [yellow]{config.cr.auto_create_instance_type}[/yellow]")
366369

367370
# Display TOS configuration
368371
console.print("\n[bold]🗂️ TOS Configuration[/bold]")
@@ -395,6 +398,7 @@ def _set_global_field(field_value: str):
395398
console.print(" • volcengine.secret_key")
396399
console.print(" • volcengine.region")
397400
console.print(" • cr.instance_name")
401+
console.print(" • cr.auto_create_instance_type")
398402
console.print(" • cr.namespace_name")
399403
console.print(" • tos.bucket")
400404
console.print(" • tos.prefix")

agentkit/toolkit/config/global_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,21 @@ class CRGlobalConfig:
6767
"""
6868
instance_name: str = ""
6969
namespace_name: str = ""
70+
auto_create_instance_type: str = "Micro" # Instance type when auto-creating: "Micro" or "Enterprise"
7071

7172
def to_dict(self):
7273
return {
7374
"instance_name": self.instance_name,
7475
"namespace_name": self.namespace_name,
76+
"auto_create_instance_type": self.auto_create_instance_type,
7577
}
7678

7779
@classmethod
7880
def from_dict(cls, data: dict):
7981
return cls(
8082
instance_name=data.get("instance_name", ""),
8183
namespace_name=data.get("namespace_name", ""),
84+
auto_create_instance_type=data.get("auto_create_instance_type", "Micro"),
8285
)
8386

8487

@@ -324,6 +327,7 @@ def apply_global_config_defaults(
324327
field_mappings = {
325328
'cr_instance_name': ('cr', 'instance_name'),
326329
'cr_namespace_name': ('cr', 'namespace_name'),
330+
'cr_auto_create_instance_type': ('cr', 'auto_create_instance_type'),
327331
}
328332

329333
# For VeAgentkitConfig, also apply TOS-related settings

agentkit/toolkit/config/strategy_configs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class HybridStrategyConfig(AutoSerializableMixin):
5858
cr_instance_name: str = field(default=AUTO_CREATE_VE, metadata={"description": "Container Registry instance name", "icon": "📦", "render_template": True, "default_template": DEFAULT_CR_INSTANCE_TEMPLATE_NAME, "aliases": ["ve_cr_instance_name"]})
5959
cr_namespace_name: str = field(default=DEFAULT_CR_NAMESPACE, metadata={"description": "Container Registry namespace", "icon": "📁", "render_template": True, "aliases": ["ve_cr_namespace_name"]})
6060
cr_repo_name: str = field(default="", metadata={"description": "Container Registry repository name", "icon": "📋", "aliases": ["ve_cr_repo_name"]})
61+
cr_auto_create_instance_type: str = field(default="Micro", metadata={"description": "CR instance type when auto-creating (Micro or Enterprise)", "icon": "⚙️"})
6162
cr_image_full_url: str = field(default="", metadata={"system": True, "description": "Full Container Registry image URL", "aliases": ["ve_cr_image_full_url"]})
6263

6364
# Runtime configuration
@@ -112,6 +113,7 @@ class CloudStrategyConfig(AutoSerializableMixin):
112113
cr_instance_name: str = field(default=AUTO_CREATE_VE, metadata={"description": "Container Registry instance name", "icon": "📦", "render_template": True, "default_template": DEFAULT_CR_INSTANCE_TEMPLATE_NAME, "aliases": ["ve_cr_instance_name"]})
113114
cr_namespace_name: str = field(default=DEFAULT_CR_NAMESPACE, metadata={"description": "Container Registry namespace", "icon": "📁", "render_template": True, "aliases": ["ve_cr_namespace_name"]})
114115
cr_repo_name: str = field(default="", metadata={"description": "Container Registry repository name (defaults to AgentKit project name)", "icon": "📋", "aliases": ["ve_cr_repo_name"]})
116+
cr_auto_create_instance_type: str = field(default="Micro", metadata={"description": "CR instance type when auto-creating (Micro or Enterprise)", "icon": "⚙️"})
115117
cr_region: str = field(default="cn-beijing", metadata={"system": True, "description": "Container Registry service region", "aliases": ["ve_cr_region"]})
116118
cr_image_full_url: str = field(default="", metadata={"system": True, "description": "Full Container Registry image URL", "aliases": ["ve_cr_image_full_url"]})
117119
build_timeout: int = field(default=3600, metadata={"system": True, "description": "Build timeout in seconds"})

agentkit/toolkit/strategies/cloud_strategy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ def _to_builder_config(self, common_config: CommonConfig,
265265
cr_instance_name=strategy_config.cr_instance_name,
266266
cr_namespace_name=strategy_config.cr_namespace_name,
267267
cr_repo_name=strategy_config.cr_repo_name,
268+
cr_auto_create_instance_type=strategy_config.cr_auto_create_instance_type,
268269
cr_region=strategy_config.cr_region,
269270
cp_workspace_name=strategy_config.cp_workspace_name,
270271
cp_pipeline_name=cp_pipeline_name_override or strategy_config.cp_pipeline_name,

agentkit/toolkit/strategies/hybrid_strategy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ def _handle_cr_push(self, common_config: CommonConfig, result: BuildResult, stra
296296
cr_cfg = CRServiceConfig(
297297
instance_name=strategy_config.cr_instance_name,
298298
namespace_name=strategy_config.cr_namespace_name,
299-
repo_name=cr_repo_name
299+
repo_name=cr_repo_name,
300+
auto_create_instance_type=strategy_config.cr_auto_create_instance_type
300301
)
301302
cr_service = CRService(reporter=self.reporter)
302303
ensure_result = cr_service.ensure_cr_resources(cr_cfg, common_config=common_config)

agentkit/toolkit/volcengine/cr.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,27 @@ def __init__(self, access_key: str, secret_key: str, region: str = "cn-beijing")
3131
assert region in ["cn-beijing", "cn-guangzhou", "cn-shanghai"]
3232
self.version = "2022-05-12"
3333

34-
def _create_instance(self, instance_name: str = DEFAULT_CR_INSTANCE_NAME) -> str:
34+
def _create_instance(
35+
self,
36+
instance_name: str = DEFAULT_CR_INSTANCE_NAME,
37+
instance_type: str = "Micro"
38+
) -> str:
3539
"""
36-
create cr instance
40+
Create CR instance.
3741
3842
Args:
39-
instance_name: cr instance name
43+
instance_name: CR instance name.
44+
instance_type: Instance type, must be "Micro" or "Enterprise". Defaults to "Micro".
4045
4146
Returns:
42-
cr instance name
47+
CR instance name.
48+
49+
Raises:
50+
ValueError: If instance_type is invalid or instance creation fails.
4351
"""
52+
if instance_type not in ("Micro", "Enterprise"):
53+
raise ValueError(f"Invalid instance_type: {instance_type}. Must be 'Micro' or 'Enterprise'.")
54+
4455
status = self._check_instance(instance_name)
4556
if status != "NONEXIST":
4657
logger.debug(f"cr instance {instance_name} already running")
@@ -49,8 +60,9 @@ def _create_instance(self, instance_name: str = DEFAULT_CR_INSTANCE_NAME) -> str
4960
request_body={
5061
"Name": instance_name,
5162
"ResourceTags": [
52-
{"Key": "provider", "Value": "veadk"},
63+
{"Key": "provider", "Value": "agentkit-cli"},
5364
],
65+
"Type": instance_type,
5466
},
5567
action="CreateRegistry",
5668
ak=self.ak,

0 commit comments

Comments
 (0)