@codedrifters/configulator 0.0.423 → 0.0.425
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/lib/index.d.mts +143 -5
- package/lib/index.d.ts +144 -6
- package/lib/index.js +88 -16
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +85 -16
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -37596,6 +37596,7 @@ var CdkCli = class _CdkCli extends Component11 {
|
|
|
37596
37596
|
this.diffDefaults = options.diffDefaults ?? {};
|
|
37597
37597
|
this.bootstrapDefaults = options.bootstrapDefaults ?? {};
|
|
37598
37598
|
this.accountOverrides = options.accountOverrides ?? {};
|
|
37599
|
+
this.cliVersion = options.cliVersion ?? project.cdkDeps.cdkCliVersion;
|
|
37599
37600
|
}
|
|
37600
37601
|
/**
|
|
37601
37602
|
* Resolve the `cdk deploy` options to use against a given target.
|
|
@@ -41930,6 +41931,49 @@ import { Component as Component22 } from "projen";
|
|
|
41930
41931
|
import { BuildWorkflow } from "projen/lib/build";
|
|
41931
41932
|
import { GitHub as GitHub5, WorkflowSteps as WorkflowSteps2 } from "projen/lib/github";
|
|
41932
41933
|
import { JobPermission as JobPermission5 } from "projen/lib/github/workflows-model";
|
|
41934
|
+
|
|
41935
|
+
// src/workflows/deploy-gate.ts
|
|
41936
|
+
var DEPLOY_GATE = {
|
|
41937
|
+
/**
|
|
41938
|
+
* Hold each deploy job behind a GitHub environment so its protection rules —
|
|
41939
|
+
* required reviewers, wait timers, deployment branch policies — apply before
|
|
41940
|
+
* the job is sent to a runner.
|
|
41941
|
+
*/
|
|
41942
|
+
ENVIRONMENT: "environment"
|
|
41943
|
+
};
|
|
41944
|
+
var resolveEnvironmentGate = (gate, environmentName, componentName) => {
|
|
41945
|
+
const trimmed = environmentName?.trim();
|
|
41946
|
+
if (gate === void 0) {
|
|
41947
|
+
if (trimmed) {
|
|
41948
|
+
throw new Error(
|
|
41949
|
+
`${componentName} requires \`gate\` to be set when \`environmentName\` is supplied, got "${environmentName}" with no gate`
|
|
41950
|
+
);
|
|
41951
|
+
}
|
|
41952
|
+
return void 0;
|
|
41953
|
+
}
|
|
41954
|
+
if (!trimmed) {
|
|
41955
|
+
throw new Error(
|
|
41956
|
+
`${componentName} requires a non-empty \`environmentName\` when \`gate\` is "${gate}"`
|
|
41957
|
+
);
|
|
41958
|
+
}
|
|
41959
|
+
return trimmed;
|
|
41960
|
+
};
|
|
41961
|
+
|
|
41962
|
+
// src/workflows/home-repository.ts
|
|
41963
|
+
var HOME_REPOSITORY_PATTERN = /^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/;
|
|
41964
|
+
var renderHomeRepositoryCondition = (homeRepository, componentName) => {
|
|
41965
|
+
if (homeRepository === void 0) {
|
|
41966
|
+
return void 0;
|
|
41967
|
+
}
|
|
41968
|
+
if (!HOME_REPOSITORY_PATTERN.test(homeRepository)) {
|
|
41969
|
+
throw new Error(
|
|
41970
|
+
`${componentName} requires \`homeRepository\` to be an \`owner/repo\` slug, got "${homeRepository}"`
|
|
41971
|
+
);
|
|
41972
|
+
}
|
|
41973
|
+
return `github.repository == '${homeRepository}'`;
|
|
41974
|
+
};
|
|
41975
|
+
|
|
41976
|
+
// src/workflows/aws-deploy-workflow.ts
|
|
41933
41977
|
var PROD_DEPLOY_NAME = "prod-deploy";
|
|
41934
41978
|
var DIFF_OUTPUT_FILE = "cdk-diff.txt";
|
|
41935
41979
|
var DIFF_SUMMARY_BYTE_LIMIT = 9e5;
|
|
@@ -42056,17 +42100,18 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42056
42100
|
awsDeploymentConfig
|
|
42057
42101
|
} = target;
|
|
42058
42102
|
const { roleArn, stackPattern } = ciDeploymentConfig ?? {};
|
|
42059
|
-
const { rootCdkOut } = awsDeploymentConfig;
|
|
42103
|
+
const { rootCdkOut, cdkCli } = awsDeploymentConfig;
|
|
42060
42104
|
const deployJobName = this.buildJobName(target);
|
|
42061
42105
|
return [
|
|
42062
42106
|
...this.setupPnpm(),
|
|
42063
42107
|
...this.setupNode(),
|
|
42064
42108
|
/**
|
|
42065
|
-
* Install CDK
|
|
42109
|
+
* Install CDK, pinned to the same version that synthesized the cloud
|
|
42110
|
+
* assembly being deployed. See {@link CdkCli.cliVersion}.
|
|
42066
42111
|
*/
|
|
42067
42112
|
{
|
|
42068
42113
|
name: "Install CDK",
|
|
42069
|
-
run:
|
|
42114
|
+
run: `pnpm add "aws-cdk@${cdkCli.cliVersion}"`
|
|
42070
42115
|
},
|
|
42071
42116
|
/**
|
|
42072
42117
|
* Configure AWS creds.
|
|
@@ -42086,8 +42131,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42086
42131
|
*/
|
|
42087
42132
|
{
|
|
42088
42133
|
name: `Deploy ${awsStageType}/${deploymentTargetRole}/${account}/${region}`,
|
|
42089
|
-
run: `pnpm dlx aws-cdk ${renderCdkDeploy({
|
|
42090
|
-
...
|
|
42134
|
+
run: `pnpm dlx "aws-cdk@${cdkCli.cliVersion}" ${renderCdkDeploy({
|
|
42135
|
+
...cdkCli.deployOptionsFor(target),
|
|
42091
42136
|
app: rootCdkOut,
|
|
42092
42137
|
stackPatterns: stackPattern ? [stackPattern] : void 0
|
|
42093
42138
|
})} --outputs-file cdk-outputs.json`
|
|
@@ -42139,8 +42184,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42139
42184
|
* Steps for a target's optional `cdk diff` job.
|
|
42140
42185
|
*
|
|
42141
42186
|
* Mirrors {@link deploySteps}' toolchain and credential setup — same pnpm /
|
|
42142
|
-
* Node setup, same
|
|
42143
|
-
*
|
|
42187
|
+
* Node setup, same version-pinned `aws-cdk` install, same OIDC role — so a
|
|
42188
|
+
* diff is computed by the same CLI that will run the deploy.
|
|
42144
42189
|
*
|
|
42145
42190
|
* The `cdk diff` flags come from the {@link CdkCli} precedence chain via
|
|
42146
42191
|
* `diffOptionsFor(target)`, so `method`, `securityOnly`, `fail`, and the rest
|
|
@@ -42160,7 +42205,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42160
42205
|
awsDeploymentConfig
|
|
42161
42206
|
} = target;
|
|
42162
42207
|
const { roleArn, stackPattern } = ciDeploymentConfig ?? {};
|
|
42163
|
-
const { rootCdkOut } = awsDeploymentConfig;
|
|
42208
|
+
const { rootCdkOut, cdkCli } = awsDeploymentConfig;
|
|
42164
42209
|
const label = `${awsStageType}/${deploymentTargetRole}/${account}/${region}`;
|
|
42165
42210
|
const artifactName = this.buildDiffArtifactName(target);
|
|
42166
42211
|
const capturedFileGuard = `always() && hashFiles('${DIFF_OUTPUT_FILE}') != ''`;
|
|
@@ -42169,11 +42214,12 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42169
42214
|
...this.setupPnpm(),
|
|
42170
42215
|
...this.setupNode(),
|
|
42171
42216
|
/**
|
|
42172
|
-
* Install CDK
|
|
42217
|
+
* Install CDK, pinned to the same version that synthesized the cloud
|
|
42218
|
+
* assembly being diffed. See {@link CdkCli.cliVersion}.
|
|
42173
42219
|
*/
|
|
42174
42220
|
{
|
|
42175
42221
|
name: "Install CDK",
|
|
42176
|
-
run:
|
|
42222
|
+
run: `pnpm add "aws-cdk@${cdkCli.cliVersion}"`
|
|
42177
42223
|
},
|
|
42178
42224
|
/**
|
|
42179
42225
|
* Configure AWS creds.
|
|
@@ -42197,8 +42243,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42197
42243
|
shell: "bash",
|
|
42198
42244
|
run: [
|
|
42199
42245
|
"set -o pipefail",
|
|
42200
|
-
`pnpm dlx aws-cdk ${renderCdkDiff({
|
|
42201
|
-
...
|
|
42246
|
+
`pnpm dlx "aws-cdk@${cdkCli.cliVersion}" ${renderCdkDiff({
|
|
42247
|
+
...cdkCli.diffOptionsFor(target),
|
|
42202
42248
|
app: rootCdkOut,
|
|
42203
42249
|
ci: true,
|
|
42204
42250
|
noColor: true,
|
|
@@ -42280,6 +42326,16 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42280
42326
|
artifact: options.diff?.artifact ?? true,
|
|
42281
42327
|
summary: options.diff?.summary ?? true
|
|
42282
42328
|
};
|
|
42329
|
+
this.environmentName = resolveEnvironmentGate(
|
|
42330
|
+
options.gate,
|
|
42331
|
+
options.environmentName,
|
|
42332
|
+
"AwsDeployWorkflow"
|
|
42333
|
+
);
|
|
42334
|
+
this.homeRepository = options.homeRepository;
|
|
42335
|
+
const homeRepositoryCondition = renderHomeRepositoryCondition(
|
|
42336
|
+
this.homeRepository,
|
|
42337
|
+
"AwsDeployWorkflow"
|
|
42338
|
+
);
|
|
42283
42339
|
if (options.buildWorkflow && options.buildWorkflowOptions) {
|
|
42284
42340
|
throw new Error(
|
|
42285
42341
|
"Cannot provide both buildWorkflow and buildWorkflowOptions"
|
|
@@ -42357,14 +42413,17 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42357
42413
|
const branchFilterCondition = this.buildBranchFilterCondition(
|
|
42358
42414
|
target.branches
|
|
42359
42415
|
);
|
|
42360
|
-
const jobCondition =
|
|
42416
|
+
const jobCondition = "${{ " + [
|
|
42361
42417
|
"!needs.build.outputs.self_mutation_happened",
|
|
42362
|
-
|
|
42363
|
-
|
|
42418
|
+
...homeRepositoryCondition ? [homeRepositoryCondition] : [],
|
|
42419
|
+
...branchFilterCondition ? [`(${branchFilterCondition})`] : []
|
|
42420
|
+
].join(" && ") + " }}";
|
|
42421
|
+
const gatedOnDiff = !!this.environmentName && this.diffOptions.enabled;
|
|
42364
42422
|
this.buildWorkflow.addPostBuildJob(deployJobName, {
|
|
42365
42423
|
name: `Deploy ${this.project.name} ${target.awsStageType}/${target.deploymentTargetRole}/${target.account}/${target.region}`,
|
|
42366
42424
|
needs: [
|
|
42367
42425
|
"build",
|
|
42426
|
+
...gatedOnDiff ? [this.buildDiffJobName(target)] : [],
|
|
42368
42427
|
...this.deployAfterTargets.map((p) => {
|
|
42369
42428
|
return this.buildJobName(p);
|
|
42370
42429
|
})
|
|
@@ -42375,6 +42434,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42375
42434
|
idToken: JobPermission5.WRITE,
|
|
42376
42435
|
pullRequests: JobPermission5.WRITE
|
|
42377
42436
|
},
|
|
42437
|
+
...this.environmentName ? { environment: this.environmentName } : void 0,
|
|
42378
42438
|
concurrency: deployJobName,
|
|
42379
42439
|
if: jobCondition,
|
|
42380
42440
|
steps: [...this.deploySteps(target)]
|
|
@@ -42455,7 +42515,8 @@ var AwsTeardownWorkflow = class extends Component23 {
|
|
|
42455
42515
|
stageTypeTagName,
|
|
42456
42516
|
environmentTypeTagName,
|
|
42457
42517
|
branchNameTagName,
|
|
42458
|
-
deleteBranchPatterns
|
|
42518
|
+
deleteBranchPatterns,
|
|
42519
|
+
homeRepository
|
|
42459
42520
|
} = options;
|
|
42460
42521
|
if (!repoTagName) {
|
|
42461
42522
|
throw new Error("AwsTeardownWorkflow requires `repoTagName`");
|
|
@@ -42484,6 +42545,10 @@ var AwsTeardownWorkflow = class extends Component23 {
|
|
|
42484
42545
|
deleteBranchPatterns,
|
|
42485
42546
|
awsDestructionTargets
|
|
42486
42547
|
);
|
|
42548
|
+
const homeRepositoryCondition = renderHomeRepositoryCondition(
|
|
42549
|
+
homeRepository,
|
|
42550
|
+
"AwsTeardownWorkflow"
|
|
42551
|
+
);
|
|
42487
42552
|
const workflow = new GithubWorkflow(github, "teardown-dev");
|
|
42488
42553
|
workflow.on({
|
|
42489
42554
|
workflowDispatch: {},
|
|
@@ -42510,6 +42575,7 @@ var AwsTeardownWorkflow = class extends Component23 {
|
|
|
42510
42575
|
{
|
|
42511
42576
|
name: `Teardown Stacks in ${awsStageType}/${deploymentTargetRole}/${account}/${region}`,
|
|
42512
42577
|
runsOn: ["ubuntu-latest"],
|
|
42578
|
+
...homeRepositoryCondition ? { if: `\${{ ${homeRepositoryCondition} }}` } : {},
|
|
42513
42579
|
permissions: {
|
|
42514
42580
|
contents: JobPermission6.READ,
|
|
42515
42581
|
idToken: JobPermission6.WRITE
|
|
@@ -43363,6 +43429,7 @@ export {
|
|
|
43363
43429
|
DEFAULT_UNBLOCK_COMMENT_TEMPLATE,
|
|
43364
43430
|
DEFAULT_UNBLOCK_DEPENDENTS_ENABLED,
|
|
43365
43431
|
DEFAULT_UPSTREAM_CONFIGULATOR_ENABLED,
|
|
43432
|
+
DEPLOY_GATE,
|
|
43366
43433
|
DOCS_SYNC_AUDIT_SCHEMA_VERSION,
|
|
43367
43434
|
GITHUB_ISSUE_TYPES,
|
|
43368
43435
|
GITHUB_ISSUE_TYPE_BY_TITLE_PREFIX,
|
|
@@ -43543,6 +43610,7 @@ export {
|
|
|
43543
43610
|
renderFocusSection,
|
|
43544
43611
|
renderGithubIssueTypeSection,
|
|
43545
43612
|
renderGithubIssueTypeSectionLines,
|
|
43613
|
+
renderHomeRepositoryCondition,
|
|
43546
43614
|
renderIssueTemplateLabelsCheckerScript,
|
|
43547
43615
|
renderIssueTemplatesBundleHook,
|
|
43548
43616
|
renderIssueTemplatesCheckerScript,
|
|
@@ -43592,6 +43660,7 @@ export {
|
|
|
43592
43660
|
resolveBuildPolicy,
|
|
43593
43661
|
resolveBundleAgentTiers,
|
|
43594
43662
|
resolveDefaultAgentTier,
|
|
43663
|
+
resolveEnvironmentGate,
|
|
43595
43664
|
resolveIssueDefaults,
|
|
43596
43665
|
resolveIssueTemplates,
|
|
43597
43666
|
resolveModelAlias,
|