@fjall/components-infrastructure 3.11.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { CfnOutput, Duration, Stack, Tags } from "aws-cdk-lib";
|
|
2
2
|
import { Port } from "aws-cdk-lib/aws-ec2";
|
|
3
3
|
import { Cluster } from "aws-cdk-lib/aws-ecs";
|
|
4
|
-
import { Repository, TagMutability } from "aws-cdk-lib/aws-ecr";
|
|
4
|
+
import { Repository, TagMutability, TagStatus } from "aws-cdk-lib/aws-ecr";
|
|
5
5
|
import { Effect, PolicyStatement } from "aws-cdk-lib/aws-iam";
|
|
6
6
|
import { Code, Runtime } from "aws-cdk-lib/aws-lambda";
|
|
7
7
|
import { PublicHostedZone } from "aws-cdk-lib/aws-route53";
|
|
8
8
|
import { LoadBalancerTarget } from "aws-cdk-lib/aws-route53-targets";
|
|
9
9
|
import { SqsDestination } from "aws-cdk-lib/aws-s3-notifications";
|
|
10
10
|
import { Construct } from "constructs";
|
|
11
|
+
import { buildCacheRepositoryName, CACHE_REPO_UNTAGGED_RETENTION_DAYS } from "@fjall/util/docker";
|
|
11
12
|
import { readFileSync } from "node:fs";
|
|
12
13
|
import path from "node:path";
|
|
13
14
|
import { fileURLToPath } from "node:url";
|
|
@@ -249,6 +250,30 @@ export class DevSubstrate extends Construct {
|
|
|
249
250
|
// first same-branch recreate (BUG-22).
|
|
250
251
|
tagMutability: TagMutability.MUTABLE
|
|
251
252
|
});
|
|
253
|
+
// Buildx registry cache for slot builds, named by the same helper as the app
|
|
254
|
+
// path's `<repo>-cache` so `fjall dev up` derives this URI from the slot
|
|
255
|
+
// repo's without a second wire field. Adopts on the same flag: both repos are
|
|
256
|
+
// RETAIN, so a rolled-back create leaves BOTH behind, and a create-only cache
|
|
257
|
+
// repo would fail the very retry `adoptSlotEcr` exists to rescue.
|
|
258
|
+
const slotCacheRepositoryName = buildCacheRepositoryName(slotEcrRepositoryName);
|
|
259
|
+
if (props.adoptSlotEcr === true) {
|
|
260
|
+
Repository.fromRepositoryName(this, `${slotEcrId}Cache`, slotCacheRepositoryName);
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
const slotCacheRepository = new Ecr(this, `${slotEcrId}Cache`, {
|
|
264
|
+
repositoryName: slotCacheRepositoryName,
|
|
265
|
+
// buildx overwrites the per-repo cache manifest tag on every export.
|
|
266
|
+
tagMutability: TagMutability.MUTABLE
|
|
267
|
+
});
|
|
268
|
+
// Each `mode=max` export orphans the previous manifest's blobs. The
|
|
269
|
+
// dev-deploy role holds no BatchDeleteImage or PutLifecyclePolicy, so this
|
|
270
|
+
// rule is the ONLY reclaim path — without it the cache grows without bound
|
|
271
|
+
// in a customer's dev account. An adopted repo keeps its existing policy.
|
|
272
|
+
slotCacheRepository.addLifecycleRule({
|
|
273
|
+
tagStatus: TagStatus.UNTAGGED,
|
|
274
|
+
maxImageAge: Duration.days(CACHE_REPO_UNTAGGED_RETENTION_DAYS)
|
|
275
|
+
});
|
|
276
|
+
}
|
|
252
277
|
return {
|
|
253
278
|
vpc,
|
|
254
279
|
slotSecurityGroup,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fjall/components-infrastructure",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@aws-sdk/client-organizations": "^3.1038.0",
|
|
70
|
-
"@fjall/generator": "^
|
|
71
|
-
"@fjall/util": "^
|
|
70
|
+
"@fjall/generator": "^4.0.0",
|
|
71
|
+
"@fjall/util": "^4.0.0",
|
|
72
72
|
"constructs": "^10.6.0"
|
|
73
73
|
},
|
|
74
74
|
"overrides": {
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"engines": {
|
|
83
83
|
"node": ">=18.0.0"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "14031063ccd2685e390b70f6a3f4efe2bac7ced9"
|
|
86
86
|
}
|