aws / aws/agentcore-cli

Support pre-built container image URI in agentcore deploy (skip CodeBuild)

Aperta
#503 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
TypeScript
Stelle
283
Fork
95
Merge medio
1g 2h
PR unite (30g)
183

Descrizione

### Description

Currently, the Container build type always builds images via AWS CodeBuild during agentcore deploy. This doesn't support workflows where users cross-compile for a different architecture, use custom CI/CD pipelines that push images to ECR before deploying, or want to avoid redundant builds when the image already exists in ECR.

Add a `--container-uri ` flag to agentcore deploy that accepts a pre-built ECR image URI and wires it directly to AgentCoreRuntime, bypassing the CodeBuild step entirely.

Example usage:

`agentcore deploy -y --container-uri 123456789012.dkr.ecr.us-west-2.amazonaws.com/myproject/myagent:abc123`

The container URI is passed to the CDK app via an environment variable (AGENTCORE_CONTAINER_URI) so the CDK toolkit wrapper doesn't need modification. When set, the CDK stack creates an AgentCoreRuntime construct directly with the pre-built image instead of going through the AgentCoreApplication (CodeBuild) path.

### Acceptance Criteria

- [ ] `agentcore deploy --container-uri ` deploys using the provided ECR image without triggering a CodeBuild build
- [ ] Invalid ECR URI formats are rejected with a clear error message before deployment starts
- [ ] Dockerfile validation is skipped when `--container-uri` is provided
- [ ] The flag triggers non-interactive (CLI) mode
- [ ] `DeployOptions` and `ValidatedDeployOptions` interfaces include the optional `containerUri` field
- [ ] The CDK stack branches correctly: `containerUri` set → `AgentCoreRuntime` with pre-built image; unset → existing `AgentCoreApplication` (CodeBuild) path
- [ ] `CfnOutput` for `RuntimeId` and `RuntimeArn` is emitted in the pre-built image path
- [ ] Unit tests cover: URI validation (valid/invalid formats), Dockerfile validation skip, env var propagation, CDK stack branching logic
- [ ] Existing Container build type (no `--container-uri`) continues to work unchanged

### Additional Context

This currently assumes a single agent (spec.agents[0]). We likely would want to address multi-agent/multi-URI mappings somehow.
The ECR repo must already exist with the referenced tag.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dal punto di ingresso agentcore deploy e segui DeployOptions, ValidatedDeployOptions e la variabile d’ambiente AGENTCORE_CONTAINER_URI fino allo stack CDK. Esamina i rami AgentCoreRuntime e AgentCoreApplication, quindi aggiungi test per la convalida dell’URI, il salto di Dockerfile, la propagazione, gli output e il comportamento predefinito invariato. Il lavoro è completo quando tutti i criteri di accettazione sono soddisfatti senza attivare CodeBuild per un URI ECR precompilato valido.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
aws, docker, typescript
Ambito
cli, cloud, devops, infrastructure
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.