@fjall/components-infrastructure 2.34.0 → 3.1.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.
- package/dist/lib/app.d.ts +36 -2
- package/dist/lib/app.js +78 -3
- package/dist/lib/patterns/aws/apexDomainPattern.d.ts +11 -12
- package/dist/lib/patterns/aws/apexDomainPattern.js +11 -31
- package/dist/lib/patterns/aws/buildkite/alarms.d.ts +20 -0
- package/dist/lib/patterns/aws/buildkite/alarms.js +78 -0
- package/dist/lib/patterns/aws/buildkite/buildkite.d.ts +46 -0
- package/dist/lib/patterns/aws/buildkite/buildkite.js +233 -0
- package/dist/lib/patterns/aws/buildkite/iam.d.ts +35 -0
- package/dist/lib/patterns/aws/buildkite/iam.js +176 -0
- package/dist/lib/patterns/aws/buildkite/pins.d.ts +69 -0
- package/dist/lib/patterns/aws/buildkite/pins.js +80 -0
- package/dist/lib/patterns/aws/buildkite/schema.d.ts +80 -0
- package/dist/lib/patterns/aws/buildkite/schema.js +148 -0
- package/dist/lib/patterns/aws/buildkite/userData.d.ts +58 -0
- package/dist/lib/patterns/aws/buildkite/userData.js +226 -0
- package/dist/lib/patterns/aws/buildkite.d.ts +12 -59
- package/dist/lib/patterns/aws/buildkite.js +12 -310
- package/dist/lib/patterns/aws/cdn.js +25 -10
- package/dist/lib/patterns/aws/computeEcs.js +6 -1
- package/dist/lib/patterns/aws/computeEcsTypes.d.ts +8 -3
- package/dist/lib/patterns/aws/delegatedDomainPattern.d.ts +13 -4
- package/dist/lib/patterns/aws/delegatedDomainPattern.js +57 -8
- package/dist/lib/patterns/aws/devSubstrate.d.ts +2 -1
- package/dist/lib/patterns/aws/devSubstrate.js +18 -8
- package/dist/lib/patterns/aws/dnsRecordComposer.d.ts +2 -9
- package/dist/lib/patterns/aws/dnsRecordComposer.js +5 -97
- package/dist/lib/patterns/aws/domain.d.ts +3 -2
- package/dist/lib/patterns/aws/domain.js +3 -2
- package/dist/lib/patterns/aws/domainValidation.js +71 -46
- package/dist/lib/patterns/aws/externalRecordsPattern.js +2 -11
- package/dist/lib/patterns/aws/index.d.ts +1 -3
- package/dist/lib/patterns/aws/index.js +2 -3
- package/dist/lib/patterns/aws/interfaces/domain.d.ts +22 -8
- package/dist/lib/patterns/aws/interfaces/index.d.ts +0 -1
- package/dist/lib/patterns/aws/interfaces/index.js +3 -0
- package/dist/lib/patterns/aws/interfaces/pattern.d.ts +55 -10
- package/dist/lib/patterns/aws/patternDomain.d.ts +77 -0
- package/dist/lib/patterns/aws/patternDomain.js +198 -0
- package/dist/lib/patterns/aws/payload.js +23 -30
- package/dist/lib/patterns/aws/staticSite.d.ts +1 -0
- package/dist/lib/patterns/aws/staticSite.js +28 -33
- package/dist/lib/resources/aws/base/awsStack.d.ts +8 -0
- package/dist/lib/resources/aws/base/awsStack.js +20 -17
- package/dist/lib/resources/aws/compute/ec2.d.ts +15 -0
- package/dist/lib/resources/aws/compute/ec2.js +20 -1
- package/dist/lib/resources/aws/compute/ecs.d.ts +1 -1
- package/dist/lib/resources/aws/compute/ecs.js +1 -1
- package/dist/lib/resources/aws/compute/ecsNetworking.d.ts +1 -1
- package/dist/lib/resources/aws/compute/ecsNetworking.js +212 -47
- package/dist/lib/resources/aws/compute/ecsTypes.d.ts +60 -9
- package/dist/lib/resources/aws/compute/ecsValidation.d.ts +14 -1
- package/dist/lib/resources/aws/compute/ecsValidation.js +51 -0
- package/dist/lib/resources/aws/networking/dnsRecord/aRecord.js +3 -2
- package/dist/lib/resources/aws/networking/dnsRecord/aaaaRecord.js +3 -2
- package/dist/lib/resources/aws/networking/dnsRecord/aliasRecord.d.ts +23 -1
- package/dist/lib/resources/aws/networking/dnsRecord/aliasRecord.js +14 -3
- package/dist/lib/resources/aws/networking/dnsRecord/caaRecord.js +3 -2
- package/dist/lib/resources/aws/networking/dnsRecord/cnameRecord.js +3 -2
- package/dist/lib/resources/aws/networking/dnsRecord/dnsRecordBase.d.ts +10 -1
- package/dist/lib/resources/aws/networking/dnsRecord/dnsRecordBase.js +21 -4
- package/dist/lib/resources/aws/networking/dnsRecord/mxRecord.js +3 -2
- package/dist/lib/resources/aws/networking/dnsRecord/nsRecord.js +3 -2
- package/dist/lib/resources/aws/networking/dnsRecord/srvRecord.js +3 -2
- package/dist/lib/resources/aws/networking/dnsRecord/txtRecord.js +3 -2
- package/dist/lib/resources/aws/networking/domainCertificate.d.ts +28 -4
- package/dist/lib/resources/aws/networking/domainCertificate.js +24 -10
- package/dist/lib/resources/aws/networking/hostedZone.d.ts +11 -0
- package/dist/lib/resources/aws/networking/hostedZone.js +6 -0
- package/dist/lib/utils/costAllocationTags.d.ts +9 -0
- package/dist/lib/utils/costAllocationTags.js +6 -1
- package/dist/lib/utils/dnsRecordRegistry.d.ts +52 -0
- package/dist/lib/utils/dnsRecordRegistry.js +64 -0
- package/dist/lib/utils/domainTypes.d.ts +43 -36
- package/dist/lib/utils/domainTypes.js +65 -2
- package/dist/lib/utils/managedDomainContext.d.ts +37 -0
- package/dist/lib/utils/managedDomainContext.js +111 -0
- package/package.json +4 -4
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Plain-data props for the `Buildkite` pattern, validated at construct time.
|
|
4
|
+
* Deliberately CDK-free so the same schema can later back the customer
|
|
5
|
+
* scaffold surface if the pattern is ever promoted to `PATTERN_TYPE_VALUES`
|
|
6
|
+
* (design § D3 — promotion must be additive).
|
|
7
|
+
*
|
|
8
|
+
* Defaults encode the design's deploy-fleet posture
|
|
9
|
+
* (`aiDocs/designs/2026-07-18-buildkite-selfhosted-agents.md`):
|
|
10
|
+
* on-demand-only (`spotCapacityPercentage` 0 — ASG mixed-instances has no
|
|
11
|
+
* spot→on-demand fallback, and a spot reclaim mid-deploy is a rollback
|
|
12
|
+
* incident, § D7), scale-to-zero, whole-instance agents, bounded instance
|
|
13
|
+
* staleness, and no ECR / docker-login instance-level credentials (§ D9 —
|
|
14
|
+
* deploy AWS access stays server-minted; the instance profile confers none).
|
|
15
|
+
*/
|
|
16
|
+
export declare const BuildkitePropsSchema: z.ZodObject<{
|
|
17
|
+
buildkiteQueue: z.ZodString;
|
|
18
|
+
buildkiteOrgSlug: z.ZodString;
|
|
19
|
+
agentTokenSsmParameterName: z.ZodString;
|
|
20
|
+
agentTokenKmsKeyArn: z.ZodOptional<z.ZodString>;
|
|
21
|
+
fjallApiKeySsmParameterName: z.ZodOptional<z.ZodString>;
|
|
22
|
+
instanceType: z.ZodDefault<z.ZodString>;
|
|
23
|
+
agentVolumeSizeGib: z.ZodDefault<z.ZodNumber>;
|
|
24
|
+
agentMinInstances: z.ZodDefault<z.ZodNumber>;
|
|
25
|
+
agentMaxInstances: z.ZodDefault<z.ZodNumber>;
|
|
26
|
+
agentsPerInstance: z.ZodDefault<z.ZodNumber>;
|
|
27
|
+
spotCapacityPercentage: z.ZodDefault<z.ZodNumber>;
|
|
28
|
+
scaleInIdlePeriodSeconds: z.ZodDefault<z.ZodNumber>;
|
|
29
|
+
disconnectAfterUptimeSeconds: z.ZodDefault<z.ZodNumber>;
|
|
30
|
+
maxInstanceLifetimeDays: z.ZodDefault<z.ZodNumber>;
|
|
31
|
+
terminateInstanceAfterJob: z.ZodDefault<z.ZodBoolean>;
|
|
32
|
+
purgeBuildsOnDiskFull: z.ZodDefault<z.ZodBoolean>;
|
|
33
|
+
terminateInstanceOnDiskFull: z.ZodDefault<z.ZodBoolean>;
|
|
34
|
+
logRetentionDays: z.ZodDefault<z.ZodNumber>;
|
|
35
|
+
buildkiteAgentRelease: z.ZodDefault<z.ZodEnum<{
|
|
36
|
+
stable: "stable";
|
|
37
|
+
beta: "beta";
|
|
38
|
+
edge: "edge";
|
|
39
|
+
}>>;
|
|
40
|
+
buildkiteAgentTags: z.ZodDefault<z.ZodString>;
|
|
41
|
+
buildkiteAgentTimestampLines: z.ZodDefault<z.ZodBoolean>;
|
|
42
|
+
buildkiteAgentExperiments: z.ZodDefault<z.ZodString>;
|
|
43
|
+
buildkiteAgentTracingBackend: z.ZodDefault<z.ZodEnum<{
|
|
44
|
+
"": "";
|
|
45
|
+
datadog: "datadog";
|
|
46
|
+
opentelemetry: "opentelemetry";
|
|
47
|
+
}>>;
|
|
48
|
+
buildkiteAgentCancelGracePeriodSeconds: z.ZodDefault<z.ZodNumber>;
|
|
49
|
+
enableSecretsPlugin: z.ZodDefault<z.ZodBoolean>;
|
|
50
|
+
enableEcrPlugin: z.ZodDefault<z.ZodBoolean>;
|
|
51
|
+
enableDockerLoginPlugin: z.ZodDefault<z.ZodBoolean>;
|
|
52
|
+
enableDockerUserNamespaceRemap: z.ZodDefault<z.ZodBoolean>;
|
|
53
|
+
enableDockerExperimental: z.ZodDefault<z.ZodBoolean>;
|
|
54
|
+
dockerNetworkingProtocol: z.ZodDefault<z.ZodEnum<{
|
|
55
|
+
ipv4: "ipv4";
|
|
56
|
+
dualstack: "dualstack";
|
|
57
|
+
}>>;
|
|
58
|
+
enableInstanceStorage: z.ZodDefault<z.ZodBoolean>;
|
|
59
|
+
mountTmpfsAtTmp: z.ZodDefault<z.ZodBoolean>;
|
|
60
|
+
buildkiteAgentEnableGitMirrors: z.ZodDefault<z.ZodBoolean>;
|
|
61
|
+
bootstrapScriptUrl: z.ZodDefault<z.ZodString>;
|
|
62
|
+
agentEnvFileUrl: z.ZodDefault<z.ZodString>;
|
|
63
|
+
scalerEventSchedulePeriod: z.ZodDefault<z.ZodString>;
|
|
64
|
+
scalerMinPollInterval: z.ZodDefault<z.ZodString>;
|
|
65
|
+
scaleOutFactor: z.ZodDefault<z.ZodString>;
|
|
66
|
+
scaleOutWaitingForJobs: z.ZodDefault<z.ZodBoolean>;
|
|
67
|
+
rolePermissionsBoundaryArn: z.ZodOptional<z.ZodString>;
|
|
68
|
+
alarmSnsTopicArn: z.ZodOptional<z.ZodString>;
|
|
69
|
+
costAllocationEnvironment: z.ZodOptional<z.ZodString>;
|
|
70
|
+
costAllocationOwner: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
export type BuildkiteProps = z.infer<typeof BuildkitePropsSchema>;
|
|
73
|
+
/** Caller-facing shape: fields with defaults are optional at the call site. */
|
|
74
|
+
export type BuildkitePropsInput = z.input<typeof BuildkitePropsSchema>;
|
|
75
|
+
/**
|
|
76
|
+
* Validate + default the plain-data props at construct time. Throws a
|
|
77
|
+
* synth-time error listing every violation — the pattern's constructor is the
|
|
78
|
+
* validation boundary, mirroring `ClickHouseDatabase`'s Stage-1 shape.
|
|
79
|
+
*/
|
|
80
|
+
export declare function validateBuildkiteProps(props: BuildkitePropsInput): BuildkiteProps;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Plain-data props for the `Buildkite` pattern, validated at construct time.
|
|
4
|
+
* Deliberately CDK-free so the same schema can later back the customer
|
|
5
|
+
* scaffold surface if the pattern is ever promoted to `PATTERN_TYPE_VALUES`
|
|
6
|
+
* (design § D3 — promotion must be additive).
|
|
7
|
+
*
|
|
8
|
+
* Defaults encode the design's deploy-fleet posture
|
|
9
|
+
* (`aiDocs/designs/2026-07-18-buildkite-selfhosted-agents.md`):
|
|
10
|
+
* on-demand-only (`spotCapacityPercentage` 0 — ASG mixed-instances has no
|
|
11
|
+
* spot→on-demand fallback, and a spot reclaim mid-deploy is a rollback
|
|
12
|
+
* incident, § D7), scale-to-zero, whole-instance agents, bounded instance
|
|
13
|
+
* staleness, and no ECR / docker-login instance-level credentials (§ D9 —
|
|
14
|
+
* deploy AWS access stays server-minted; the instance profile confers none).
|
|
15
|
+
*/
|
|
16
|
+
export const BuildkitePropsSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
/** Buildkite queue this fleet serves (cluster-scoped via the token). */
|
|
19
|
+
buildkiteQueue: z
|
|
20
|
+
.string()
|
|
21
|
+
.min(1, "buildkiteQueue cannot be empty")
|
|
22
|
+
.max(100)
|
|
23
|
+
.regex(/^[a-zA-Z0-9-_]+$/, "buildkiteQueue must be alphanumeric with hyphens/underscores"),
|
|
24
|
+
/**
|
|
25
|
+
* Buildkite organisation slug (e.g. `fjall-tech`). The
|
|
26
|
+
* buildkite-agent-scaler publishes its CloudWatch metrics dimensioned by
|
|
27
|
+
* {Org, Queue} — the fleet's alarms must query the same pair or they read
|
|
28
|
+
* no data at all (heartbeat permanently ALARM, queued-with-zero-capacity
|
|
29
|
+
* permanently inert).
|
|
30
|
+
*/
|
|
31
|
+
buildkiteOrgSlug: z
|
|
32
|
+
.string()
|
|
33
|
+
.min(1, "buildkiteOrgSlug cannot be empty")
|
|
34
|
+
.max(100)
|
|
35
|
+
.regex(/^[a-z0-9-]+$/, "buildkiteOrgSlug must be a lowercase Buildkite organisation slug"),
|
|
36
|
+
/**
|
|
37
|
+
* Name of the pre-provisioned SSM SecureString holding the cluster-scoped
|
|
38
|
+
* agent token (e.g. `/Buildkite/agents/agent-token`). Provisioned
|
|
39
|
+
* out-of-band via `fjall secrets` tooling — the construct receives the
|
|
40
|
+
* identifier only; no secret value ever transits synth (design § D4).
|
|
41
|
+
*/
|
|
42
|
+
agentTokenSsmParameterName: z
|
|
43
|
+
.string()
|
|
44
|
+
.min(2)
|
|
45
|
+
.regex(/^\//, "agentTokenSsmParameterName must be a full path (leading /)"),
|
|
46
|
+
/**
|
|
47
|
+
* KMS key ARN encrypting the agent-token parameter, when a customer
|
|
48
|
+
* managed key is used. Omit for the AWS-managed `aws/ssm` key.
|
|
49
|
+
*/
|
|
50
|
+
agentTokenKmsKeyArn: z.string().min(1).optional(),
|
|
51
|
+
/**
|
|
52
|
+
* Name of the SSM SecureString holding FJALL_API_KEY. When set, the
|
|
53
|
+
* construct ships a per-job `env` hook into the managed secrets bucket
|
|
54
|
+
* that reads the parameter at job start (rotation takes effect on the
|
|
55
|
+
* next job, no instance replacement — design § D4(iii)) and grants the
|
|
56
|
+
* instance profile read on exactly this parameter.
|
|
57
|
+
*/
|
|
58
|
+
fjallApiKeySsmParameterName: z
|
|
59
|
+
.string()
|
|
60
|
+
.min(2)
|
|
61
|
+
.regex(/^\//, "fjallApiKeySsmParameterName must be a full path (leading /)")
|
|
62
|
+
.optional(),
|
|
63
|
+
/** EC2 instance type. Graviton default per design § D7. */
|
|
64
|
+
instanceType: z.string().min(1).default("c8g.xlarge"),
|
|
65
|
+
agentVolumeSizeGib: z.number().int().min(20).max(1000).default(250),
|
|
66
|
+
agentMinInstances: z.number().int().min(0).default(0),
|
|
67
|
+
agentMaxInstances: z.number().int().min(1).default(2),
|
|
68
|
+
agentsPerInstance: z.number().int().min(1).default(1),
|
|
69
|
+
/**
|
|
70
|
+
* Percentage of capacity on spot. Deploy fleets MUST stay 0 (on-demand
|
|
71
|
+
* only): no spot→on-demand fallback mechanism exists, and a reclaim
|
|
72
|
+
* mid-deploy lands in the rollback-wedge class (design § D7). Non-zero is
|
|
73
|
+
* for Phase-2 CI fleets running idempotent, auto-retried jobs.
|
|
74
|
+
*/
|
|
75
|
+
spotCapacityPercentage: z.number().int().min(0).max(100).default(0),
|
|
76
|
+
/** Agent-driven scale-in: idle seconds before an instance self-terminates. */
|
|
77
|
+
scaleInIdlePeriodSeconds: z.number().int().min(60).default(600),
|
|
78
|
+
/** Bounded instance staleness; also caps stale-token propagation (§ D5). */
|
|
79
|
+
disconnectAfterUptimeSeconds: z.number().int().min(3600).default(86_400),
|
|
80
|
+
maxInstanceLifetimeDays: z.number().int().min(1).max(365).default(7),
|
|
81
|
+
terminateInstanceAfterJob: z.boolean().default(false),
|
|
82
|
+
purgeBuildsOnDiskFull: z.boolean().default(true),
|
|
83
|
+
terminateInstanceOnDiskFull: z.boolean().default(false),
|
|
84
|
+
/** CloudWatch retention for the scaler's log group (days). */
|
|
85
|
+
logRetentionDays: z.number().int().min(1).default(30),
|
|
86
|
+
buildkiteAgentRelease: z.enum(["stable", "beta", "edge"]).default("stable"),
|
|
87
|
+
buildkiteAgentTags: z.string().default(""),
|
|
88
|
+
buildkiteAgentTimestampLines: z.boolean().default(false),
|
|
89
|
+
buildkiteAgentExperiments: z.string().default(""),
|
|
90
|
+
buildkiteAgentTracingBackend: z
|
|
91
|
+
.enum(["", "datadog", "opentelemetry"])
|
|
92
|
+
.default(""),
|
|
93
|
+
buildkiteAgentCancelGracePeriodSeconds: z
|
|
94
|
+
.number()
|
|
95
|
+
.int()
|
|
96
|
+
.min(10)
|
|
97
|
+
.default(60),
|
|
98
|
+
/** S3 secrets-hooks plugin — required for the FJALL_API_KEY env hook. */
|
|
99
|
+
enableSecretsPlugin: z.boolean().default(true),
|
|
100
|
+
/**
|
|
101
|
+
* ECR + docker-login plugins default OFF: the instance profile carries no
|
|
102
|
+
* registry credentials (design § D9); deploy jobs authenticate through
|
|
103
|
+
* server-minted credentials exactly as on hosted agents.
|
|
104
|
+
*/
|
|
105
|
+
enableEcrPlugin: z.boolean().default(false),
|
|
106
|
+
enableDockerLoginPlugin: z.boolean().default(false),
|
|
107
|
+
enableDockerUserNamespaceRemap: z.boolean().default(true),
|
|
108
|
+
enableDockerExperimental: z.boolean().default(false),
|
|
109
|
+
dockerNetworkingProtocol: z.enum(["ipv4", "dualstack"]).default("ipv4"),
|
|
110
|
+
enableInstanceStorage: z.boolean().default(false),
|
|
111
|
+
mountTmpfsAtTmp: z.boolean().default(true),
|
|
112
|
+
buildkiteAgentEnableGitMirrors: z.boolean().default(false),
|
|
113
|
+
bootstrapScriptUrl: z.string().default(""),
|
|
114
|
+
agentEnvFileUrl: z.string().default(""),
|
|
115
|
+
scalerEventSchedulePeriod: z.string().min(1).default("1 minute"),
|
|
116
|
+
scalerMinPollInterval: z.string().min(1).default("10s"),
|
|
117
|
+
scaleOutFactor: z.string().min(1).default("1.0"),
|
|
118
|
+
scaleOutWaitingForJobs: z.boolean().default(false),
|
|
119
|
+
/** IAM permissions boundary for the scaler's roles; emitted only when set. */
|
|
120
|
+
rolePermissionsBoundaryArn: z.string().min(1).optional(),
|
|
121
|
+
/**
|
|
122
|
+
* SNS topic receiving the fleet's two alarms (scaler heartbeat + queued
|
|
123
|
+
* with zero capacity — design § D14). Omit to create the alarms without
|
|
124
|
+
* actions (visible on the console, silent).
|
|
125
|
+
*/
|
|
126
|
+
alarmSnsTopicArn: z.string().min(1).optional(),
|
|
127
|
+
costAllocationEnvironment: z.string().min(1).optional(),
|
|
128
|
+
costAllocationOwner: z.string().min(1).optional()
|
|
129
|
+
})
|
|
130
|
+
.strict()
|
|
131
|
+
.refine((props) => props.agentMinInstances <= props.agentMaxInstances, {
|
|
132
|
+
message: "agentMinInstances must be <= agentMaxInstances"
|
|
133
|
+
});
|
|
134
|
+
/**
|
|
135
|
+
* Validate + default the plain-data props at construct time. Throws a
|
|
136
|
+
* synth-time error listing every violation — the pattern's constructor is the
|
|
137
|
+
* validation boundary, mirroring `ClickHouseDatabase`'s Stage-1 shape.
|
|
138
|
+
*/
|
|
139
|
+
export function validateBuildkiteProps(props) {
|
|
140
|
+
const result = BuildkitePropsSchema.safeParse(props);
|
|
141
|
+
if (!result.success) {
|
|
142
|
+
const details = result.error.issues
|
|
143
|
+
.map((issue) => ` - ${issue.path.join(".") || "(root)"}: ${issue.message}`)
|
|
144
|
+
.join("\n");
|
|
145
|
+
throw new Error(`Buildkite: invalid props:\n${details}`);
|
|
146
|
+
}
|
|
147
|
+
return result.data;
|
|
148
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { MultipartUserData } from "aws-cdk-lib/aws-ec2";
|
|
2
|
+
import type { BuildkiteProps } from "./schema.js";
|
|
3
|
+
/**
|
|
4
|
+
* Resolved synth-time values the user data needs beyond the plain props —
|
|
5
|
+
* supplied by the construct (region from `Stack.of(this)`, never
|
|
6
|
+
* `props.env?.region`, which rendered the literal string "undefined" in the
|
|
7
|
+
* pre-refactor stack).
|
|
8
|
+
*/
|
|
9
|
+
export interface BuildkiteUserDataContext {
|
|
10
|
+
readonly stackName: string;
|
|
11
|
+
readonly region: string;
|
|
12
|
+
readonly secretsBucketName: string;
|
|
13
|
+
readonly artifactBucketName: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The pinned AMI's boot scripts run under `set -Eeuo pipefail` and
|
|
17
|
+
* dereference every variable the upstream template passes — an OMITTED key
|
|
18
|
+
* is not "use the default", it is an unbound-variable crash at boot and an
|
|
19
|
+
* ASG boot-loop. Each part therefore mirrors the upstream v6.68.1 user data
|
|
20
|
+
* env block EXACTLY (same keys, upstream parameter defaults where we expose
|
|
21
|
+
* no knob), and the parity test asserts set equality per part against the
|
|
22
|
+
* vendored template in both directions: a key we emit that upstream does not
|
|
23
|
+
* pass is silently ignored; a key upstream passes that we omit is the
|
|
24
|
+
* boot-loop. Bumping the pins regenerates the fixture
|
|
25
|
+
* (runbook: `aiDocs/runbooks/buildkite-stack-bump-runbook.md`).
|
|
26
|
+
*/
|
|
27
|
+
export declare const BUILDKITE_MOUNT_PART_ENV_KEYS: readonly ["BUILDKITE_ENABLE_INSTANCE_STORAGE", "BUILDKITE_MOUNT_TMPFS_AT_TMP"];
|
|
28
|
+
export declare const BUILDKITE_DOCKER_PART_ENV_KEYS: readonly ["DOCKER_USERNS_REMAP", "DOCKER_EXPERIMENTAL", "DOCKER_PRUNE_UNTIL", "ENABLE_PRE_EXIT_DISK_CLEANUP", "DOCKER_BUILDER_PRUNE_ENABLED", "DOCKER_NETWORKING_PROTOCOL", "DOCKER_IPV4_ADDRESS_POOL_1", "DOCKER_IPV4_ADDRESS_POOL_2", "DOCKER_IPV6_ADDRESS_POOL", "DOCKER_FIXED_CIDR_V4", "DOCKER_FIXED_CIDR_V6", "BUILDKITE_ENABLE_INSTANCE_STORAGE"];
|
|
29
|
+
export declare const BUILDKITE_USER_DATA_ENV_KEYS: readonly ["BUILDKITE_STACK_NAME", "BUILDKITE_STACK_VERSION", "BUILDKITE_STACK_DEPLOYED_BY", "BUILDKITE_SCALE_IN_IDLE_PERIOD", "BUILDKITE_SECRETS_BUCKET", "BUILDKITE_SECRETS_BUCKET_REGION", "BUILDKITE_SECRETS_PLUGIN_SKIP_SSH_KEY_NOT_FOUND_WARNING", "BUILDKITE_ARTIFACTS_BUCKET", "BUILDKITE_S3_DEFAULT_REGION", "BUILDKITE_S3_ACL", "BUILDKITE_AGENT_TOKEN_PATH", "BUILDKITE_AGENTS_PER_INSTANCE", "BUILDKITE_AGENT_ENDPOINT", "BUILDKITE_AGENT_TAGS", "BUILDKITE_AGENT_TIMESTAMP_LINES", "BUILDKITE_AGENT_EXPERIMENTS", "BUILDKITE_AGENT_TRACING_BACKEND", "BUILDKITE_AGENT_SIGNING_KEY_PATH", "BUILDKITE_AGENT_SIGNING_KEY_ID", "BUILDKITE_AGENT_VERIFICATION_KEY_PATH", "BUILDKITE_AGENT_RELEASE", "BUILDKITE_AGENT_CANCEL_GRACE_PERIOD", "BUILDKITE_AGENT_SIGNAL_GRACE_PERIOD_SECONDS", "BUILDKITE_AGENT_SIGNING_KMS_KEY", "BUILDKITE_AGENT_JOB_VERIFICATION_NO_SIGNATURE_BEHAVIOR", "BUILDKITE_QUEUE", "BUILDKITE_AGENT_ENABLE_GIT_MIRRORS", "BUILDKITE_ELASTIC_BOOTSTRAP_SCRIPT", "BUILDKITE_ENV_FILE_URL", "BUILDKITE_ENABLE_INSTANCE_STORAGE", "BUILDKITE_AUTHORIZED_USERS_URL", "BUILDKITE_ECR_POLICY", "BUILDKITE_TERMINATE_INSTANCE_AFTER_JOB", "BUILDKITE_AGENT_DISCONNECT_AFTER_UPTIME", "BUILDKITE_TERMINATE_INSTANCE_ON_DISK_FULL", "BUILDKITE_PURGE_BUILDS_ON_DISK_FULL", "BUILDKITE_ADDITIONAL_SUDO_PERMISSIONS", "AWS_DEFAULT_REGION", "SECRETS_PLUGIN_ENABLED", "ECR_PLUGIN_ENABLED", "ECR_CREDENTIAL_HELPER_ENABLED", "DOCKER_LOGIN_PLUGIN_ENABLED", "DOCKER_EXPERIMENTAL", "DOCKER_PRUNE_UNTIL", "ENABLE_PRE_EXIT_DISK_CLEANUP", "DOCKER_BUILDER_PRUNE_ENABLED", "DOCKER_USERNS_REMAP", "AWS_REGION", "ENABLE_RESOURCE_LIMITS", "RESOURCE_LIMITS_MEMORY_HIGH", "RESOURCE_LIMITS_MEMORY_MAX", "RESOURCE_LIMITS_MEMORY_SWAP_MAX", "RESOURCE_LIMITS_CPU_WEIGHT", "RESOURCE_LIMITS_CPU_QUOTA", "RESOURCE_LIMITS_IO_WEIGHT", "ENABLE_EC2_LOG_RETENTION_POLICY", "EC2_LOG_RETENTION_DAYS"];
|
|
30
|
+
/**
|
|
31
|
+
* Build the agent instance's multipart user data against the pinned elastic
|
|
32
|
+
* stack's boot scripts (cloud-config re-run marker, storage mount, docker
|
|
33
|
+
* config, `bk-install-elastic-stack.sh`).
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildBuildkiteUserData(props: BuildkiteProps, context: BuildkiteUserDataContext): MultipartUserData;
|
|
36
|
+
/** Storage-mount part — `bk-mount-instance-storage.sh` env assignments. */
|
|
37
|
+
export declare function buildBuildkiteMountCommands(props: BuildkiteProps): string[];
|
|
38
|
+
/** Docker-configure part — `bk-configure-docker.sh` env assignments. */
|
|
39
|
+
export declare function buildBuildkiteDockerCommands(props: BuildkiteProps): string[];
|
|
40
|
+
/**
|
|
41
|
+
* Install part — the env assignments handed to the pinned
|
|
42
|
+
* `bk-install-elastic-stack.sh`, mirroring the upstream block key-for-key in
|
|
43
|
+
* upstream order (so a fixture-bump diff reads line-by-line). Keys with no
|
|
44
|
+
* schema knob carry the upstream v6.68.1 parameter default verbatim, with
|
|
45
|
+
* three deliberate deviations:
|
|
46
|
+
*
|
|
47
|
+
* - `BUILDKITE_S3_ACL`: our artifact bucket is BucketOwnerEnforced (ACLs
|
|
48
|
+
* disabled), where S3 rejects every canned ACL EXCEPT
|
|
49
|
+
* `bucket-owner-full-control` — upstream's `private` default would fail
|
|
50
|
+
* every artifact upload with AccessControlListNotSupported.
|
|
51
|
+
* - `BUILDKITE_ECR_POLICY`: hard-pinned `none` (design § D9 — the instance
|
|
52
|
+
* profile confers no registry credentials).
|
|
53
|
+
* - `BUILDKITE_AGENT_SIGNING_KMS_KEY`: hard-pinned empty. Pipeline signing
|
|
54
|
+
* is out of scope for the Phase-1 deploy fleet; a future signing knob must
|
|
55
|
+
* land WITH the kms:Sign/Verify/GetPublicKey grants it needs (the prior
|
|
56
|
+
* knob shipped without them — a dead toggle that broke agents when set).
|
|
57
|
+
*/
|
|
58
|
+
export declare function buildBuildkiteInstallCommands(props: BuildkiteProps, context: BuildkiteUserDataContext): string[];
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { MultipartBody, MultipartUserData, UserData } from "aws-cdk-lib/aws-ec2";
|
|
2
|
+
import { BUILDKITE_STACK_PINS } from "./pins.js";
|
|
3
|
+
/**
|
|
4
|
+
* The pinned AMI's boot scripts run under `set -Eeuo pipefail` and
|
|
5
|
+
* dereference every variable the upstream template passes — an OMITTED key
|
|
6
|
+
* is not "use the default", it is an unbound-variable crash at boot and an
|
|
7
|
+
* ASG boot-loop. Each part therefore mirrors the upstream v6.68.1 user data
|
|
8
|
+
* env block EXACTLY (same keys, upstream parameter defaults where we expose
|
|
9
|
+
* no knob), and the parity test asserts set equality per part against the
|
|
10
|
+
* vendored template in both directions: a key we emit that upstream does not
|
|
11
|
+
* pass is silently ignored; a key upstream passes that we omit is the
|
|
12
|
+
* boot-loop. Bumping the pins regenerates the fixture
|
|
13
|
+
* (runbook: `aiDocs/runbooks/buildkite-stack-bump-runbook.md`).
|
|
14
|
+
*/
|
|
15
|
+
export const BUILDKITE_MOUNT_PART_ENV_KEYS = [
|
|
16
|
+
"BUILDKITE_ENABLE_INSTANCE_STORAGE",
|
|
17
|
+
"BUILDKITE_MOUNT_TMPFS_AT_TMP"
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Docker-GC values upstream derives from a single CloudFormation parameter
|
|
21
|
+
* feeding BOTH the docker part and the install part — the two emissions must
|
|
22
|
+
* carry the same value or boot-time docker GC and the per-job disk-cleanup
|
|
23
|
+
* hooks silently disagree (coupled values, shared source at 2 occurrences).
|
|
24
|
+
*/
|
|
25
|
+
const DOCKER_PRUNE_UNTIL = "4h";
|
|
26
|
+
const ENABLE_PRE_EXIT_DISK_CLEANUP = "false";
|
|
27
|
+
const DOCKER_BUILDER_PRUNE_ENABLED = "false";
|
|
28
|
+
export const BUILDKITE_DOCKER_PART_ENV_KEYS = [
|
|
29
|
+
"DOCKER_USERNS_REMAP",
|
|
30
|
+
"DOCKER_EXPERIMENTAL",
|
|
31
|
+
"DOCKER_PRUNE_UNTIL",
|
|
32
|
+
"ENABLE_PRE_EXIT_DISK_CLEANUP",
|
|
33
|
+
"DOCKER_BUILDER_PRUNE_ENABLED",
|
|
34
|
+
"DOCKER_NETWORKING_PROTOCOL",
|
|
35
|
+
"DOCKER_IPV4_ADDRESS_POOL_1",
|
|
36
|
+
"DOCKER_IPV4_ADDRESS_POOL_2",
|
|
37
|
+
"DOCKER_IPV6_ADDRESS_POOL",
|
|
38
|
+
"DOCKER_FIXED_CIDR_V4",
|
|
39
|
+
"DOCKER_FIXED_CIDR_V6",
|
|
40
|
+
"BUILDKITE_ENABLE_INSTANCE_STORAGE"
|
|
41
|
+
];
|
|
42
|
+
export const BUILDKITE_USER_DATA_ENV_KEYS = [
|
|
43
|
+
"BUILDKITE_STACK_NAME",
|
|
44
|
+
"BUILDKITE_STACK_VERSION",
|
|
45
|
+
"BUILDKITE_STACK_DEPLOYED_BY",
|
|
46
|
+
"BUILDKITE_SCALE_IN_IDLE_PERIOD",
|
|
47
|
+
"BUILDKITE_SECRETS_BUCKET",
|
|
48
|
+
"BUILDKITE_SECRETS_BUCKET_REGION",
|
|
49
|
+
"BUILDKITE_SECRETS_PLUGIN_SKIP_SSH_KEY_NOT_FOUND_WARNING",
|
|
50
|
+
"BUILDKITE_ARTIFACTS_BUCKET",
|
|
51
|
+
"BUILDKITE_S3_DEFAULT_REGION",
|
|
52
|
+
"BUILDKITE_S3_ACL",
|
|
53
|
+
"BUILDKITE_AGENT_TOKEN_PATH",
|
|
54
|
+
"BUILDKITE_AGENTS_PER_INSTANCE",
|
|
55
|
+
"BUILDKITE_AGENT_ENDPOINT",
|
|
56
|
+
"BUILDKITE_AGENT_TAGS",
|
|
57
|
+
"BUILDKITE_AGENT_TIMESTAMP_LINES",
|
|
58
|
+
"BUILDKITE_AGENT_EXPERIMENTS",
|
|
59
|
+
"BUILDKITE_AGENT_TRACING_BACKEND",
|
|
60
|
+
"BUILDKITE_AGENT_SIGNING_KEY_PATH",
|
|
61
|
+
"BUILDKITE_AGENT_SIGNING_KEY_ID",
|
|
62
|
+
"BUILDKITE_AGENT_VERIFICATION_KEY_PATH",
|
|
63
|
+
"BUILDKITE_AGENT_RELEASE",
|
|
64
|
+
"BUILDKITE_AGENT_CANCEL_GRACE_PERIOD",
|
|
65
|
+
"BUILDKITE_AGENT_SIGNAL_GRACE_PERIOD_SECONDS",
|
|
66
|
+
"BUILDKITE_AGENT_SIGNING_KMS_KEY",
|
|
67
|
+
"BUILDKITE_AGENT_JOB_VERIFICATION_NO_SIGNATURE_BEHAVIOR",
|
|
68
|
+
"BUILDKITE_QUEUE",
|
|
69
|
+
"BUILDKITE_AGENT_ENABLE_GIT_MIRRORS",
|
|
70
|
+
"BUILDKITE_ELASTIC_BOOTSTRAP_SCRIPT",
|
|
71
|
+
"BUILDKITE_ENV_FILE_URL",
|
|
72
|
+
"BUILDKITE_ENABLE_INSTANCE_STORAGE",
|
|
73
|
+
"BUILDKITE_AUTHORIZED_USERS_URL",
|
|
74
|
+
"BUILDKITE_ECR_POLICY",
|
|
75
|
+
"BUILDKITE_TERMINATE_INSTANCE_AFTER_JOB",
|
|
76
|
+
"BUILDKITE_AGENT_DISCONNECT_AFTER_UPTIME",
|
|
77
|
+
"BUILDKITE_TERMINATE_INSTANCE_ON_DISK_FULL",
|
|
78
|
+
"BUILDKITE_PURGE_BUILDS_ON_DISK_FULL",
|
|
79
|
+
"BUILDKITE_ADDITIONAL_SUDO_PERMISSIONS",
|
|
80
|
+
"AWS_DEFAULT_REGION",
|
|
81
|
+
"SECRETS_PLUGIN_ENABLED",
|
|
82
|
+
"ECR_PLUGIN_ENABLED",
|
|
83
|
+
"ECR_CREDENTIAL_HELPER_ENABLED",
|
|
84
|
+
"DOCKER_LOGIN_PLUGIN_ENABLED",
|
|
85
|
+
"DOCKER_EXPERIMENTAL",
|
|
86
|
+
"DOCKER_PRUNE_UNTIL",
|
|
87
|
+
"ENABLE_PRE_EXIT_DISK_CLEANUP",
|
|
88
|
+
"DOCKER_BUILDER_PRUNE_ENABLED",
|
|
89
|
+
"DOCKER_USERNS_REMAP",
|
|
90
|
+
"AWS_REGION",
|
|
91
|
+
"ENABLE_RESOURCE_LIMITS",
|
|
92
|
+
"RESOURCE_LIMITS_MEMORY_HIGH",
|
|
93
|
+
"RESOURCE_LIMITS_MEMORY_MAX",
|
|
94
|
+
"RESOURCE_LIMITS_MEMORY_SWAP_MAX",
|
|
95
|
+
"RESOURCE_LIMITS_CPU_WEIGHT",
|
|
96
|
+
"RESOURCE_LIMITS_CPU_QUOTA",
|
|
97
|
+
"RESOURCE_LIMITS_IO_WEIGHT",
|
|
98
|
+
"ENABLE_EC2_LOG_RETENTION_POLICY",
|
|
99
|
+
"EC2_LOG_RETENTION_DAYS"
|
|
100
|
+
];
|
|
101
|
+
function shellScriptPart(commands) {
|
|
102
|
+
const userData = UserData.forLinux({ shebang: "#!/bin/bash -v" });
|
|
103
|
+
userData.addCommands(...commands);
|
|
104
|
+
return MultipartBody.fromUserData(userData, "text/x-shellscript; charset='us-ascii'");
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Build the agent instance's multipart user data against the pinned elastic
|
|
108
|
+
* stack's boot scripts (cloud-config re-run marker, storage mount, docker
|
|
109
|
+
* config, `bk-install-elastic-stack.sh`).
|
|
110
|
+
*/
|
|
111
|
+
export function buildBuildkiteUserData(props, context) {
|
|
112
|
+
const multipartUserData = new MultipartUserData();
|
|
113
|
+
const cloudConfigUserData = UserData.forLinux({ shebang: "#cloud-config" });
|
|
114
|
+
cloudConfigUserData.addCommands("cloud_final_modules:", " - [scripts-user, always]");
|
|
115
|
+
multipartUserData.addPart(MultipartBody.fromUserData(cloudConfigUserData, "text/cloud-config; charset='us-ascii'"));
|
|
116
|
+
multipartUserData.addPart(shellScriptPart(buildBuildkiteMountCommands(props)));
|
|
117
|
+
multipartUserData.addPart(shellScriptPart(buildBuildkiteDockerCommands(props)));
|
|
118
|
+
multipartUserData.addPart(shellScriptPart(buildBuildkiteInstallCommands(props, context)));
|
|
119
|
+
return multipartUserData;
|
|
120
|
+
}
|
|
121
|
+
/** Storage-mount part — `bk-mount-instance-storage.sh` env assignments. */
|
|
122
|
+
export function buildBuildkiteMountCommands(props) {
|
|
123
|
+
return [
|
|
124
|
+
`BUILDKITE_ENABLE_INSTANCE_STORAGE='${props.enableInstanceStorage}' \\`,
|
|
125
|
+
`BUILDKITE_MOUNT_TMPFS_AT_TMP='${props.mountTmpfsAtTmp}' \\`,
|
|
126
|
+
"/usr/local/bin/bk-mount-instance-storage.sh"
|
|
127
|
+
];
|
|
128
|
+
}
|
|
129
|
+
/** Docker-configure part — `bk-configure-docker.sh` env assignments. */
|
|
130
|
+
export function buildBuildkiteDockerCommands(props) {
|
|
131
|
+
return [
|
|
132
|
+
`DOCKER_USERNS_REMAP='${props.enableDockerUserNamespaceRemap}' \\`,
|
|
133
|
+
`DOCKER_EXPERIMENTAL='${props.enableDockerExperimental}' \\`,
|
|
134
|
+
`DOCKER_PRUNE_UNTIL='${DOCKER_PRUNE_UNTIL}' \\`,
|
|
135
|
+
`ENABLE_PRE_EXIT_DISK_CLEANUP='${ENABLE_PRE_EXIT_DISK_CLEANUP}' \\`,
|
|
136
|
+
`DOCKER_BUILDER_PRUNE_ENABLED='${DOCKER_BUILDER_PRUNE_ENABLED}' \\`,
|
|
137
|
+
`DOCKER_NETWORKING_PROTOCOL='${props.dockerNetworkingProtocol}' \\`,
|
|
138
|
+
"DOCKER_IPV4_ADDRESS_POOL_1='172.17.0.0/12' \\",
|
|
139
|
+
"DOCKER_IPV4_ADDRESS_POOL_2='192.168.0.0/16' \\",
|
|
140
|
+
"DOCKER_IPV6_ADDRESS_POOL='2001:db8:2::/104' \\",
|
|
141
|
+
"DOCKER_FIXED_CIDR_V4='' \\",
|
|
142
|
+
"DOCKER_FIXED_CIDR_V6='2001:db8:1::/64' \\",
|
|
143
|
+
`BUILDKITE_ENABLE_INSTANCE_STORAGE='${props.enableInstanceStorage}' \\`,
|
|
144
|
+
"/usr/local/bin/bk-configure-docker.sh"
|
|
145
|
+
];
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Install part — the env assignments handed to the pinned
|
|
149
|
+
* `bk-install-elastic-stack.sh`, mirroring the upstream block key-for-key in
|
|
150
|
+
* upstream order (so a fixture-bump diff reads line-by-line). Keys with no
|
|
151
|
+
* schema knob carry the upstream v6.68.1 parameter default verbatim, with
|
|
152
|
+
* three deliberate deviations:
|
|
153
|
+
*
|
|
154
|
+
* - `BUILDKITE_S3_ACL`: our artifact bucket is BucketOwnerEnforced (ACLs
|
|
155
|
+
* disabled), where S3 rejects every canned ACL EXCEPT
|
|
156
|
+
* `bucket-owner-full-control` — upstream's `private` default would fail
|
|
157
|
+
* every artifact upload with AccessControlListNotSupported.
|
|
158
|
+
* - `BUILDKITE_ECR_POLICY`: hard-pinned `none` (design § D9 — the instance
|
|
159
|
+
* profile confers no registry credentials).
|
|
160
|
+
* - `BUILDKITE_AGENT_SIGNING_KMS_KEY`: hard-pinned empty. Pipeline signing
|
|
161
|
+
* is out of scope for the Phase-1 deploy fleet; a future signing knob must
|
|
162
|
+
* land WITH the kms:Sign/Verify/GetPublicKey grants it needs (the prior
|
|
163
|
+
* knob shipped without them — a dead toggle that broke agents when set).
|
|
164
|
+
*/
|
|
165
|
+
export function buildBuildkiteInstallCommands(props, context) {
|
|
166
|
+
return [
|
|
167
|
+
`BUILDKITE_STACK_NAME='${context.stackName}' \\`,
|
|
168
|
+
`BUILDKITE_STACK_VERSION='${BUILDKITE_STACK_PINS.elasticStackVersion}' \\`,
|
|
169
|
+
"BUILDKITE_STACK_DEPLOYED_BY='fjall' \\",
|
|
170
|
+
`BUILDKITE_SCALE_IN_IDLE_PERIOD='${props.scaleInIdlePeriodSeconds}' \\`,
|
|
171
|
+
`BUILDKITE_SECRETS_BUCKET='${context.secretsBucketName}' \\`,
|
|
172
|
+
`BUILDKITE_SECRETS_BUCKET_REGION='${context.region}' \\`,
|
|
173
|
+
"BUILDKITE_SECRETS_PLUGIN_SKIP_SSH_KEY_NOT_FOUND_WARNING='false' \\",
|
|
174
|
+
`BUILDKITE_ARTIFACTS_BUCKET='${context.artifactBucketName}' \\`,
|
|
175
|
+
`BUILDKITE_S3_DEFAULT_REGION='${context.region}' \\`,
|
|
176
|
+
"BUILDKITE_S3_ACL='bucket-owner-full-control' \\",
|
|
177
|
+
`BUILDKITE_AGENT_TOKEN_PATH='${props.agentTokenSsmParameterName}' \\`,
|
|
178
|
+
`BUILDKITE_AGENTS_PER_INSTANCE='${props.agentsPerInstance}' \\`,
|
|
179
|
+
"BUILDKITE_AGENT_ENDPOINT='https://agent-edge.buildkite.com/v3' \\",
|
|
180
|
+
`BUILDKITE_AGENT_TAGS='${props.buildkiteAgentTags}' \\`,
|
|
181
|
+
`BUILDKITE_AGENT_TIMESTAMP_LINES='${props.buildkiteAgentTimestampLines}' \\`,
|
|
182
|
+
`BUILDKITE_AGENT_EXPERIMENTS='${props.buildkiteAgentExperiments}' \\`,
|
|
183
|
+
`BUILDKITE_AGENT_TRACING_BACKEND='${props.buildkiteAgentTracingBackend}' \\`,
|
|
184
|
+
"BUILDKITE_AGENT_SIGNING_KEY_PATH='' \\",
|
|
185
|
+
"BUILDKITE_AGENT_SIGNING_KEY_ID='' \\",
|
|
186
|
+
"BUILDKITE_AGENT_VERIFICATION_KEY_PATH='' \\",
|
|
187
|
+
`BUILDKITE_AGENT_RELEASE='${props.buildkiteAgentRelease}' \\`,
|
|
188
|
+
`BUILDKITE_AGENT_CANCEL_GRACE_PERIOD='${props.buildkiteAgentCancelGracePeriodSeconds}' \\`,
|
|
189
|
+
"BUILDKITE_AGENT_SIGNAL_GRACE_PERIOD_SECONDS='-1' \\",
|
|
190
|
+
"BUILDKITE_AGENT_SIGNING_KMS_KEY='' \\",
|
|
191
|
+
"BUILDKITE_AGENT_JOB_VERIFICATION_NO_SIGNATURE_BEHAVIOR='block' \\",
|
|
192
|
+
`BUILDKITE_QUEUE='${props.buildkiteQueue}' \\`,
|
|
193
|
+
`BUILDKITE_AGENT_ENABLE_GIT_MIRRORS='${props.buildkiteAgentEnableGitMirrors}' \\`,
|
|
194
|
+
`BUILDKITE_ELASTIC_BOOTSTRAP_SCRIPT='${props.bootstrapScriptUrl}' \\`,
|
|
195
|
+
`BUILDKITE_ENV_FILE_URL='${props.agentEnvFileUrl}' \\`,
|
|
196
|
+
`BUILDKITE_ENABLE_INSTANCE_STORAGE='${props.enableInstanceStorage}' \\`,
|
|
197
|
+
"BUILDKITE_AUTHORIZED_USERS_URL='' \\",
|
|
198
|
+
"BUILDKITE_ECR_POLICY='none' \\",
|
|
199
|
+
`BUILDKITE_TERMINATE_INSTANCE_AFTER_JOB='${props.terminateInstanceAfterJob}' \\`,
|
|
200
|
+
`BUILDKITE_AGENT_DISCONNECT_AFTER_UPTIME='${props.disconnectAfterUptimeSeconds}' \\`,
|
|
201
|
+
`BUILDKITE_TERMINATE_INSTANCE_ON_DISK_FULL='${props.terminateInstanceOnDiskFull}' \\`,
|
|
202
|
+
`BUILDKITE_PURGE_BUILDS_ON_DISK_FULL='${props.purgeBuildsOnDiskFull}' \\`,
|
|
203
|
+
"BUILDKITE_ADDITIONAL_SUDO_PERMISSIONS='' \\",
|
|
204
|
+
`AWS_DEFAULT_REGION='${context.region}' \\`,
|
|
205
|
+
`SECRETS_PLUGIN_ENABLED='${props.enableSecretsPlugin}' \\`,
|
|
206
|
+
`ECR_PLUGIN_ENABLED='${props.enableEcrPlugin}' \\`,
|
|
207
|
+
"ECR_CREDENTIAL_HELPER_ENABLED='false' \\",
|
|
208
|
+
`DOCKER_LOGIN_PLUGIN_ENABLED='${props.enableDockerLoginPlugin}' \\`,
|
|
209
|
+
`DOCKER_EXPERIMENTAL='${props.enableDockerExperimental}' \\`,
|
|
210
|
+
`DOCKER_PRUNE_UNTIL='${DOCKER_PRUNE_UNTIL}' \\`,
|
|
211
|
+
`ENABLE_PRE_EXIT_DISK_CLEANUP='${ENABLE_PRE_EXIT_DISK_CLEANUP}' \\`,
|
|
212
|
+
`DOCKER_BUILDER_PRUNE_ENABLED='${DOCKER_BUILDER_PRUNE_ENABLED}' \\`,
|
|
213
|
+
`DOCKER_USERNS_REMAP='${props.enableDockerUserNamespaceRemap}' \\`,
|
|
214
|
+
`AWS_REGION='${context.region}' \\`,
|
|
215
|
+
"ENABLE_RESOURCE_LIMITS='false' \\",
|
|
216
|
+
"RESOURCE_LIMITS_MEMORY_HIGH='90%' \\",
|
|
217
|
+
"RESOURCE_LIMITS_MEMORY_MAX='90%' \\",
|
|
218
|
+
"RESOURCE_LIMITS_MEMORY_SWAP_MAX='90%' \\",
|
|
219
|
+
"RESOURCE_LIMITS_CPU_WEIGHT='100' \\",
|
|
220
|
+
"RESOURCE_LIMITS_CPU_QUOTA='90%' \\",
|
|
221
|
+
"RESOURCE_LIMITS_IO_WEIGHT='80' \\",
|
|
222
|
+
"ENABLE_EC2_LOG_RETENTION_POLICY='false' \\",
|
|
223
|
+
"EC2_LOG_RETENTION_DAYS='7' \\",
|
|
224
|
+
"/usr/local/bin/bk-install-elastic-stack.sh"
|
|
225
|
+
];
|
|
226
|
+
}
|
|
@@ -1,59 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
keyName: string;
|
|
14
|
-
buildkiteAgentRelease: AgentRelease;
|
|
15
|
-
buildkiteAgentTags: string;
|
|
16
|
-
buildkiteAgentTimestampLines: boolean;
|
|
17
|
-
buildkiteAgentExperiments: string;
|
|
18
|
-
buildkiteAgentScalerVersion: string;
|
|
19
|
-
logRetentionDays: number;
|
|
20
|
-
buildkiteAgentTracingBackend: "" | "datadog" | "opentelemetry";
|
|
21
|
-
buildkiteAgentCancelGracePeriod: number;
|
|
22
|
-
buildkiteTerminateInstanceAfterJob: boolean;
|
|
23
|
-
buildkiteAdditionalSudoPermissions: string;
|
|
24
|
-
buildkiteQueue: string;
|
|
25
|
-
agentsPerInstance: number;
|
|
26
|
-
bootstrapScriptUrl: string;
|
|
27
|
-
agentEnvFileUrl: string;
|
|
28
|
-
authorizedUsersUrl: string;
|
|
29
|
-
agentInstanceType: InstanceType;
|
|
30
|
-
agentVolumeSize: number;
|
|
31
|
-
agentMinInstances: number;
|
|
32
|
-
agentMaxInstances: number;
|
|
33
|
-
scalerEventSchedulePeriod: string;
|
|
34
|
-
scalerMinPollInterval: string;
|
|
35
|
-
spotCapacityPercentage: number;
|
|
36
|
-
scaleOutFactor: string;
|
|
37
|
-
ecrAccessPolicy: string;
|
|
38
|
-
scaleInIdlePeriod: number;
|
|
39
|
-
scaleOutWaitingForJobs: boolean;
|
|
40
|
-
dockerNetworkingProtocol: "ipv4" | "dualstack";
|
|
41
|
-
enableSecretsPlugin: boolean;
|
|
42
|
-
enableEcrPlugin: boolean;
|
|
43
|
-
enableDockerLoginPlugin: boolean;
|
|
44
|
-
enableDockerUserNamespaceRemap: boolean;
|
|
45
|
-
enableDockerExperimental: boolean;
|
|
46
|
-
enableInstanceStorage: boolean;
|
|
47
|
-
mountTmpfsAtTmp: boolean;
|
|
48
|
-
buildkiteAgentEnableGitMirrors: boolean;
|
|
49
|
-
pipelineSigningKMSKey: string;
|
|
50
|
-
pipelineSigningVerificationFailureBehavior: "block" | "warn";
|
|
51
|
-
tags: KeyValue;
|
|
52
|
-
environment: string;
|
|
53
|
-
owner?: string;
|
|
54
|
-
}
|
|
55
|
-
export declare const BuildkiteDefaultProps: Pick<BuildkiteProps, "elasticStackVersion" | "keyName" | "buildkiteAgentRelease" | "buildkiteAgentTags" | "buildkiteAgentTimestampLines" | "buildkiteAgentExperiments" | "buildkiteAgentScalerVersion" | "logRetentionDays" | "buildkiteAgentTracingBackend" | "buildkiteAgentCancelGracePeriod" | "buildkiteTerminateInstanceAfterJob" | "buildkiteAdditionalSudoPermissions" | "buildkiteQueue" | "agentsPerInstance" | "bootstrapScriptUrl" | "agentEnvFileUrl" | "authorizedUsersUrl" | "agentInstanceType" | "agentVolumeSize" | "agentMinInstances" | "agentMaxInstances" | "scalerEventSchedulePeriod" | "scalerMinPollInterval" | "spotCapacityPercentage" | "scaleOutFactor" | "scaleInIdlePeriod" | "scaleOutWaitingForJobs" | "ecrAccessPolicy" | "dockerNetworkingProtocol" | "enableSecretsPlugin" | "enableEcrPlugin" | "enableDockerLoginPlugin" | "enableDockerUserNamespaceRemap" | "enableDockerExperimental" | "enableInstanceStorage" | "mountTmpfsAtTmp" | "buildkiteAgentEnableGitMirrors" | "pipelineSigningKMSKey" | "pipelineSigningVerificationFailureBehavior" | "environment" | "owner">;
|
|
56
|
-
export declare class Buildkite extends Stack {
|
|
57
|
-
constructor(scope: Construct, id: string, props: BuildkiteProps);
|
|
58
|
-
}
|
|
59
|
-
export default Buildkite;
|
|
1
|
+
/**
|
|
2
|
+
* Self-hosted Buildkite agent fleet — barrel for the `buildkite/` modules.
|
|
3
|
+
* The pre-2026-07 `Buildkite extends Stack` implementation is replaced by a
|
|
4
|
+
* Construct instantiated via `App.addBuildkite()`; design:
|
|
5
|
+
* `aiDocs/designs/2026-07-18-buildkite-selfhosted-agents.md`.
|
|
6
|
+
*/
|
|
7
|
+
export { Buildkite, FJALL_ENV_HOOK_OBJECT_KEY, buildFjallApiKeyEnvHookScript, type BuildkiteConstructProps } from "./buildkite/buildkite.js";
|
|
8
|
+
export { BUILDKITE_AMI_OWNER_ACCOUNT_ID, BUILDKITE_CPU_ARCHITECTURES, BUILDKITE_STACK_PINS, resolvePinnedAmiId, resolveScalerSarApplicationArn, type BuildkiteCpuArchitecture } from "./buildkite/pins.js";
|
|
9
|
+
export { BuildkitePropsSchema, validateBuildkiteProps, type BuildkiteProps, type BuildkitePropsInput } from "./buildkite/schema.js";
|
|
10
|
+
export { BUILDKITE_AGENT_IAM_ACTION_ALLOWLIST, buildAgentRole, type BuildkiteAgentRoleParams } from "./buildkite/iam.js";
|
|
11
|
+
export { BUILDKITE_DOCKER_PART_ENV_KEYS, BUILDKITE_MOUNT_PART_ENV_KEYS, BUILDKITE_USER_DATA_ENV_KEYS, buildBuildkiteDockerCommands, buildBuildkiteInstallCommands, buildBuildkiteMountCommands, buildBuildkiteUserData, type BuildkiteUserDataContext } from "./buildkite/userData.js";
|
|
12
|
+
export { addBuildkiteAlarms, type BuildkiteAlarmParams } from "./buildkite/alarms.js";
|