@pipeline-builder/pipeline-manager 6.3.11 → 6.4.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/cli.d.ts.map +1 -1
- package/dist/cli.js +7 -3
- package/dist/commands/create-pipeline.d.ts.map +1 -1
- package/dist/commands/create-pipeline.js +11 -3
- package/dist/commands/deploy-job.d.ts +70 -0
- package/dist/commands/deploy-job.d.ts.map +1 -0
- package/dist/commands/deploy-job.js +495 -0
- package/dist/commands/register.d.ts.map +1 -1
- package/dist/commands/register.js +2 -1
- package/dist/commands/runner-signing-key.js +2 -2
- package/dist/commands/setup-runner.d.ts +45 -1
- package/dist/commands/setup-runner.d.ts.map +1 -1
- package/dist/commands/setup-runner.js +226 -19
- package/dist/commands/store-token.d.ts +5 -2
- package/dist/commands/store-token.d.ts.map +1 -1
- package/dist/commands/store-token.js +13 -5
- package/dist/commands/validate-templates.js +14 -8
- package/dist/config/cli.constants.d.ts +3 -22
- package/dist/config/cli.constants.d.ts.map +1 -1
- package/dist/config/cli.constants.js +6 -42
- package/dist/lambda/runner-deploy.d.ts +44 -0
- package/dist/lambda/runner-deploy.d.ts.map +1 -0
- package/dist/lambda/runner-deploy.js +203 -0
- package/dist/lambda/runner-handler.d.ts +28 -8
- package/dist/lambda/runner-handler.d.ts.map +1 -1
- package/dist/lambda/runner-handler.js +386 -15
- package/dist/lambda/runner-jws.d.ts +8 -0
- package/dist/lambda/runner-jws.d.ts.map +1 -1
- package/dist/lambda/runner-jws.js +66 -2
- package/dist/templates/runner-stack.json +429 -1
- package/dist/templates/token-renew-stack.json +1 -1
- package/dist/utils/api-client.d.ts +7 -0
- package/dist/utils/api-client.d.ts.map +1 -1
- package/dist/utils/api-client.js +1 -1
- package/dist/utils/cdk-bootstrap.d.ts +18 -0
- package/dist/utils/cdk-bootstrap.d.ts.map +1 -0
- package/dist/utils/cdk-bootstrap.js +41 -0
- package/dist/utils/deploy-assembly.d.ts +18 -0
- package/dist/utils/deploy-assembly.d.ts.map +1 -0
- package/dist/utils/deploy-assembly.js +87 -0
- package/dist/utils/deploy-runner.d.ts +19 -1
- package/dist/utils/deploy-runner.d.ts.map +1 -1
- package/dist/utils/deploy-runner.js +15 -6
- package/dist/utils/deploy-session-client.d.ts +59 -0
- package/dist/utils/deploy-session-client.d.ts.map +1 -0
- package/dist/utils/deploy-session-client.js +145 -0
- package/dist/utils/pipeline-config.d.ts +8 -6
- package/dist/utils/pipeline-config.d.ts.map +1 -1
- package/dist/utils/pipeline-config.js +15 -14
- package/dist/utils/plugin-resolver.d.ts +2 -2
- package/dist/utils/plugin-resolver.d.ts.map +1 -1
- package/dist/utils/plugin-resolver.js +1 -2
- package/dist/utils/registry.d.ts +16 -0
- package/dist/utils/registry.d.ts.map +1 -1
- package/dist/utils/registry.js +11 -6
- package/dist/utils/runner-template.d.ts +24 -0
- package/dist/utils/runner-template.d.ts.map +1 -1
- package/dist/utils/runner-template.js +56 -2
- package/dist/utils/service-account.d.ts +2 -0
- package/dist/utils/service-account.d.ts.map +1 -1
- package/dist/utils/service-account.js +2 -2
- package/dist/utils/toolchain.d.ts +2 -2
- package/dist/utils/toolchain.d.ts.map +1 -1
- package/dist/utils/toolchain.js +1 -1
- package/package.json +7 -4
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// src/lambda/runner-handler.ts
|
|
2
|
+
import { CodeBuildClient } from "@aws-sdk/client-codebuild";
|
|
2
3
|
import {
|
|
3
4
|
CodePipelineClient,
|
|
4
5
|
GetPipelineExecutionCommand,
|
|
5
6
|
StartPipelineExecutionCommand,
|
|
6
7
|
StopPipelineExecutionCommand
|
|
7
8
|
} from "@aws-sdk/client-codepipeline";
|
|
9
|
+
import { KMSClient } from "@aws-sdk/client-kms";
|
|
8
10
|
import { GetResourcesCommand, ResourceGroupsTaggingAPIClient } from "@aws-sdk/client-resource-groups-tagging-api";
|
|
9
11
|
|
|
10
12
|
// ../api-core/lib/types/pipeline-runners.js
|
|
@@ -12,7 +14,15 @@ var PIPELINE_ID_TAG = "pb.pipeline-id";
|
|
|
12
14
|
function runnerJwksPath(runnerId) {
|
|
13
15
|
return `/api/pipelines/runner/runners/${encodeURIComponent(runnerId)}/jwks.json`;
|
|
14
16
|
}
|
|
15
|
-
var RUNNER_ACTIONS = ["start", "stop", "probe", "ping", "status"];
|
|
17
|
+
var RUNNER_ACTIONS = ["start", "stop", "probe", "ping", "status", "deploy", "deploy_status", "deploy_cancel", "undeploy"];
|
|
18
|
+
var DEPLOY_CAPABILITY = "deploy:1";
|
|
19
|
+
var DEPLOY_ACTION_CAPABILITY = {
|
|
20
|
+
deploy: DEPLOY_CAPABILITY,
|
|
21
|
+
deploy_status: DEPLOY_CAPABILITY,
|
|
22
|
+
deploy_cancel: DEPLOY_CAPABILITY,
|
|
23
|
+
undeploy: DEPLOY_CAPABILITY
|
|
24
|
+
};
|
|
25
|
+
var AWS_REGION_PATTERN = /^[a-z]{2}(-[a-z]+)+-\d{1,2}$/;
|
|
16
26
|
var RUNNER_ERRORS = {
|
|
17
27
|
// -- The pipeline service's answers --
|
|
18
28
|
RUNNERS_UNAVAILABLE: { httpStatus: 409, retryable: false, category: "platform" },
|
|
@@ -45,6 +55,33 @@ var RUNNER_ERRORS = {
|
|
|
45
55
|
RUNNER_KEY_MODE_ROOT_ORG: { httpStatus: 409, retryable: false, category: "platform" },
|
|
46
56
|
/** Revoke: the typed confirmation is not the last {@link RUNNER_KEY_REVOKE_CONFIRM_CHARS} characters of the active kid. */
|
|
47
57
|
RUNNER_KEY_CONFIRMATION_MISMATCH: { httpStatus: 400, retryable: false, category: "platform" },
|
|
58
|
+
// -- Deploys through a runner (the pipeline service's answers) --
|
|
59
|
+
/** The runner does not list the `deploy:1` capability (an old bundle, or a stack without --enable-deploy): update it with {@link DEPLOY_SETUP_COMMAND}. */
|
|
60
|
+
RUNNER_DEPLOY_UNSUPPORTED: { httpStatus: 409, retryable: false, category: "platform" },
|
|
61
|
+
/** Several runners can deploy this pipeline and none was named (`details.runners`: the deployable ones). */
|
|
62
|
+
DEPLOY_RUNNER_REQUIRED: { httpStatus: 409, retryable: false, category: "platform" },
|
|
63
|
+
/** The runner named (or the only one) cannot deploy this pipeline (`details.reason`: a {@link DeployTargetReason}). */
|
|
64
|
+
RUNNER_NOT_DEPLOYABLE: { httpStatus: 409, retryable: false, category: "platform" },
|
|
65
|
+
/** The pipeline already has a registry row: deploys through a runner are for a never-deployed pipeline only. */
|
|
66
|
+
ALREADY_DEPLOYED: { httpStatus: 409, retryable: false, category: "platform" },
|
|
67
|
+
/**
|
|
68
|
+
* Another deploy of this pipeline is active (`details.requestId`). Also what a
|
|
69
|
+
* runner answers when its project already builds this pipeline for another
|
|
70
|
+
* request id (the one platform code a runner may send: final, like any 4xx).
|
|
71
|
+
*/
|
|
72
|
+
DEPLOY_IN_PROGRESS: { httpStatus: 409, retryable: false, category: "platform" },
|
|
73
|
+
/** The region asked for is not one of the runner's allowed regions (or several are and none was named). */
|
|
74
|
+
DEPLOY_REGION_NOT_ALLOWED: { httpStatus: 409, retryable: false, category: "platform" },
|
|
75
|
+
/** The pipeline's pinned toolchain release ships no cdk-synth image speaking {@link DEPLOY_JOB_PROTOCOL_VERSION}. */
|
|
76
|
+
TOOLCHAIN_TOO_OLD_FOR_DEPLOY: { httpStatus: 409, retryable: false, category: "platform" },
|
|
77
|
+
/** Cancel of a deploy that already finished. */
|
|
78
|
+
DEPLOY_NOT_CANCELLABLE: { httpStatus: 409, retryable: false, category: "platform" },
|
|
79
|
+
/** DEPLOY_REQUESTS_PER_HOUR for the org. */
|
|
80
|
+
DEPLOY_RATE_LIMITED: { httpStatus: 429, retryable: false, category: "platform" },
|
|
81
|
+
/** MAX_ACTIVE_DEPLOYS_PER_RUNNER deploys already active on the runner. */
|
|
82
|
+
TOO_MANY_DEPLOYS: { httpStatus: 429, retryable: false, category: "platform" },
|
|
83
|
+
/** The deploy job's grant (or session) was refused (`details.reason`: a {@link DeployGrantRejectionReason}). */
|
|
84
|
+
DEPLOY_GRANT_INVALID: { httpStatus: 401, retryable: false, category: "platform" },
|
|
48
85
|
// -- A runner's answers --
|
|
49
86
|
SIGNATURE_INVALID: { httpStatus: 401, retryable: false, category: "runner" },
|
|
50
87
|
RUNNER_REFUSED: { httpStatus: 403, retryable: false, category: "runner" },
|
|
@@ -65,6 +102,15 @@ var RUNNER_ERRORS = {
|
|
|
65
102
|
* this code.
|
|
66
103
|
*/
|
|
67
104
|
RUNNER_ERROR: { httpStatus: 500, retryable: false, category: "runner" },
|
|
105
|
+
// -- A runner's answers to the deploy actions --
|
|
106
|
+
/** The stack was not set up with --enable-deploy (the platform clears the runner's stored capabilities). */
|
|
107
|
+
DEPLOY_NOT_ENABLED: { httpStatus: 403, retryable: false, category: "runner" },
|
|
108
|
+
/** A pipeline tagged with this pipeline id already exists in the account (the platform links it instead). */
|
|
109
|
+
PIPELINE_ALREADY_DEPLOYED: { httpStatus: 409, retryable: false, category: "runner" },
|
|
110
|
+
/** The deploy project is at its concurrent build limit (delivered again). */
|
|
111
|
+
DEPLOY_BUSY: { httpStatus: 409, retryable: true, category: "runner" },
|
|
112
|
+
/** deploy_status / deploy_cancel: no such build in the runner's own deploy project. */
|
|
113
|
+
DEPLOY_BUILD_NOT_FOUND: { httpStatus: 404, retryable: false, category: "runner" },
|
|
68
114
|
// -- Recorded by the platform --
|
|
69
115
|
/** Not delivered within the request's lifetime. */
|
|
70
116
|
RUN_REQUEST_EXPIRED: { httpStatus: null, retryable: false, category: "recorded" },
|
|
@@ -91,6 +137,122 @@ var RUN_REQUEST_MAX_LIFETIME_SECONDS = RUN_REQUEST_TTL_MS / 1e3;
|
|
|
91
137
|
var RUN_REQUEST_CLOCK_SKEW_SECONDS = 120;
|
|
92
138
|
var RUNNER_KEY_ACTIVATION_DELAY_MS = 10 * 6e4;
|
|
93
139
|
var RUNNER_KEY_RETIRE_WINDOW_MS = 60 * 6e4;
|
|
140
|
+
var DEPLOY_STAGES = [
|
|
141
|
+
"queued",
|
|
142
|
+
"starting",
|
|
143
|
+
"authenticating",
|
|
144
|
+
"fetching",
|
|
145
|
+
"prechecking",
|
|
146
|
+
"cleaning",
|
|
147
|
+
"synthesizing",
|
|
148
|
+
"deploying",
|
|
149
|
+
"registering",
|
|
150
|
+
"removing",
|
|
151
|
+
"done"
|
|
152
|
+
];
|
|
153
|
+
var CODEBUILD_BUILD_STATES = {
|
|
154
|
+
IN_PROGRESS: "in_progress",
|
|
155
|
+
SUCCEEDED: "succeeded",
|
|
156
|
+
FAILED: "failed",
|
|
157
|
+
FAULT: "failed",
|
|
158
|
+
STOPPED: "stopped",
|
|
159
|
+
TIMED_OUT: "timed_out"
|
|
160
|
+
};
|
|
161
|
+
function deployBuildState(codebuildStatus) {
|
|
162
|
+
if (!codebuildStatus)
|
|
163
|
+
return "in_progress";
|
|
164
|
+
return Object.hasOwn(CODEBUILD_BUILD_STATES, codebuildStatus) ? CODEBUILD_BUILD_STATES[codebuildStatus] : "failed";
|
|
165
|
+
}
|
|
166
|
+
var RUNNER_DEPLOY_ERRORS = {
|
|
167
|
+
/** The job's grant exchange was refused (reused, unknown, wrong state). */
|
|
168
|
+
DEPLOY_GRANT_REJECTED: { class: "platform", retryable: false },
|
|
169
|
+
/** The grant expired before the job exchanged it ({@link DEPLOY_GRANT_TTL_MS}): the build queued too long. */
|
|
170
|
+
DEPLOY_GRANT_EXPIRED: { class: "platform", retryable: true },
|
|
171
|
+
/** The job could not read the pipeline through its session. */
|
|
172
|
+
PIPELINE_FETCH_FAILED: { class: "platform", retryable: true },
|
|
173
|
+
/** A plugin of the pipeline did not resolve (lookup through the session). */
|
|
174
|
+
PLUGIN_RESOLUTION_FAILED: { class: "definition", retryable: false },
|
|
175
|
+
/** The synthesized pipeline / stack names or region are not the ones the request named. */
|
|
176
|
+
DEPLOY_TARGET_MISMATCH: { class: "definition", retryable: false },
|
|
177
|
+
/** A stack of that name exists and is not this pipeline's (tagged for another pipeline, or untagged). */
|
|
178
|
+
STACK_OWNED_BY_OTHER_PIPELINE: { class: "definition", retryable: false },
|
|
179
|
+
/** The target region has no CDK bootstrap (`pipeline-manager bootstrap --region <r>`). */
|
|
180
|
+
CDK_NOT_BOOTSTRAPPED: { class: "account_setup", retryable: true },
|
|
181
|
+
/** The region's CDK bootstrap is older than the toolchain needs. */
|
|
182
|
+
CDK_BOOTSTRAP_OUTDATED: { class: "account_setup", retryable: true },
|
|
183
|
+
/** Secrets the pipeline needs are not in the account's Secrets Manager. */
|
|
184
|
+
ACCOUNT_SECRETS_MISSING: { class: "account_setup", retryable: true },
|
|
185
|
+
/** A bootstrap role refused an AWS call (or the permissions boundary did). */
|
|
186
|
+
DEPLOY_PERMISSION_DENIED: { class: "aws_permission", retryable: true },
|
|
187
|
+
/** `cdk deploy` failed in CloudFormation. */
|
|
188
|
+
CFN_DEPLOY_FAILED: { class: "cloudformation", retryable: true },
|
|
189
|
+
/** Deleting this pipeline's stack (cleaning a failed first deploy, or an undeploy) did not reach DELETE_COMPLETE. */
|
|
190
|
+
STACK_DELETE_FAILED: { class: "cloudformation", retryable: true },
|
|
191
|
+
/** CodeBuild could not pull the cdk-synth image (registry credential or host). */
|
|
192
|
+
DEPLOY_IMAGE_PULL_FAILED: { class: "image", retryable: true },
|
|
193
|
+
/** The image's deploy-job protocol is not the claim's ({@link DEPLOY_JOB_PROTOCOL_VERSION}). */
|
|
194
|
+
DEPLOY_JOB_PROTOCOL_MISMATCH: { class: "image", retryable: false },
|
|
195
|
+
/**
|
|
196
|
+
* The synthesized stack has Docker image assets: the deploy build is never
|
|
197
|
+
* privileged (no such mode exists on the runner), so a retry fails the same
|
|
198
|
+
* way. A runtime guard — the stacks this product synthesizes carry none.
|
|
199
|
+
*/
|
|
200
|
+
DEPLOY_NEEDS_PRIVILEGED: { class: "image", retryable: false },
|
|
201
|
+
/** Past RUNNER_DEPLOY_DEADLINE_MINUTES, or CodeBuild's own timeout. */
|
|
202
|
+
DEPLOY_TIMED_OUT: { class: "timeout", retryable: true },
|
|
203
|
+
/** A person cancelled it. */
|
|
204
|
+
DEPLOY_CANCELLED: { class: "cancelled", retryable: true },
|
|
205
|
+
/** Anything else inside the job. */
|
|
206
|
+
DEPLOY_JOB_ERROR: { class: "unknown", retryable: true }
|
|
207
|
+
};
|
|
208
|
+
var RUNNER_DEPLOY_ERROR_CODES = Object.keys(RUNNER_DEPLOY_ERRORS);
|
|
209
|
+
function isRunnerDeployErrorCode(code) {
|
|
210
|
+
return typeof code === "string" && Object.prototype.hasOwnProperty.call(RUNNER_DEPLOY_ERRORS, code);
|
|
211
|
+
}
|
|
212
|
+
var DEPLOY_RESULT_OK = "OK";
|
|
213
|
+
var DEPLOY_JOB_RESULT_CODES = [DEPLOY_RESULT_OK, ...RUNNER_DEPLOY_ERROR_CODES];
|
|
214
|
+
function isDeployJobResultCode(code) {
|
|
215
|
+
return code === DEPLOY_RESULT_OK || isRunnerDeployErrorCode(code);
|
|
216
|
+
}
|
|
217
|
+
var DEPLOY_GRANT_PATTERN = /^pb_dg_[A-Za-z0-9_-]{43}$/;
|
|
218
|
+
var DEPLOY_BUILD_QUEUED_TIMEOUT_MINUTES = 30;
|
|
219
|
+
var DEPLOY_GRANT_PROVISIONING_MARGIN_MS = 15 * 6e4;
|
|
220
|
+
function deployGrantTtlMs(queuedTimeoutMinutes = DEPLOY_BUILD_QUEUED_TIMEOUT_MINUTES) {
|
|
221
|
+
return Math.max(RUN_REQUEST_TTL_MS, queuedTimeoutMinutes * 6e4 + DEPLOY_GRANT_PROVISIONING_MARGIN_MS);
|
|
222
|
+
}
|
|
223
|
+
var DEPLOY_GRANT_TTL_MS = deployGrantTtlMs();
|
|
224
|
+
var DEPLOY_GRANT_KMS_PURPOSE = "deploy-grant";
|
|
225
|
+
function deployGrantEncryptionContext(runnerId) {
|
|
226
|
+
return { runnerId, purpose: DEPLOY_GRANT_KMS_PURPOSE };
|
|
227
|
+
}
|
|
228
|
+
var DEPLOY_JOB_IMAGE_REPOSITORY = "system/cdk-synth";
|
|
229
|
+
var DEPLOY_IMAGE_DIGEST_PATTERN = /^sha256:[0-9a-f]{64}$/;
|
|
230
|
+
var DEPLOY_JOB_MODES = ["deploy", "undeploy"];
|
|
231
|
+
var DEPLOY_JOB_ENV = {
|
|
232
|
+
requestId: "PB_REQUEST_ID",
|
|
233
|
+
pipelineId: "PB_PIPELINE_ID",
|
|
234
|
+
region: "PB_TARGET_REGION",
|
|
235
|
+
pipelineName: "PB_PIPELINE_NAME",
|
|
236
|
+
stackName: "PB_STACK_NAME",
|
|
237
|
+
grantCiphertext: "PB_DEPLOY_GRANT_CIPHERTEXT",
|
|
238
|
+
toolchainRelease: "PB_TOOLCHAIN_RELEASE",
|
|
239
|
+
protocol: "PB_DEPLOY_PROTOCOL",
|
|
240
|
+
mode: "PB_JOB_MODE",
|
|
241
|
+
result: "PB_DEPLOY_RESULT",
|
|
242
|
+
stage: "PB_DEPLOY_STAGE"
|
|
243
|
+
};
|
|
244
|
+
var DEPLOY_JOB_EXPORTED_VARIABLES = [DEPLOY_JOB_ENV.result, DEPLOY_JOB_ENV.stage];
|
|
245
|
+
var DEPLOY_JOB_OVERRIDE_ENV = [
|
|
246
|
+
DEPLOY_JOB_ENV.requestId,
|
|
247
|
+
DEPLOY_JOB_ENV.pipelineId,
|
|
248
|
+
DEPLOY_JOB_ENV.region,
|
|
249
|
+
DEPLOY_JOB_ENV.pipelineName,
|
|
250
|
+
DEPLOY_JOB_ENV.stackName,
|
|
251
|
+
DEPLOY_JOB_ENV.grantCiphertext,
|
|
252
|
+
DEPLOY_JOB_ENV.toolchainRelease,
|
|
253
|
+
DEPLOY_JOB_ENV.protocol,
|
|
254
|
+
DEPLOY_JOB_ENV.mode
|
|
255
|
+
];
|
|
94
256
|
|
|
95
257
|
// src/lambda/pipeline-tag.ts
|
|
96
258
|
import { ListTagsForResourceCommand } from "@aws-sdk/client-codepipeline";
|
|
@@ -105,6 +267,142 @@ async function readPipelineIdTag(cp, resourceArn) {
|
|
|
105
267
|
return void 0;
|
|
106
268
|
}
|
|
107
269
|
|
|
270
|
+
// src/lambda/runner-deploy.ts
|
|
271
|
+
import {
|
|
272
|
+
BatchGetBuildsCommand,
|
|
273
|
+
ListBuildsForProjectCommand,
|
|
274
|
+
StartBuildCommand,
|
|
275
|
+
StopBuildCommand
|
|
276
|
+
} from "@aws-sdk/client-codebuild";
|
|
277
|
+
import { EncryptCommand } from "@aws-sdk/client-kms";
|
|
278
|
+
var REGISTRY_PULL_HOST_PATTERN = /^[A-Za-z0-9.-]+(:[0-9]{1,5})?$/;
|
|
279
|
+
function deployConfigFromEnv(env) {
|
|
280
|
+
if (env.DEPLOY_ENABLED?.trim() !== "true") return { enabled: false };
|
|
281
|
+
const need = (name) => {
|
|
282
|
+
const v = env[name]?.trim();
|
|
283
|
+
if (!v) throw new Error(`${name} environment variable is required when DEPLOY_ENABLED=true`);
|
|
284
|
+
return v;
|
|
285
|
+
};
|
|
286
|
+
const registryPullHost = need("REGISTRY_PULL_HOST");
|
|
287
|
+
if (!REGISTRY_PULL_HOST_PATTERN.test(registryPullHost)) throw new Error("REGISTRY_PULL_HOST must be a host or host:port");
|
|
288
|
+
return {
|
|
289
|
+
enabled: true,
|
|
290
|
+
projectName: need("DEPLOY_PROJECT_NAME"),
|
|
291
|
+
registryPullHost,
|
|
292
|
+
registryCredentialSecret: need("REGISTRY_CREDENTIAL_SECRET"),
|
|
293
|
+
grantKeyArn: need("DEPLOY_GRANT_KEY_ARN")
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
var errName = (err) => String(err?.name ?? "");
|
|
297
|
+
var envOf = (b, name) => b.environment?.environmentVariables?.find((v) => v.name === name)?.value;
|
|
298
|
+
var exportedOf = (b, name) => b.exportedEnvironmentVariables?.find((v) => v.name === name)?.value;
|
|
299
|
+
async function inProgressBuilds(ctx, projectName) {
|
|
300
|
+
const listed = await ctx.codebuild.send(new ListBuildsForProjectCommand({ projectName, sortOrder: "DESCENDING" }));
|
|
301
|
+
const ids = (listed.ids ?? []).slice(0, 100);
|
|
302
|
+
if (ids.length === 0) return [];
|
|
303
|
+
const got = await ctx.codebuild.send(new BatchGetBuildsCommand({ ids }));
|
|
304
|
+
return (got.builds ?? []).filter((b) => deployBuildState(b.buildStatus) === "in_progress");
|
|
305
|
+
}
|
|
306
|
+
async function startJob(ctx, claims) {
|
|
307
|
+
const cfg = ctx.config;
|
|
308
|
+
if (!cfg.enabled) return { refuse: "DEPLOY_NOT_ENABLED" };
|
|
309
|
+
const d = claims.deploy;
|
|
310
|
+
const pipelineId = claims.pipelineId;
|
|
311
|
+
if (!ctx.isAllowed(d.region, d.pipelineName)) return { refuse: "RUNNER_REFUSED" };
|
|
312
|
+
if (d.mode === "deploy" && await ctx.alreadyDeployed(pipelineId)) return { refuse: "PIPELINE_ALREADY_DEPLOYED" };
|
|
313
|
+
for (const b of await inProgressBuilds(ctx, cfg.projectName)) {
|
|
314
|
+
if (envOf(b, DEPLOY_JOB_ENV.requestId) === claims.jti && b.id) return { outcome: d.mode === "deploy" ? "deploying" : "undeploying", buildId: b.id };
|
|
315
|
+
if (envOf(b, DEPLOY_JOB_ENV.pipelineId) === pipelineId) return { refuse: "DEPLOY_IN_PROGRESS" };
|
|
316
|
+
}
|
|
317
|
+
const encrypted = await ctx.kms.send(new EncryptCommand({
|
|
318
|
+
KeyId: cfg.grantKeyArn,
|
|
319
|
+
Plaintext: Buffer.from(d.grant, "utf8"),
|
|
320
|
+
EncryptionContext: deployGrantEncryptionContext(ctx.runnerId)
|
|
321
|
+
}));
|
|
322
|
+
if (!encrypted.CiphertextBlob || encrypted.CiphertextBlob.length === 0) throw new Error("KMS returned no ciphertext");
|
|
323
|
+
const ciphertext = Buffer.from(encrypted.CiphertextBlob).toString("base64");
|
|
324
|
+
const env = {
|
|
325
|
+
[DEPLOY_JOB_ENV.requestId]: claims.jti,
|
|
326
|
+
[DEPLOY_JOB_ENV.pipelineId]: pipelineId,
|
|
327
|
+
[DEPLOY_JOB_ENV.region]: d.region,
|
|
328
|
+
[DEPLOY_JOB_ENV.pipelineName]: d.pipelineName,
|
|
329
|
+
[DEPLOY_JOB_ENV.stackName]: d.stackName,
|
|
330
|
+
[DEPLOY_JOB_ENV.grantCiphertext]: ciphertext,
|
|
331
|
+
[DEPLOY_JOB_ENV.toolchainRelease]: d.toolchainRelease,
|
|
332
|
+
[DEPLOY_JOB_ENV.protocol]: String(d.protocol),
|
|
333
|
+
[DEPLOY_JOB_ENV.mode]: d.mode
|
|
334
|
+
};
|
|
335
|
+
let started;
|
|
336
|
+
try {
|
|
337
|
+
started = await ctx.codebuild.send(new StartBuildCommand({
|
|
338
|
+
projectName: cfg.projectName,
|
|
339
|
+
// A redelivery within CodeBuild's token window starts ONE build (the scan above covers the rest).
|
|
340
|
+
idempotencyToken: claims.jti,
|
|
341
|
+
imageOverride: `${cfg.registryPullHost}/${DEPLOY_JOB_IMAGE_REPOSITORY}@${d.image.digest}`,
|
|
342
|
+
imagePullCredentialsTypeOverride: "SERVICE_ROLE",
|
|
343
|
+
registryCredentialOverride: { credential: cfg.registryCredentialSecret, credentialProvider: "SECRETS_MANAGER" },
|
|
344
|
+
environmentVariablesOverride: Object.entries(env).map(([name, value]) => ({ name, value, type: "PLAINTEXT" }))
|
|
345
|
+
}));
|
|
346
|
+
} catch (err) {
|
|
347
|
+
if (errName(err) === "AccountLimitExceededException") return { refuse: "DEPLOY_BUSY" };
|
|
348
|
+
throw err;
|
|
349
|
+
}
|
|
350
|
+
if (!started.build?.id) throw new Error("StartBuild returned no build id");
|
|
351
|
+
return { outcome: d.mode === "deploy" ? "deploying" : "undeploying", buildId: started.build.id };
|
|
352
|
+
}
|
|
353
|
+
async function ownBuild(ctx, claims) {
|
|
354
|
+
const cfg = ctx.config;
|
|
355
|
+
if (!cfg.enabled) return { refuse: "DEPLOY_NOT_ENABLED" };
|
|
356
|
+
const buildId = claims.buildId;
|
|
357
|
+
if (!buildId.startsWith(`${cfg.projectName}:`)) return { refuse: "RUNNER_REFUSED" };
|
|
358
|
+
const got = await ctx.codebuild.send(new BatchGetBuildsCommand({ ids: [buildId] }));
|
|
359
|
+
const b = (got.builds ?? []).find((x) => x.id === buildId);
|
|
360
|
+
if (!b) return { refuse: "DEPLOY_BUILD_NOT_FOUND" };
|
|
361
|
+
if (b.projectName !== cfg.projectName) return { refuse: "RUNNER_REFUSED" };
|
|
362
|
+
if (envOf(b, DEPLOY_JOB_ENV.requestId) !== claims.deployRequestId) return { refuse: "RUNNER_REFUSED" };
|
|
363
|
+
if (envOf(b, DEPLOY_JOB_ENV.pipelineId) !== claims.pipelineId) return { refuse: "RUNNER_REFUSED" };
|
|
364
|
+
return b;
|
|
365
|
+
}
|
|
366
|
+
var isAnswer = (v) => "refuse" in v || "outcome" in v;
|
|
367
|
+
function reported(b, state) {
|
|
368
|
+
const rawStage = exportedOf(b, DEPLOY_JOB_ENV.stage);
|
|
369
|
+
const rawResult = exportedOf(b, DEPLOY_JOB_ENV.result);
|
|
370
|
+
let stage = DEPLOY_STAGES.includes(rawStage ?? "") ? rawStage : null;
|
|
371
|
+
let resultCode = isDeployJobResultCode(rawResult) ? rawResult : null;
|
|
372
|
+
if (state === "failed" && !resultCode && b.phases?.some((p) => p.phaseType === "PROVISIONING" && p.phaseStatus === "FAILED")) {
|
|
373
|
+
resultCode = "DEPLOY_IMAGE_PULL_FAILED";
|
|
374
|
+
stage = stage ?? "starting";
|
|
375
|
+
}
|
|
376
|
+
return { stage, resultCode };
|
|
377
|
+
}
|
|
378
|
+
async function buildStatus(ctx, claims) {
|
|
379
|
+
const b = await ownBuild(ctx, claims);
|
|
380
|
+
if (isAnswer(b)) return b;
|
|
381
|
+
const buildState = deployBuildState(b.buildStatus);
|
|
382
|
+
return { outcome: "deploy_status", buildState, ...reported(b, buildState) };
|
|
383
|
+
}
|
|
384
|
+
async function cancelBuild(ctx, claims) {
|
|
385
|
+
const b = await ownBuild(ctx, claims);
|
|
386
|
+
if (isAnswer(b)) return b;
|
|
387
|
+
const current = deployBuildState(b.buildStatus);
|
|
388
|
+
if (current !== "in_progress") return { outcome: "deploy_cancelled", buildState: current };
|
|
389
|
+
const stopped = await ctx.codebuild.send(new StopBuildCommand({ id: b.id }));
|
|
390
|
+
return { outcome: "deploy_cancelled", buildState: deployBuildState(stopped.build?.buildStatus) };
|
|
391
|
+
}
|
|
392
|
+
async function runDeployAction(ctx, claims) {
|
|
393
|
+
switch (claims.action) {
|
|
394
|
+
case "deploy":
|
|
395
|
+
case "undeploy":
|
|
396
|
+
return startJob(ctx, claims);
|
|
397
|
+
case "deploy_status":
|
|
398
|
+
return buildStatus(ctx, claims);
|
|
399
|
+
case "deploy_cancel":
|
|
400
|
+
return cancelBuild(ctx, claims);
|
|
401
|
+
default:
|
|
402
|
+
throw new Error(`not a deploy action: ${claims.action}`);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
108
406
|
// src/lambda/runner-jws.ts
|
|
109
407
|
import { createPublicKey, verify as cryptoVerify } from "node:crypto";
|
|
110
408
|
var JWKS_TTL_MS = 10 * 60 * 1e3;
|
|
@@ -243,6 +541,16 @@ async function verifyRunRequest(jws, opts) {
|
|
|
243
541
|
}
|
|
244
542
|
hint = { region: raw.region, pipelineName: raw.pipelineName };
|
|
245
543
|
}
|
|
544
|
+
const takesBlock = action === "deploy" || action === "undeploy";
|
|
545
|
+
const takesBuild = action === "deploy_status" || action === "deploy_cancel";
|
|
546
|
+
if (!takesBlock && c.deploy !== void 0) throw new SignatureError("unexpected deploy claim");
|
|
547
|
+
if (!takesBuild && c.deployRequestId !== void 0) throw new SignatureError("unexpected deployRequestId");
|
|
548
|
+
if (!takesBuild && c.buildId !== void 0) throw new SignatureError("unexpected buildId");
|
|
549
|
+
const deploy = takesBlock ? parseDeployClaim(c.deploy, action) : void 0;
|
|
550
|
+
if (takesBuild) {
|
|
551
|
+
if (!isNonEmptyString(c.deployRequestId) || c.deployRequestId.length > 128) throw new SignatureError("missing deployRequestId");
|
|
552
|
+
if (typeof c.buildId !== "string" || !BUILD_ID_PATTERN.test(c.buildId)) throw new SignatureError("malformed buildId");
|
|
553
|
+
}
|
|
246
554
|
return {
|
|
247
555
|
iss: c.iss,
|
|
248
556
|
aud: c.aud,
|
|
@@ -253,9 +561,40 @@ async function verifyRunRequest(jws, opts) {
|
|
|
253
561
|
...isNonEmptyString(c.pipelineId) ? { pipelineId: c.pipelineId } : {},
|
|
254
562
|
...hint ? { hint } : {},
|
|
255
563
|
...isNonEmptyString(c.executionId) ? { executionId: c.executionId } : {},
|
|
564
|
+
...deploy ? { deploy } : {},
|
|
565
|
+
...takesBuild ? { deployRequestId: c.deployRequestId, buildId: c.buildId } : {},
|
|
256
566
|
requestedBy: c.requestedBy
|
|
257
567
|
};
|
|
258
568
|
}
|
|
569
|
+
var PIPELINE_NAME_PATTERN = /^[A-Za-z0-9.@_-]{1,100}$/;
|
|
570
|
+
var STACK_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9-]{0,127}$/;
|
|
571
|
+
var TOOLCHAIN_RELEASE_PATTERN = /^[0-9A-Za-z][0-9A-Za-z.+-]{0,63}$/;
|
|
572
|
+
var BUILD_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{1,254}:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
573
|
+
function parseDeployClaim(raw, action) {
|
|
574
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) throw new SignatureError("missing deploy claim");
|
|
575
|
+
const d = raw;
|
|
576
|
+
if (typeof d.grant !== "string" || !DEPLOY_GRANT_PATTERN.test(d.grant)) throw new SignatureError("malformed deploy grant");
|
|
577
|
+
if (typeof d.protocol !== "number" || !Number.isInteger(d.protocol) || d.protocol < 1) throw new SignatureError("malformed deploy protocol");
|
|
578
|
+
if (!DEPLOY_JOB_MODES.includes(d.mode) || d.mode !== action) throw new SignatureError("deploy mode is not the action");
|
|
579
|
+
if (typeof d.region !== "string" || !AWS_REGION_PATTERN.test(d.region)) throw new SignatureError("malformed deploy region");
|
|
580
|
+
if (typeof d.pipelineName !== "string" || !PIPELINE_NAME_PATTERN.test(d.pipelineName)) throw new SignatureError("malformed deploy pipelineName");
|
|
581
|
+
if (typeof d.stackName !== "string" || !STACK_NAME_PATTERN.test(d.stackName)) throw new SignatureError("malformed deploy stackName");
|
|
582
|
+
const image = d.image;
|
|
583
|
+
if (!image || typeof image !== "object" || Array.isArray(image)) throw new SignatureError("missing deploy image");
|
|
584
|
+
if (image.repository !== DEPLOY_JOB_IMAGE_REPOSITORY) throw new SignatureError("deploy image repository is not the managed cdk-synth");
|
|
585
|
+
if (typeof image.digest !== "string" || !DEPLOY_IMAGE_DIGEST_PATTERN.test(image.digest)) throw new SignatureError("malformed deploy image digest");
|
|
586
|
+
if (typeof d.toolchainRelease !== "string" || !TOOLCHAIN_RELEASE_PATTERN.test(d.toolchainRelease)) throw new SignatureError("malformed deploy toolchainRelease");
|
|
587
|
+
return {
|
|
588
|
+
grant: d.grant,
|
|
589
|
+
protocol: d.protocol,
|
|
590
|
+
mode: d.mode,
|
|
591
|
+
region: d.region,
|
|
592
|
+
pipelineName: d.pipelineName,
|
|
593
|
+
stackName: d.stackName,
|
|
594
|
+
image: { repository: DEPLOY_JOB_IMAGE_REPOSITORY, digest: image.digest },
|
|
595
|
+
toolchainRelease: d.toolchainRelease
|
|
596
|
+
};
|
|
597
|
+
}
|
|
259
598
|
var ReplayCache = class {
|
|
260
599
|
constructor(now) {
|
|
261
600
|
this.now = now;
|
|
@@ -301,7 +640,8 @@ function configFromEnv(env = process.env) {
|
|
|
301
640
|
platformBaseUrl,
|
|
302
641
|
allowedRegions,
|
|
303
642
|
allowedPrefixes,
|
|
304
|
-
version: env.RUNNER_VERSION?.trim() || "0.0.0"
|
|
643
|
+
version: env.RUNNER_VERSION?.trim() || "0.0.0",
|
|
644
|
+
deploy: deployConfigFromEnv(env)
|
|
305
645
|
};
|
|
306
646
|
}
|
|
307
647
|
function defaultLog(level, msg, data) {
|
|
@@ -312,6 +652,8 @@ function defaultLog(level, msg, data) {
|
|
|
312
652
|
function defaultDeps() {
|
|
313
653
|
const tagging = /* @__PURE__ */ new Map();
|
|
314
654
|
const cp = /* @__PURE__ */ new Map();
|
|
655
|
+
let codebuild;
|
|
656
|
+
let kms;
|
|
315
657
|
return {
|
|
316
658
|
fetch: (url, init) => fetch(url, init),
|
|
317
659
|
now: () => Date.now(),
|
|
@@ -323,6 +665,8 @@ function defaultDeps() {
|
|
|
323
665
|
if (!cp.has(region)) cp.set(region, new CodePipelineClient({ region }));
|
|
324
666
|
return cp.get(region);
|
|
325
667
|
},
|
|
668
|
+
codebuild: () => codebuild ??= new CodeBuildClient({}),
|
|
669
|
+
kms: () => kms ??= new KMSClient({}),
|
|
326
670
|
log: defaultLog
|
|
327
671
|
};
|
|
328
672
|
}
|
|
@@ -341,10 +685,10 @@ function isAllowed(config, region, name) {
|
|
|
341
685
|
if (!config.allowedRegions.includes(region)) return false;
|
|
342
686
|
return config.allowedPrefixes.some((p) => p === "*" || name.startsWith(p));
|
|
343
687
|
}
|
|
344
|
-
var
|
|
688
|
+
var errName2 = (err) => String(err?.name ?? "");
|
|
345
689
|
var errStatus = (err) => err?.$metadata?.httpStatusCode;
|
|
346
690
|
function isAccessDenied(err) {
|
|
347
|
-
const n =
|
|
691
|
+
const n = errName2(err);
|
|
348
692
|
return n === "AccessDeniedException" || n === "AccessDenied" || n === "UnauthorizedOperation" || n === "AuthorizationErrorException" || errStatus(err) === 403 && !/Throttl/.test(n);
|
|
349
693
|
}
|
|
350
694
|
var NOT_FOUND_ERRORS = /* @__PURE__ */ new Set(["ResourceNotFoundException", "PipelineNotFoundException", "InvalidArnException"]);
|
|
@@ -375,7 +719,7 @@ async function hintedTag(deps, account, hint) {
|
|
|
375
719
|
try {
|
|
376
720
|
return await readPipelineIdTag(deps.codepipeline(hint.region), resourceArn) ?? null;
|
|
377
721
|
} catch (err) {
|
|
378
|
-
if (NOT_FOUND_ERRORS.has(
|
|
722
|
+
if (NOT_FOUND_ERRORS.has(errName2(err))) return void 0;
|
|
379
723
|
throw err;
|
|
380
724
|
}
|
|
381
725
|
}
|
|
@@ -405,7 +749,7 @@ var LOOKUP_REFUSALS = {
|
|
|
405
749
|
};
|
|
406
750
|
function isFinal(r) {
|
|
407
751
|
if (r.status >= 500) return false;
|
|
408
|
-
return !("errorCode" in r.body && r.body.errorCode === "NOT_YET_VISIBLE");
|
|
752
|
+
return !("errorCode" in r.body && (r.body.errorCode === "NOT_YET_VISIBLE" || r.body.errorCode === "DEPLOY_BUSY"));
|
|
409
753
|
}
|
|
410
754
|
function createRunner(config, deps) {
|
|
411
755
|
const jwks = config.runnerId ? new JwksCache(`${config.platformBaseUrl}${runnerJwksPath(config.runnerId)}`, deps.fetch, deps.now) : { get: async () => void 0 };
|
|
@@ -420,8 +764,8 @@ function createRunner(config, deps) {
|
|
|
420
764
|
if (e?.pipelineName !== void 0 && e.pipelineName !== pipelineName) return fail("RUNNER_REFUSED");
|
|
421
765
|
return { ...e?.status ? { executionStatus: e.status } : {} };
|
|
422
766
|
} catch (err) {
|
|
423
|
-
if (
|
|
424
|
-
if (
|
|
767
|
+
if (errName2(err) === "PipelineNotFoundException") return fail("PIPELINE_NOT_FOUND");
|
|
768
|
+
if (errName2(err) === "PipelineExecutionNotFoundException") return fail("RUNNER_REFUSED");
|
|
425
769
|
throw err;
|
|
426
770
|
}
|
|
427
771
|
}
|
|
@@ -435,7 +779,7 @@ function createRunner(config, deps) {
|
|
|
435
779
|
}));
|
|
436
780
|
return ok("started", out.pipelineExecutionId ? { executionId: out.pipelineExecutionId } : {});
|
|
437
781
|
} catch (err) {
|
|
438
|
-
if (
|
|
782
|
+
if (errName2(err) === "PipelineNotFoundException") return fail("PIPELINE_NOT_FOUND");
|
|
439
783
|
throw err;
|
|
440
784
|
}
|
|
441
785
|
}
|
|
@@ -452,7 +796,7 @@ function createRunner(config, deps) {
|
|
|
452
796
|
reason: `Stopped by pipeline-builder request ${claims.jti}`.slice(0, 200)
|
|
453
797
|
}));
|
|
454
798
|
} catch (err) {
|
|
455
|
-
const n =
|
|
799
|
+
const n = errName2(err);
|
|
456
800
|
if (n === "DuplicatedStopRequestException") return ok("stopped", { executionId });
|
|
457
801
|
if (n === "PipelineNotFoundException") return fail("PIPELINE_NOT_FOUND");
|
|
458
802
|
if (n === "PipelineExecutionNotStoppableException" || n === "PipelineExecutionNotFoundException") return fail("RUNNER_REFUSED");
|
|
@@ -465,8 +809,28 @@ function createRunner(config, deps) {
|
|
|
465
809
|
if (isResult(execution)) return execution;
|
|
466
810
|
return ok("status", { executionId: claims.executionId, executionStatus: execution.executionStatus ?? "Unknown" });
|
|
467
811
|
}
|
|
812
|
+
async function deployAction(claims) {
|
|
813
|
+
const answer = await runDeployAction({
|
|
814
|
+
runnerId: config.runnerId,
|
|
815
|
+
config: config.deploy,
|
|
816
|
+
codebuild: deps.codebuild(),
|
|
817
|
+
kms: deps.kms(),
|
|
818
|
+
isAllowed: (region, name) => isAllowed(config, region, name),
|
|
819
|
+
alreadyDeployed: async (pipelineId) => (await arnsByTag(config, deps, pipelineId)).length > 0
|
|
820
|
+
}, claims);
|
|
821
|
+
if ("refuse" in answer) return fail(answer.refuse);
|
|
822
|
+
const { outcome, ...details } = answer;
|
|
823
|
+
return ok(outcome, details);
|
|
824
|
+
}
|
|
468
825
|
async function act(claims, account) {
|
|
469
|
-
if (claims.action === "ping")
|
|
826
|
+
if (claims.action === "ping") {
|
|
827
|
+
return ok("pong", {
|
|
828
|
+
regions: [...config.allowedRegions],
|
|
829
|
+
capabilities: config.deploy.enabled ? [DEPLOY_CAPABILITY] : [],
|
|
830
|
+
pipelinePrefixes: [...config.allowedPrefixes]
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
if (Object.hasOwn(DEPLOY_ACTION_CAPABILITY, claims.action)) return deployAction(claims);
|
|
470
834
|
const found = await findPipeline(config, deps, account, claims.pipelineId, claims.hint);
|
|
471
835
|
if (claims.action === "probe") {
|
|
472
836
|
if (found.kind === "ambiguous") return fail("AMBIGUOUS_PIPELINE");
|
|
@@ -492,7 +856,7 @@ function createRunner(config, deps) {
|
|
|
492
856
|
deps.log("ERROR", "Could not fetch the platform signing keys", { reason: err.message });
|
|
493
857
|
return internal();
|
|
494
858
|
}
|
|
495
|
-
deps.log("ERROR", "Unexpected verification failure", { error:
|
|
859
|
+
deps.log("ERROR", "Unexpected verification failure", { error: errName2(err) || "Error" });
|
|
496
860
|
return internal();
|
|
497
861
|
}
|
|
498
862
|
const prior = replay.claim(claims.jti);
|
|
@@ -506,17 +870,24 @@ function createRunner(config, deps) {
|
|
|
506
870
|
result = await act(claims, opts.account);
|
|
507
871
|
} catch (err) {
|
|
508
872
|
if (isAccessDenied(err)) {
|
|
509
|
-
deps.log("ERROR", "The runner role was refused by AWS \u2014 redeploy the runner stack or fix its role", { ...logCtx, error:
|
|
873
|
+
deps.log("ERROR", "The runner role was refused by AWS \u2014 redeploy the runner stack or fix its role", { ...logCtx, error: errName2(err) });
|
|
510
874
|
result = fail("RUNNER_PERMISSION_DENIED");
|
|
511
875
|
} else {
|
|
512
|
-
deps.log("ERROR", "Request failed", { ...logCtx, error:
|
|
876
|
+
deps.log("ERROR", "Request failed", { ...logCtx, error: errName2(err) || "Error" });
|
|
513
877
|
result = internal();
|
|
514
878
|
}
|
|
515
879
|
}
|
|
516
880
|
if (isFinal(result)) replay.complete(claims.jti, result);
|
|
517
881
|
else replay.forget(claims.jti);
|
|
518
882
|
const b = result.body;
|
|
519
|
-
deps.log("INFO", "Request handled", {
|
|
883
|
+
deps.log("INFO", "Request handled", {
|
|
884
|
+
...logCtx,
|
|
885
|
+
status: result.status,
|
|
886
|
+
outcome: b.outcome ?? b.errorCode,
|
|
887
|
+
...b.executionId ? { executionId: b.executionId } : {},
|
|
888
|
+
// `<project>:<uuid>` — no account id. The grant and its ciphertext are never logged.
|
|
889
|
+
...b.buildId ? { buildId: b.buildId } : {}
|
|
890
|
+
});
|
|
520
891
|
return result;
|
|
521
892
|
}
|
|
522
893
|
async function handleHttp(event, account) {
|
|
@@ -84,6 +84,14 @@ export declare function verifyRunRequest(jws: string, opts: {
|
|
|
84
84
|
runnerId?: string;
|
|
85
85
|
now: () => number;
|
|
86
86
|
}): Promise<RunClaims>;
|
|
87
|
+
/** A CodePipeline name (what the runner's prefix allowlist is matched against). */
|
|
88
|
+
export declare const PIPELINE_NAME_PATTERN: RegExp;
|
|
89
|
+
/** A CloudFormation stack name. */
|
|
90
|
+
export declare const STACK_NAME_PATTERN: RegExp;
|
|
91
|
+
/** A managed toolchain release version (semver-like; it rides into a CodeBuild env override). */
|
|
92
|
+
export declare const TOOLCHAIN_RELEASE_PATTERN: RegExp;
|
|
93
|
+
/** A CodeBuild build id: `<project>:<uuid>` (no account id, no ARN). */
|
|
94
|
+
export declare const BUILD_ID_PATTERN: RegExp;
|
|
87
95
|
/** A remembered request: its final result once known. */
|
|
88
96
|
interface Seen<R> {
|
|
89
97
|
firstSeenAt: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner-jws.d.ts","sources":["../../src/lambda/runner-jws.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAA2C,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,
|
|
1
|
+
{"version":3,"file":"runner-jws.d.ts","sources":["../../src/lambda/runner-jws.ts"],"names":[],"mappings":"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"}
|