Skip to content

Commit 9e2f7b8

Browse files
committed
fix(cli): push the video image only to an ECR repository this stack tagged
1 parent e015f97 commit 9e2f7b8

5 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎packages/cli/src/commands/lambda/deploy.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export interface DeployArgs {
2626
reservedConcurrency?: number;
2727
chromeSource: "sparticuz" | "chrome-headless-shell";
2828
lambdaMemoryMb: number;
29-
/** `arm64` renders chunks on an arm64 container-image function; plan, audio and assemble stay x86. */
3029
videoArch: VideoArch;
3130
/** Override the handler-ZIP rebuild step. Useful for CI runs that already built it. */
3231
skipBuild: boolean;

‎packages/cli/src/commands/lambda/policies.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const REQUIRED_ACTIONS = {
8181
"cloudwatch:DescribeAlarms",
8282
"cloudwatch:PutMetricAlarm",
8383
],
84-
// `deploy --video-arch arm64` pushes the video image; Set/GetRepositoryPolicy let Lambda pull it.
84+
// `deploy --video-arch arm64` tags and pushes the video image; Set/GetRepositoryPolicy let Lambda pull it.
8585
ecr: [
8686
"ecr:BatchCheckLayerAvailability",
8787
"ecr:BatchGetImage",
@@ -92,8 +92,10 @@ const REQUIRED_ACTIONS = {
9292
"ecr:GetDownloadUrlForLayer",
9393
"ecr:GetRepositoryPolicy",
9494
"ecr:InitiateLayerUpload",
95+
"ecr:ListTagsForResource",
9596
"ecr:PutImage",
9697
"ecr:SetRepositoryPolicy",
98+
"ecr:TagResource",
9799
"ecr:UploadLayerPart",
98100
],
99101
iam: [

‎packages/cli/src/commands/lambda/state.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,11 @@ export interface StackOutputs {
2424
/** Lambda memory MB used during deploy; carried so cost math doesn't have to re-derive it. */
2525
lambdaMemoryMb: number;
2626
reservedConcurrency?: number;
27-
/** The arm64 video function that renders chunks, when deployed with `--video-arch arm64`. */
2827
videoFunctionName?: string;
29-
/** ECR repository holding the video function's image; kept until `destroy` deletes it. */
3028
videoRepository?: string;
3129
deployedAt: string;
3230
}
3331

34-
/** Architecture `getRenderProgress` prices chunk invocations at. */
3532
export function chunkArchitecture(stack: StackOutputs): "arm64" | undefined {
3633
return stack.videoFunctionName ? "arm64" : undefined;
3734
}

‎packages/cli/src/commands/lambda/videoImage.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function setup(opts: { architecture?: string } = {}) {
6868

6969
describe("pushVideoImage", () => {
7070
it("outside a checkout, pushes the pinned image to the stack's repository and returns its digest URI", async () => {
71-
const { deps, pushedLayouts, pushed } = setup();
71+
const { deps, sdk, pushedLayouts, pushed } = setup();
7272
const result = await pushVideoImage(
7373
{ stackName: "My-Stack", region: "r", inCheckout: false },
7474
deps,
@@ -78,6 +78,10 @@ describe("pushVideoImage", () => {
7878
repositoryName: "my-stack-video",
7979
});
8080
expect(pushedLayouts).toEqual(['{"manifests":[]}']);
81+
// destroy deletes this repository, so it is only ever one this stack created and tagged.
82+
expect(sdk.ensureEcrRepository).toHaveBeenCalledWith(
83+
expect.objectContaining({ tags: [{ Key: "hyperframes:stack", Value: "My-Stack" }] }),
84+
);
8185
expect(existsSync(pushed[0]?.layoutDir as string)).toBe(false);
8286
});
8387

‎packages/cli/src/commands/lambda/videoImage.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export async function pushVideoImage(
4040
const { repositoryUri } = await sdk.ensureEcrRepository({
4141
region: opts.region,
4242
repositoryName,
43+
tags: [{ Key: "hyperframes:stack", Value: opts.stackName }],
4344
});
4445
deps.log(`→ Pushing the arm64 video image to ${repositoryUri}`);
4546
const pushed = await sdk.pushImageToEcr({

0 commit comments

Comments
 (0)