@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.js
CHANGED
|
@@ -277,6 +277,7 @@ __export(index_exports, {
|
|
|
277
277
|
DEFAULT_UNBLOCK_COMMENT_TEMPLATE: () => DEFAULT_UNBLOCK_COMMENT_TEMPLATE,
|
|
278
278
|
DEFAULT_UNBLOCK_DEPENDENTS_ENABLED: () => DEFAULT_UNBLOCK_DEPENDENTS_ENABLED,
|
|
279
279
|
DEFAULT_UPSTREAM_CONFIGULATOR_ENABLED: () => DEFAULT_UPSTREAM_CONFIGULATOR_ENABLED,
|
|
280
|
+
DEPLOY_GATE: () => DEPLOY_GATE,
|
|
280
281
|
DOCS_SYNC_AUDIT_SCHEMA_VERSION: () => DOCS_SYNC_AUDIT_SCHEMA_VERSION,
|
|
281
282
|
GITHUB_ISSUE_TYPES: () => GITHUB_ISSUE_TYPES,
|
|
282
283
|
GITHUB_ISSUE_TYPE_BY_TITLE_PREFIX: () => GITHUB_ISSUE_TYPE_BY_TITLE_PREFIX,
|
|
@@ -457,6 +458,7 @@ __export(index_exports, {
|
|
|
457
458
|
renderFocusSection: () => renderFocusSection,
|
|
458
459
|
renderGithubIssueTypeSection: () => renderGithubIssueTypeSection,
|
|
459
460
|
renderGithubIssueTypeSectionLines: () => renderGithubIssueTypeSectionLines,
|
|
461
|
+
renderHomeRepositoryCondition: () => renderHomeRepositoryCondition,
|
|
460
462
|
renderIssueTemplateLabelsCheckerScript: () => renderIssueTemplateLabelsCheckerScript,
|
|
461
463
|
renderIssueTemplatesBundleHook: () => renderIssueTemplatesBundleHook,
|
|
462
464
|
renderIssueTemplatesCheckerScript: () => renderIssueTemplatesCheckerScript,
|
|
@@ -506,6 +508,7 @@ __export(index_exports, {
|
|
|
506
508
|
resolveBuildPolicy: () => resolveBuildPolicy,
|
|
507
509
|
resolveBundleAgentTiers: () => resolveBundleAgentTiers,
|
|
508
510
|
resolveDefaultAgentTier: () => resolveDefaultAgentTier,
|
|
511
|
+
resolveEnvironmentGate: () => resolveEnvironmentGate,
|
|
509
512
|
resolveIssueDefaults: () => resolveIssueDefaults,
|
|
510
513
|
resolveIssueTemplates: () => resolveIssueTemplates,
|
|
511
514
|
resolveModelAlias: () => resolveModelAlias,
|
|
@@ -37971,6 +37974,7 @@ var CdkCli = class _CdkCli extends import_projen11.Component {
|
|
|
37971
37974
|
this.diffDefaults = options.diffDefaults ?? {};
|
|
37972
37975
|
this.bootstrapDefaults = options.bootstrapDefaults ?? {};
|
|
37973
37976
|
this.accountOverrides = options.accountOverrides ?? {};
|
|
37977
|
+
this.cliVersion = options.cliVersion ?? project.cdkDeps.cdkCliVersion;
|
|
37974
37978
|
}
|
|
37975
37979
|
/**
|
|
37976
37980
|
* Resolve the `cdk deploy` options to use against a given target.
|
|
@@ -42292,6 +42296,49 @@ var import_projen26 = require("projen");
|
|
|
42292
42296
|
var import_build = require("projen/lib/build");
|
|
42293
42297
|
var import_github6 = require("projen/lib/github");
|
|
42294
42298
|
var import_workflows_model5 = require("projen/lib/github/workflows-model");
|
|
42299
|
+
|
|
42300
|
+
// src/workflows/deploy-gate.ts
|
|
42301
|
+
var DEPLOY_GATE = {
|
|
42302
|
+
/**
|
|
42303
|
+
* Hold each deploy job behind a GitHub environment so its protection rules —
|
|
42304
|
+
* required reviewers, wait timers, deployment branch policies — apply before
|
|
42305
|
+
* the job is sent to a runner.
|
|
42306
|
+
*/
|
|
42307
|
+
ENVIRONMENT: "environment"
|
|
42308
|
+
};
|
|
42309
|
+
var resolveEnvironmentGate = (gate, environmentName, componentName) => {
|
|
42310
|
+
const trimmed = environmentName?.trim();
|
|
42311
|
+
if (gate === void 0) {
|
|
42312
|
+
if (trimmed) {
|
|
42313
|
+
throw new Error(
|
|
42314
|
+
`${componentName} requires \`gate\` to be set when \`environmentName\` is supplied, got "${environmentName}" with no gate`
|
|
42315
|
+
);
|
|
42316
|
+
}
|
|
42317
|
+
return void 0;
|
|
42318
|
+
}
|
|
42319
|
+
if (!trimmed) {
|
|
42320
|
+
throw new Error(
|
|
42321
|
+
`${componentName} requires a non-empty \`environmentName\` when \`gate\` is "${gate}"`
|
|
42322
|
+
);
|
|
42323
|
+
}
|
|
42324
|
+
return trimmed;
|
|
42325
|
+
};
|
|
42326
|
+
|
|
42327
|
+
// src/workflows/home-repository.ts
|
|
42328
|
+
var HOME_REPOSITORY_PATTERN = /^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/;
|
|
42329
|
+
var renderHomeRepositoryCondition = (homeRepository, componentName) => {
|
|
42330
|
+
if (homeRepository === void 0) {
|
|
42331
|
+
return void 0;
|
|
42332
|
+
}
|
|
42333
|
+
if (!HOME_REPOSITORY_PATTERN.test(homeRepository)) {
|
|
42334
|
+
throw new Error(
|
|
42335
|
+
`${componentName} requires \`homeRepository\` to be an \`owner/repo\` slug, got "${homeRepository}"`
|
|
42336
|
+
);
|
|
42337
|
+
}
|
|
42338
|
+
return `github.repository == '${homeRepository}'`;
|
|
42339
|
+
};
|
|
42340
|
+
|
|
42341
|
+
// src/workflows/aws-deploy-workflow.ts
|
|
42295
42342
|
var PROD_DEPLOY_NAME = "prod-deploy";
|
|
42296
42343
|
var DIFF_OUTPUT_FILE = "cdk-diff.txt";
|
|
42297
42344
|
var DIFF_SUMMARY_BYTE_LIMIT = 9e5;
|
|
@@ -42418,17 +42465,18 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen26.Compone
|
|
|
42418
42465
|
awsDeploymentConfig
|
|
42419
42466
|
} = target;
|
|
42420
42467
|
const { roleArn, stackPattern } = ciDeploymentConfig ?? {};
|
|
42421
|
-
const { rootCdkOut } = awsDeploymentConfig;
|
|
42468
|
+
const { rootCdkOut, cdkCli } = awsDeploymentConfig;
|
|
42422
42469
|
const deployJobName = this.buildJobName(target);
|
|
42423
42470
|
return [
|
|
42424
42471
|
...this.setupPnpm(),
|
|
42425
42472
|
...this.setupNode(),
|
|
42426
42473
|
/**
|
|
42427
|
-
* Install CDK
|
|
42474
|
+
* Install CDK, pinned to the same version that synthesized the cloud
|
|
42475
|
+
* assembly being deployed. See {@link CdkCli.cliVersion}.
|
|
42428
42476
|
*/
|
|
42429
42477
|
{
|
|
42430
42478
|
name: "Install CDK",
|
|
42431
|
-
run:
|
|
42479
|
+
run: `pnpm add "aws-cdk@${cdkCli.cliVersion}"`
|
|
42432
42480
|
},
|
|
42433
42481
|
/**
|
|
42434
42482
|
* Configure AWS creds.
|
|
@@ -42448,8 +42496,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen26.Compone
|
|
|
42448
42496
|
*/
|
|
42449
42497
|
{
|
|
42450
42498
|
name: `Deploy ${awsStageType}/${deploymentTargetRole}/${account}/${region}`,
|
|
42451
|
-
run: `pnpm dlx aws-cdk ${renderCdkDeploy({
|
|
42452
|
-
...
|
|
42499
|
+
run: `pnpm dlx "aws-cdk@${cdkCli.cliVersion}" ${renderCdkDeploy({
|
|
42500
|
+
...cdkCli.deployOptionsFor(target),
|
|
42453
42501
|
app: rootCdkOut,
|
|
42454
42502
|
stackPatterns: stackPattern ? [stackPattern] : void 0
|
|
42455
42503
|
})} --outputs-file cdk-outputs.json`
|
|
@@ -42501,8 +42549,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen26.Compone
|
|
|
42501
42549
|
* Steps for a target's optional `cdk diff` job.
|
|
42502
42550
|
*
|
|
42503
42551
|
* Mirrors {@link deploySteps}' toolchain and credential setup — same pnpm /
|
|
42504
|
-
* Node setup, same
|
|
42505
|
-
*
|
|
42552
|
+
* Node setup, same version-pinned `aws-cdk` install, same OIDC role — so a
|
|
42553
|
+
* diff is computed by the same CLI that will run the deploy.
|
|
42506
42554
|
*
|
|
42507
42555
|
* The `cdk diff` flags come from the {@link CdkCli} precedence chain via
|
|
42508
42556
|
* `diffOptionsFor(target)`, so `method`, `securityOnly`, `fail`, and the rest
|
|
@@ -42522,7 +42570,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen26.Compone
|
|
|
42522
42570
|
awsDeploymentConfig
|
|
42523
42571
|
} = target;
|
|
42524
42572
|
const { roleArn, stackPattern } = ciDeploymentConfig ?? {};
|
|
42525
|
-
const { rootCdkOut } = awsDeploymentConfig;
|
|
42573
|
+
const { rootCdkOut, cdkCli } = awsDeploymentConfig;
|
|
42526
42574
|
const label = `${awsStageType}/${deploymentTargetRole}/${account}/${region}`;
|
|
42527
42575
|
const artifactName = this.buildDiffArtifactName(target);
|
|
42528
42576
|
const capturedFileGuard = `always() && hashFiles('${DIFF_OUTPUT_FILE}') != ''`;
|
|
@@ -42531,11 +42579,12 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen26.Compone
|
|
|
42531
42579
|
...this.setupPnpm(),
|
|
42532
42580
|
...this.setupNode(),
|
|
42533
42581
|
/**
|
|
42534
|
-
* Install CDK
|
|
42582
|
+
* Install CDK, pinned to the same version that synthesized the cloud
|
|
42583
|
+
* assembly being diffed. See {@link CdkCli.cliVersion}.
|
|
42535
42584
|
*/
|
|
42536
42585
|
{
|
|
42537
42586
|
name: "Install CDK",
|
|
42538
|
-
run:
|
|
42587
|
+
run: `pnpm add "aws-cdk@${cdkCli.cliVersion}"`
|
|
42539
42588
|
},
|
|
42540
42589
|
/**
|
|
42541
42590
|
* Configure AWS creds.
|
|
@@ -42559,8 +42608,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen26.Compone
|
|
|
42559
42608
|
shell: "bash",
|
|
42560
42609
|
run: [
|
|
42561
42610
|
"set -o pipefail",
|
|
42562
|
-
`pnpm dlx aws-cdk ${renderCdkDiff({
|
|
42563
|
-
...
|
|
42611
|
+
`pnpm dlx "aws-cdk@${cdkCli.cliVersion}" ${renderCdkDiff({
|
|
42612
|
+
...cdkCli.diffOptionsFor(target),
|
|
42564
42613
|
app: rootCdkOut,
|
|
42565
42614
|
ci: true,
|
|
42566
42615
|
noColor: true,
|
|
@@ -42642,6 +42691,16 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen26.Compone
|
|
|
42642
42691
|
artifact: options.diff?.artifact ?? true,
|
|
42643
42692
|
summary: options.diff?.summary ?? true
|
|
42644
42693
|
};
|
|
42694
|
+
this.environmentName = resolveEnvironmentGate(
|
|
42695
|
+
options.gate,
|
|
42696
|
+
options.environmentName,
|
|
42697
|
+
"AwsDeployWorkflow"
|
|
42698
|
+
);
|
|
42699
|
+
this.homeRepository = options.homeRepository;
|
|
42700
|
+
const homeRepositoryCondition = renderHomeRepositoryCondition(
|
|
42701
|
+
this.homeRepository,
|
|
42702
|
+
"AwsDeployWorkflow"
|
|
42703
|
+
);
|
|
42645
42704
|
if (options.buildWorkflow && options.buildWorkflowOptions) {
|
|
42646
42705
|
throw new Error(
|
|
42647
42706
|
"Cannot provide both buildWorkflow and buildWorkflowOptions"
|
|
@@ -42719,14 +42778,17 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen26.Compone
|
|
|
42719
42778
|
const branchFilterCondition = this.buildBranchFilterCondition(
|
|
42720
42779
|
target.branches
|
|
42721
42780
|
);
|
|
42722
|
-
const jobCondition =
|
|
42781
|
+
const jobCondition = "${{ " + [
|
|
42723
42782
|
"!needs.build.outputs.self_mutation_happened",
|
|
42724
|
-
|
|
42725
|
-
|
|
42783
|
+
...homeRepositoryCondition ? [homeRepositoryCondition] : [],
|
|
42784
|
+
...branchFilterCondition ? [`(${branchFilterCondition})`] : []
|
|
42785
|
+
].join(" && ") + " }}";
|
|
42786
|
+
const gatedOnDiff = !!this.environmentName && this.diffOptions.enabled;
|
|
42726
42787
|
this.buildWorkflow.addPostBuildJob(deployJobName, {
|
|
42727
42788
|
name: `Deploy ${this.project.name} ${target.awsStageType}/${target.deploymentTargetRole}/${target.account}/${target.region}`,
|
|
42728
42789
|
needs: [
|
|
42729
42790
|
"build",
|
|
42791
|
+
...gatedOnDiff ? [this.buildDiffJobName(target)] : [],
|
|
42730
42792
|
...this.deployAfterTargets.map((p) => {
|
|
42731
42793
|
return this.buildJobName(p);
|
|
42732
42794
|
})
|
|
@@ -42737,6 +42799,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen26.Compone
|
|
|
42737
42799
|
idToken: import_workflows_model5.JobPermission.WRITE,
|
|
42738
42800
|
pullRequests: import_workflows_model5.JobPermission.WRITE
|
|
42739
42801
|
},
|
|
42802
|
+
...this.environmentName ? { environment: this.environmentName } : void 0,
|
|
42740
42803
|
concurrency: deployJobName,
|
|
42741
42804
|
if: jobCondition,
|
|
42742
42805
|
steps: [...this.deploySteps(target)]
|
|
@@ -42817,7 +42880,8 @@ var AwsTeardownWorkflow = class extends import_projen27.Component {
|
|
|
42817
42880
|
stageTypeTagName,
|
|
42818
42881
|
environmentTypeTagName,
|
|
42819
42882
|
branchNameTagName,
|
|
42820
|
-
deleteBranchPatterns
|
|
42883
|
+
deleteBranchPatterns,
|
|
42884
|
+
homeRepository
|
|
42821
42885
|
} = options;
|
|
42822
42886
|
if (!repoTagName) {
|
|
42823
42887
|
throw new Error("AwsTeardownWorkflow requires `repoTagName`");
|
|
@@ -42846,6 +42910,10 @@ var AwsTeardownWorkflow = class extends import_projen27.Component {
|
|
|
42846
42910
|
deleteBranchPatterns,
|
|
42847
42911
|
awsDestructionTargets
|
|
42848
42912
|
);
|
|
42913
|
+
const homeRepositoryCondition = renderHomeRepositoryCondition(
|
|
42914
|
+
homeRepository,
|
|
42915
|
+
"AwsTeardownWorkflow"
|
|
42916
|
+
);
|
|
42849
42917
|
const workflow = new import_github7.GithubWorkflow(github, "teardown-dev");
|
|
42850
42918
|
workflow.on({
|
|
42851
42919
|
workflowDispatch: {},
|
|
@@ -42872,6 +42940,7 @@ var AwsTeardownWorkflow = class extends import_projen27.Component {
|
|
|
42872
42940
|
{
|
|
42873
42941
|
name: `Teardown Stacks in ${awsStageType}/${deploymentTargetRole}/${account}/${region}`,
|
|
42874
42942
|
runsOn: ["ubuntu-latest"],
|
|
42943
|
+
...homeRepositoryCondition ? { if: `\${{ ${homeRepositoryCondition} }}` } : {},
|
|
42875
42944
|
permissions: {
|
|
42876
42945
|
contents: import_workflows_model6.JobPermission.READ,
|
|
42877
42946
|
idToken: import_workflows_model6.JobPermission.WRITE
|
|
@@ -43726,6 +43795,7 @@ export const collections = {
|
|
|
43726
43795
|
DEFAULT_UNBLOCK_COMMENT_TEMPLATE,
|
|
43727
43796
|
DEFAULT_UNBLOCK_DEPENDENTS_ENABLED,
|
|
43728
43797
|
DEFAULT_UPSTREAM_CONFIGULATOR_ENABLED,
|
|
43798
|
+
DEPLOY_GATE,
|
|
43729
43799
|
DOCS_SYNC_AUDIT_SCHEMA_VERSION,
|
|
43730
43800
|
GITHUB_ISSUE_TYPES,
|
|
43731
43801
|
GITHUB_ISSUE_TYPE_BY_TITLE_PREFIX,
|
|
@@ -43906,6 +43976,7 @@ export const collections = {
|
|
|
43906
43976
|
renderFocusSection,
|
|
43907
43977
|
renderGithubIssueTypeSection,
|
|
43908
43978
|
renderGithubIssueTypeSectionLines,
|
|
43979
|
+
renderHomeRepositoryCondition,
|
|
43909
43980
|
renderIssueTemplateLabelsCheckerScript,
|
|
43910
43981
|
renderIssueTemplatesBundleHook,
|
|
43911
43982
|
renderIssueTemplatesCheckerScript,
|
|
@@ -43955,6 +44026,7 @@ export const collections = {
|
|
|
43955
44026
|
resolveBuildPolicy,
|
|
43956
44027
|
resolveBundleAgentTiers,
|
|
43957
44028
|
resolveDefaultAgentTier,
|
|
44029
|
+
resolveEnvironmentGate,
|
|
43958
44030
|
resolveIssueDefaults,
|
|
43959
44031
|
resolveIssueTemplates,
|
|
43960
44032
|
resolveModelAlias,
|