@codedrifters/configulator 0.0.425 → 0.0.426
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 +192 -13
- package/lib/index.d.ts +193 -14
- package/lib/index.js +355 -33
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +353 -36
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -41929,7 +41929,7 @@ import { merge as merge4 } from "ts-deepmerge";
|
|
|
41929
41929
|
var import_utils11 = __toESM(require_lib());
|
|
41930
41930
|
import { Component as Component22 } from "projen";
|
|
41931
41931
|
import { BuildWorkflow } from "projen/lib/build";
|
|
41932
|
-
import { GitHub as GitHub5, WorkflowSteps as WorkflowSteps2 } from "projen/lib/github";
|
|
41932
|
+
import { GitHub as GitHub5, GithubWorkflow, WorkflowSteps as WorkflowSteps2 } from "projen/lib/github";
|
|
41933
41933
|
import { JobPermission as JobPermission5 } from "projen/lib/github/workflows-model";
|
|
41934
41934
|
|
|
41935
41935
|
// src/workflows/deploy-gate.ts
|
|
@@ -41939,7 +41939,17 @@ var DEPLOY_GATE = {
|
|
|
41939
41939
|
* required reviewers, wait timers, deployment branch policies — apply before
|
|
41940
41940
|
* the job is sent to a runner.
|
|
41941
41941
|
*/
|
|
41942
|
-
ENVIRONMENT: "environment"
|
|
41942
|
+
ENVIRONMENT: "environment",
|
|
41943
|
+
/**
|
|
41944
|
+
* Split the workflow in two. A **plan** workflow builds and diffs but never
|
|
41945
|
+
* deploys; a dispatch-only **apply** workflow deploys the exact cloud
|
|
41946
|
+
* assembly a nominated plan run produced.
|
|
41947
|
+
*
|
|
41948
|
+
* Needs no protection rule, so unlike {@link DEPLOY_GATE.ENVIRONMENT} it
|
|
41949
|
+
* works on every GitHub plan. `environmentName` is optional here and layers
|
|
41950
|
+
* an environment onto the apply jobs.
|
|
41951
|
+
*/
|
|
41952
|
+
PLAN_APPLY: "plan-apply"
|
|
41943
41953
|
};
|
|
41944
41954
|
var resolveEnvironmentGate = (gate, environmentName, componentName) => {
|
|
41945
41955
|
const trimmed = environmentName?.trim();
|
|
@@ -41951,7 +41961,7 @@ var resolveEnvironmentGate = (gate, environmentName, componentName) => {
|
|
|
41951
41961
|
}
|
|
41952
41962
|
return void 0;
|
|
41953
41963
|
}
|
|
41954
|
-
if (!trimmed) {
|
|
41964
|
+
if (gate === DEPLOY_GATE.ENVIRONMENT && !trimmed) {
|
|
41955
41965
|
throw new Error(
|
|
41956
41966
|
`${componentName} requires a non-empty \`environmentName\` when \`gate\` is "${gate}"`
|
|
41957
41967
|
);
|
|
@@ -41973,6 +41983,105 @@ var renderHomeRepositoryCondition = (homeRepository, componentName) => {
|
|
|
41973
41983
|
return `github.repository == '${homeRepository}'`;
|
|
41974
41984
|
};
|
|
41975
41985
|
|
|
41986
|
+
// src/workflows/plan-apply.ts
|
|
41987
|
+
var VALIDATE_PLAN_JOB_ID = "validate-plan";
|
|
41988
|
+
var PLAN_RUN_ID_INPUT = "plan_run_id";
|
|
41989
|
+
var BUILD_ARTIFACT_NAME = "build-artifact";
|
|
41990
|
+
var PERMISSION_BACKUP_FILE = "permissions-backup.acl";
|
|
41991
|
+
var renderPlanValidationScript = (options) => {
|
|
41992
|
+
const {
|
|
41993
|
+
planWorkflowPath,
|
|
41994
|
+
allowedBranches,
|
|
41995
|
+
requireCurrentHead,
|
|
41996
|
+
verifyArtifactDigest
|
|
41997
|
+
} = options;
|
|
41998
|
+
return [
|
|
41999
|
+
"const raw = (process.env.PLAN_RUN_ID ?? '').trim();",
|
|
42000
|
+
"const runId = Number(raw);",
|
|
42001
|
+
"if (!/^[0-9]+$/.test(raw) || !Number.isSafeInteger(runId) || runId <= 0) {",
|
|
42002
|
+
' core.setFailed(`plan_run_id must be a positive run id, got "${raw}"`);',
|
|
42003
|
+
" return;",
|
|
42004
|
+
"}",
|
|
42005
|
+
"",
|
|
42006
|
+
"const { owner, repo } = context.repo;",
|
|
42007
|
+
"const { data: run } = await github.rest.actions.getWorkflowRun({",
|
|
42008
|
+
" owner,",
|
|
42009
|
+
" repo,",
|
|
42010
|
+
" run_id: runId,",
|
|
42011
|
+
"});",
|
|
42012
|
+
"",
|
|
42013
|
+
`const expectedPath = ${JSON.stringify(planWorkflowPath)};`,
|
|
42014
|
+
"if (run.path !== expectedPath) {",
|
|
42015
|
+
' core.setFailed(`Run ${runId} belongs to workflow "${run.path}", expected "${expectedPath}".`);',
|
|
42016
|
+
" return;",
|
|
42017
|
+
"}",
|
|
42018
|
+
"",
|
|
42019
|
+
'if (run.status !== "completed" || run.conclusion !== "success") {',
|
|
42020
|
+
' core.setFailed(`Run ${runId} is status "${run.status}" / conclusion "${run.conclusion}", expected a completed successful plan run.`);',
|
|
42021
|
+
" return;",
|
|
42022
|
+
"}",
|
|
42023
|
+
"",
|
|
42024
|
+
`const allowedBranches = ${JSON.stringify(allowedBranches)};`,
|
|
42025
|
+
'const branch = run.head_branch ?? "";',
|
|
42026
|
+
"const branchAllowed = allowedBranches.some((pattern) =>",
|
|
42027
|
+
' pattern.includes("*")',
|
|
42028
|
+
' ? branch.startsWith(pattern.slice(0, pattern.indexOf("*")))',
|
|
42029
|
+
" : branch === pattern,",
|
|
42030
|
+
");",
|
|
42031
|
+
"if (!branchAllowed) {",
|
|
42032
|
+
' core.setFailed(`Run ${runId} ran on branch "${branch}", which no deployment target in this workflow accepts (allowed: ${allowedBranches.join(", ")}).`);',
|
|
42033
|
+
" return;",
|
|
42034
|
+
"}",
|
|
42035
|
+
...requireCurrentHead ? [
|
|
42036
|
+
"",
|
|
42037
|
+
"const { data: liveBranch } = await github.rest.repos.getBranch({",
|
|
42038
|
+
" owner,",
|
|
42039
|
+
" repo,",
|
|
42040
|
+
" branch,",
|
|
42041
|
+
"});",
|
|
42042
|
+
"if (liveBranch.commit.sha !== run.head_sha) {",
|
|
42043
|
+
' core.setFailed(`Run ${runId} planned ${run.head_sha} but "${branch}" now points at ${liveBranch.commit.sha}. Re-run the plan workflow against the current head.`);',
|
|
42044
|
+
" return;",
|
|
42045
|
+
"}"
|
|
42046
|
+
] : [],
|
|
42047
|
+
"",
|
|
42048
|
+
"const artifacts = await github.paginate(",
|
|
42049
|
+
" github.rest.actions.listWorkflowRunArtifacts,",
|
|
42050
|
+
" { owner, repo, run_id: runId, per_page: 100 },",
|
|
42051
|
+
");",
|
|
42052
|
+
`const artifactName = ${JSON.stringify(BUILD_ARTIFACT_NAME)};`,
|
|
42053
|
+
"const artifact = artifacts.find((a) => a.name === artifactName);",
|
|
42054
|
+
"if (!artifact) {",
|
|
42055
|
+
' core.setFailed(`Run ${runId} published no "${artifactName}" artifact. Only a plan run whose build job completed can be applied.`);',
|
|
42056
|
+
" return;",
|
|
42057
|
+
"}",
|
|
42058
|
+
"if (artifact.expired) {",
|
|
42059
|
+
' core.setFailed(`The "${artifactName}" artifact on run ${runId} expired at ${artifact.expires_at}. Artifact retention is this gate\'s approval window \u2014 re-run the plan workflow.`);',
|
|
42060
|
+
" return;",
|
|
42061
|
+
"}",
|
|
42062
|
+
...verifyArtifactDigest ? [
|
|
42063
|
+
"if (!artifact.digest) {",
|
|
42064
|
+
' core.setFailed(`The "${artifactName}" artifact on run ${runId} reports no digest, so it cannot be verified. Disable planApply.verifyArtifactDigest or re-run the plan workflow.`);',
|
|
42065
|
+
" return;",
|
|
42066
|
+
"}",
|
|
42067
|
+
'core.setOutput("artifact_digest", artifact.digest);'
|
|
42068
|
+
] : [],
|
|
42069
|
+
"",
|
|
42070
|
+
'core.setOutput("head_sha", run.head_sha);',
|
|
42071
|
+
'core.setOutput("head_branch", branch);',
|
|
42072
|
+
"await core.summary",
|
|
42073
|
+
" .addHeading(`Applying plan run ${runId}`, 2)",
|
|
42074
|
+
" .addTable([",
|
|
42075
|
+
' [{ data: "Field", header: true }, { data: "Value", header: true }],',
|
|
42076
|
+
' ["Plan run", `<a href="${run.html_url}">${runId}</a>`],',
|
|
42077
|
+
' ["Branch", branch],',
|
|
42078
|
+
' ["Commit", run.head_sha],',
|
|
42079
|
+
' ["Artifact expires", artifact.expires_at ?? "unknown"],',
|
|
42080
|
+
" ])",
|
|
42081
|
+
" .write();"
|
|
42082
|
+
].join("\n");
|
|
42083
|
+
};
|
|
42084
|
+
|
|
41976
42085
|
// src/workflows/aws-deploy-workflow.ts
|
|
41977
42086
|
var PROD_DEPLOY_NAME = "prod-deploy";
|
|
41978
42087
|
var DIFF_OUTPUT_FILE = "cdk-diff.txt";
|
|
@@ -42044,6 +42153,20 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42044
42153
|
target.region
|
|
42045
42154
|
].join("-");
|
|
42046
42155
|
};
|
|
42156
|
+
/**
|
|
42157
|
+
* Build the deterministic GitHub Actions job name for a target's apply job.
|
|
42158
|
+
* Mirrors {@link buildJobName} with an `apply` verb.
|
|
42159
|
+
*/
|
|
42160
|
+
this.buildApplyJobName = (target) => {
|
|
42161
|
+
return [
|
|
42162
|
+
target.awsStageType,
|
|
42163
|
+
target.deploymentTargetRole,
|
|
42164
|
+
"apply",
|
|
42165
|
+
target.project.name,
|
|
42166
|
+
target.account,
|
|
42167
|
+
target.region
|
|
42168
|
+
].join("-");
|
|
42169
|
+
};
|
|
42047
42170
|
/**
|
|
42048
42171
|
* Build the CI artifact name for a target's captured diff.
|
|
42049
42172
|
*
|
|
@@ -42062,6 +42185,163 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42062
42185
|
target.region
|
|
42063
42186
|
].join("-");
|
|
42064
42187
|
};
|
|
42188
|
+
/**
|
|
42189
|
+
* Create the dispatch-only apply workflow and its validation job.
|
|
42190
|
+
*
|
|
42191
|
+
* The workflow file name defaults to the plan workflow's name suffixed with
|
|
42192
|
+
* `-apply`. A name already in use throws rather than silently colliding on
|
|
42193
|
+
* the underlying `.github/workflows/<name>.yml` file — the usual cause is two
|
|
42194
|
+
* `AwsDeployWorkflow`s sharing one build workflow, and the fix is an explicit
|
|
42195
|
+
* `planApply.applyWorkflowName`.
|
|
42196
|
+
*/
|
|
42197
|
+
this.createApplyWorkflow = (github, homeRepositoryCondition) => {
|
|
42198
|
+
const { applyWorkflowName, requireCurrentHead, verifyArtifactDigest } = this.planApplyOptions;
|
|
42199
|
+
if (github.tryFindWorkflow(applyWorkflowName)) {
|
|
42200
|
+
throw new Error(
|
|
42201
|
+
`AwsDeployWorkflow cannot create the apply workflow "${applyWorkflowName}" because a workflow with that name already exists. Set \`planApply.applyWorkflowName\` to something unique.`
|
|
42202
|
+
);
|
|
42203
|
+
}
|
|
42204
|
+
const workflow = new GithubWorkflow(github, applyWorkflowName);
|
|
42205
|
+
workflow.on({
|
|
42206
|
+
workflowDispatch: {
|
|
42207
|
+
inputs: {
|
|
42208
|
+
[PLAN_RUN_ID_INPUT]: {
|
|
42209
|
+
description: "Run id of the plan workflow run to apply. Its build artifact is deployed verbatim.",
|
|
42210
|
+
required: true,
|
|
42211
|
+
type: "string"
|
|
42212
|
+
}
|
|
42213
|
+
}
|
|
42214
|
+
}
|
|
42215
|
+
});
|
|
42216
|
+
const allowedBranches = Array.from(
|
|
42217
|
+
new Set(
|
|
42218
|
+
this.awsDeploymentTargets.flatMap(
|
|
42219
|
+
(target) => target.branches.map((b) => b.branch)
|
|
42220
|
+
)
|
|
42221
|
+
)
|
|
42222
|
+
);
|
|
42223
|
+
workflow.addJob(VALIDATE_PLAN_JOB_ID, {
|
|
42224
|
+
name: "Validate plan run",
|
|
42225
|
+
runsOn: ["ubuntu-latest"],
|
|
42226
|
+
permissions: {
|
|
42227
|
+
actions: JobPermission5.READ,
|
|
42228
|
+
contents: JobPermission5.READ
|
|
42229
|
+
},
|
|
42230
|
+
...homeRepositoryCondition ? { if: `\${{ ${homeRepositoryCondition} }}` } : {},
|
|
42231
|
+
outputs: {
|
|
42232
|
+
head_sha: { stepId: "validate_plan_run", outputName: "head_sha" },
|
|
42233
|
+
head_branch: { stepId: "validate_plan_run", outputName: "head_branch" },
|
|
42234
|
+
...verifyArtifactDigest ? {
|
|
42235
|
+
artifact_digest: {
|
|
42236
|
+
stepId: "validate_plan_run",
|
|
42237
|
+
outputName: "artifact_digest"
|
|
42238
|
+
}
|
|
42239
|
+
} : {}
|
|
42240
|
+
},
|
|
42241
|
+
steps: [
|
|
42242
|
+
{
|
|
42243
|
+
name: "Validate plan run",
|
|
42244
|
+
id: "validate_plan_run",
|
|
42245
|
+
uses: "actions/github-script@v9",
|
|
42246
|
+
/**
|
|
42247
|
+
* The dispatch input reaches the script through the environment
|
|
42248
|
+
* rather than a `${{ }}` interpolation, so a crafted run id cannot
|
|
42249
|
+
* inject JavaScript into the validation itself.
|
|
42250
|
+
*/
|
|
42251
|
+
env: {
|
|
42252
|
+
PLAN_RUN_ID: `\${{ inputs.${PLAN_RUN_ID_INPUT} }}`
|
|
42253
|
+
},
|
|
42254
|
+
with: {
|
|
42255
|
+
script: renderPlanValidationScript({
|
|
42256
|
+
planWorkflowPath: `.github/workflows/${this.buildWorkflow.name}.yml`,
|
|
42257
|
+
allowedBranches,
|
|
42258
|
+
requireCurrentHead,
|
|
42259
|
+
verifyArtifactDigest
|
|
42260
|
+
})
|
|
42261
|
+
}
|
|
42262
|
+
}
|
|
42263
|
+
]
|
|
42264
|
+
});
|
|
42265
|
+
return workflow;
|
|
42266
|
+
};
|
|
42267
|
+
/**
|
|
42268
|
+
* Register one target's apply job on the apply workflow.
|
|
42269
|
+
*
|
|
42270
|
+
* Differences from the `single`-gate deploy job, all of them forced by the
|
|
42271
|
+
* apply run having no build job of its own:
|
|
42272
|
+
*
|
|
42273
|
+
* - `needs` starts at the validation job rather than `build`, so a plan run
|
|
42274
|
+
* that fails any check skips every apply job instead of deploying.
|
|
42275
|
+
* - `actions: read` is added, which is what lets `actions/download-artifact`
|
|
42276
|
+
* reach across runs.
|
|
42277
|
+
* - No `pull-requests: write`, and no sticky PR comment step: an apply is
|
|
42278
|
+
* always a `workflow_dispatch`, so the comment could never fire.
|
|
42279
|
+
* - No branch filter on `github.ref`. The ref an operator happens to
|
|
42280
|
+
* dispatch from is unrelated to what was planned; the branch that matters
|
|
42281
|
+
* is the plan run's, and the validation job checks that one.
|
|
42282
|
+
*
|
|
42283
|
+
* When `environmentName` is also supplied, it lands here rather than on the
|
|
42284
|
+
* plan's jobs — a second approver on top of whoever dispatched the apply.
|
|
42285
|
+
* `validate-plan` stays ungated so its verdict is available to read *before*
|
|
42286
|
+
* the approval is given.
|
|
42287
|
+
*/
|
|
42288
|
+
this.addApplyJob = (workflow, target, homeRepositoryCondition) => {
|
|
42289
|
+
const applyJobName = this.buildApplyJobName(target);
|
|
42290
|
+
const { verifyArtifactDigest } = this.planApplyOptions;
|
|
42291
|
+
const artifactsDirectory = this.rootProject.artifactsDirectory;
|
|
42292
|
+
workflow.addJob(applyJobName, {
|
|
42293
|
+
name: `Apply ${this.project.name} ${target.awsStageType}/${target.deploymentTargetRole}/${target.account}/${target.region}`,
|
|
42294
|
+
needs: [
|
|
42295
|
+
VALIDATE_PLAN_JOB_ID,
|
|
42296
|
+
...this.deployAfterTargets.map((p) => this.buildApplyJobName(p))
|
|
42297
|
+
],
|
|
42298
|
+
runsOn: ["ubuntu-latest"],
|
|
42299
|
+
permissions: {
|
|
42300
|
+
actions: JobPermission5.READ,
|
|
42301
|
+
contents: JobPermission5.READ,
|
|
42302
|
+
idToken: JobPermission5.WRITE
|
|
42303
|
+
},
|
|
42304
|
+
...this.environmentName ? { environment: this.environmentName } : void 0,
|
|
42305
|
+
/**
|
|
42306
|
+
* Shares the deploy job's group name so an apply can never overlap a
|
|
42307
|
+
* same-target deploy. `cancel-in-progress` is spelled out rather than
|
|
42308
|
+
* left to GitHub's default: cancelling a half-finished `cdk deploy`
|
|
42309
|
+
* strands a CloudFormation stack mid-update.
|
|
42310
|
+
*/
|
|
42311
|
+
concurrency: {
|
|
42312
|
+
group: this.buildJobName(target),
|
|
42313
|
+
"cancel-in-progress": false
|
|
42314
|
+
},
|
|
42315
|
+
...homeRepositoryCondition ? { if: `\${{ ${homeRepositoryCondition} }}` } : {},
|
|
42316
|
+
steps: [
|
|
42317
|
+
/**
|
|
42318
|
+
* Cross-run download of the plan's assembly. `run-id` plus an explicit
|
|
42319
|
+
* `github-token` is what makes `actions/download-artifact` look outside
|
|
42320
|
+
* the current run; without both it silently searches this run and finds
|
|
42321
|
+
* nothing.
|
|
42322
|
+
*/
|
|
42323
|
+
{
|
|
42324
|
+
name: "Download plan build artifacts",
|
|
42325
|
+
uses: "actions/download-artifact@v8",
|
|
42326
|
+
with: {
|
|
42327
|
+
name: BUILD_ARTIFACT_NAME,
|
|
42328
|
+
path: artifactsDirectory,
|
|
42329
|
+
"run-id": `\${{ inputs.${PLAN_RUN_ID_INPUT} }}`,
|
|
42330
|
+
"github-token": "${{ secrets.GITHUB_TOKEN }}",
|
|
42331
|
+
...verifyArtifactDigest ? {
|
|
42332
|
+
"artifact-digest": `\${{ needs.${VALIDATE_PLAN_JOB_ID}.outputs.artifact_digest }}`
|
|
42333
|
+
} : {}
|
|
42334
|
+
}
|
|
42335
|
+
},
|
|
42336
|
+
{
|
|
42337
|
+
name: "Restore build artifact permissions",
|
|
42338
|
+
continueOnError: true,
|
|
42339
|
+
run: `cd ${artifactsDirectory} && setfacl --restore=${PERMISSION_BACKUP_FILE}`
|
|
42340
|
+
},
|
|
42341
|
+
...this.deploySteps(target, { stickyPrComment: false })
|
|
42342
|
+
]
|
|
42343
|
+
});
|
|
42344
|
+
};
|
|
42065
42345
|
/**
|
|
42066
42346
|
* Builds a GitHub Actions condition string that checks if the current branch
|
|
42067
42347
|
* matches any of the provided branch patterns.
|
|
@@ -42090,7 +42370,15 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42090
42370
|
}
|
|
42091
42371
|
return conditions.join(" || ");
|
|
42092
42372
|
};
|
|
42093
|
-
|
|
42373
|
+
/**
|
|
42374
|
+
* Steps for a target's deploy job.
|
|
42375
|
+
*
|
|
42376
|
+
* `stickyPrComment` drops the sticky-PR-comment step when false. Apply jobs
|
|
42377
|
+
* pass false: they only ever run on `workflow_dispatch` and so could never
|
|
42378
|
+
* satisfy that step's own `pull_request` guard.
|
|
42379
|
+
*/
|
|
42380
|
+
this.deploySteps = (target, options = {}) => {
|
|
42381
|
+
const { stickyPrComment = true } = options;
|
|
42094
42382
|
const {
|
|
42095
42383
|
awsStageType,
|
|
42096
42384
|
deploymentTargetRole,
|
|
@@ -42169,15 +42457,17 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42169
42457
|
* comment is keyed by the deploy job name so dev/stage/prod comments
|
|
42170
42458
|
* don't collide on the same PR.
|
|
42171
42459
|
*/
|
|
42172
|
-
|
|
42173
|
-
|
|
42174
|
-
|
|
42175
|
-
|
|
42176
|
-
|
|
42177
|
-
|
|
42178
|
-
|
|
42460
|
+
...stickyPrComment ? [
|
|
42461
|
+
{
|
|
42462
|
+
name: "Sticky PR comment with deploy endpoints",
|
|
42463
|
+
if: "github.event_name == 'pull_request' && hashFiles('deploy-urls.md') != ''",
|
|
42464
|
+
uses: "marocchino/sticky-pull-request-comment@v3",
|
|
42465
|
+
with: {
|
|
42466
|
+
header: deployJobName,
|
|
42467
|
+
path: "deploy-urls.md"
|
|
42468
|
+
}
|
|
42179
42469
|
}
|
|
42180
|
-
|
|
42470
|
+
] : []
|
|
42181
42471
|
];
|
|
42182
42472
|
};
|
|
42183
42473
|
/**
|
|
@@ -42321,8 +42611,15 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42321
42611
|
(target) => target.awsStageType === this.awsStageType && target.ciDeployment
|
|
42322
42612
|
) ?? [];
|
|
42323
42613
|
this.deployAfterTargets = options.deployAfterTargets ?? [];
|
|
42614
|
+
this.gate = options.gate;
|
|
42615
|
+
const isPlanApply = this.gate === DEPLOY_GATE.PLAN_APPLY;
|
|
42616
|
+
if (isPlanApply && options.diff?.enabled === false) {
|
|
42617
|
+
throw new Error(
|
|
42618
|
+
"AwsDeployWorkflow cannot disable `diff` under the `plan-apply` gate: the diff jobs are what keep the plan workflow publishing the build artifact the apply workflow deploys."
|
|
42619
|
+
);
|
|
42620
|
+
}
|
|
42324
42621
|
this.diffOptions = {
|
|
42325
|
-
enabled: options.diff?.enabled ??
|
|
42622
|
+
enabled: options.diff?.enabled ?? isPlanApply,
|
|
42326
42623
|
artifact: options.diff?.artifact ?? true,
|
|
42327
42624
|
summary: options.diff?.summary ?? true
|
|
42328
42625
|
};
|
|
@@ -42408,6 +42705,17 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42408
42705
|
...buildWorkflowOptions?.preBuildSteps ?? []
|
|
42409
42706
|
]
|
|
42410
42707
|
});
|
|
42708
|
+
this.planApplyOptions = {
|
|
42709
|
+
applyWorkflowName: options.planApply?.applyWorkflowName ?? `${this.buildWorkflow.name}-apply`,
|
|
42710
|
+
requireCurrentHead: options.planApply?.requireCurrentHead ?? false,
|
|
42711
|
+
verifyArtifactDigest: options.planApply?.verifyArtifactDigest ?? false
|
|
42712
|
+
};
|
|
42713
|
+
if (isPlanApply) {
|
|
42714
|
+
this.applyWorkflow = this.createApplyWorkflow(
|
|
42715
|
+
github,
|
|
42716
|
+
homeRepositoryCondition
|
|
42717
|
+
);
|
|
42718
|
+
}
|
|
42411
42719
|
this.awsDeploymentTargets.forEach((target) => {
|
|
42412
42720
|
const deployJobName = this.buildJobName(target);
|
|
42413
42721
|
const branchFilterCondition = this.buildBranchFilterCondition(
|
|
@@ -42418,27 +42726,31 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42418
42726
|
...homeRepositoryCondition ? [homeRepositoryCondition] : [],
|
|
42419
42727
|
...branchFilterCondition ? [`(${branchFilterCondition})`] : []
|
|
42420
42728
|
].join(" && ") + " }}";
|
|
42421
|
-
|
|
42422
|
-
|
|
42423
|
-
|
|
42424
|
-
|
|
42425
|
-
|
|
42426
|
-
|
|
42427
|
-
|
|
42428
|
-
|
|
42429
|
-
|
|
42430
|
-
|
|
42431
|
-
|
|
42432
|
-
|
|
42433
|
-
|
|
42434
|
-
|
|
42435
|
-
|
|
42436
|
-
|
|
42437
|
-
|
|
42438
|
-
|
|
42439
|
-
|
|
42440
|
-
|
|
42441
|
-
|
|
42729
|
+
if (this.applyWorkflow) {
|
|
42730
|
+
this.addApplyJob(this.applyWorkflow, target, homeRepositoryCondition);
|
|
42731
|
+
} else {
|
|
42732
|
+
const gatedOnDiff = !!this.environmentName && this.diffOptions.enabled;
|
|
42733
|
+
this.buildWorkflow.addPostBuildJob(deployJobName, {
|
|
42734
|
+
name: `Deploy ${this.project.name} ${target.awsStageType}/${target.deploymentTargetRole}/${target.account}/${target.region}`,
|
|
42735
|
+
needs: [
|
|
42736
|
+
"build",
|
|
42737
|
+
...gatedOnDiff ? [this.buildDiffJobName(target)] : [],
|
|
42738
|
+
...this.deployAfterTargets.map((p) => {
|
|
42739
|
+
return this.buildJobName(p);
|
|
42740
|
+
})
|
|
42741
|
+
],
|
|
42742
|
+
runsOn: ["ubuntu-latest"],
|
|
42743
|
+
permissions: {
|
|
42744
|
+
contents: JobPermission5.READ,
|
|
42745
|
+
idToken: JobPermission5.WRITE,
|
|
42746
|
+
pullRequests: JobPermission5.WRITE
|
|
42747
|
+
},
|
|
42748
|
+
...this.environmentName ? { environment: this.environmentName } : void 0,
|
|
42749
|
+
concurrency: deployJobName,
|
|
42750
|
+
if: jobCondition,
|
|
42751
|
+
steps: [...this.deploySteps(target)]
|
|
42752
|
+
});
|
|
42753
|
+
}
|
|
42442
42754
|
if (this.diffOptions.enabled) {
|
|
42443
42755
|
const diffJobName = this.buildDiffJobName(target);
|
|
42444
42756
|
this.buildWorkflow.addPostBuildJob(diffJobName, {
|
|
@@ -42484,7 +42796,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42484
42796
|
|
|
42485
42797
|
// src/workflows/aws-teardown-workflow.ts
|
|
42486
42798
|
import { Component as Component23 } from "projen";
|
|
42487
|
-
import { GitHub as GitHub6, GithubWorkflow } from "projen/lib/github";
|
|
42799
|
+
import { GitHub as GitHub6, GithubWorkflow as GithubWorkflow2 } from "projen/lib/github";
|
|
42488
42800
|
import { JobPermission as JobPermission6 } from "projen/lib/github/workflows-model";
|
|
42489
42801
|
var DEFAULT_TEARDOWN_BRANCH_PATTERNS = [
|
|
42490
42802
|
"feat/*",
|
|
@@ -42549,7 +42861,7 @@ var AwsTeardownWorkflow = class extends Component23 {
|
|
|
42549
42861
|
homeRepository,
|
|
42550
42862
|
"AwsTeardownWorkflow"
|
|
42551
42863
|
);
|
|
42552
|
-
const workflow = new
|
|
42864
|
+
const workflow = new GithubWorkflow2(github, "teardown-dev");
|
|
42553
42865
|
workflow.on({
|
|
42554
42866
|
workflowDispatch: {},
|
|
42555
42867
|
schedule: [
|
|
@@ -43347,6 +43659,7 @@ export {
|
|
|
43347
43659
|
AwsDeploymentConfig,
|
|
43348
43660
|
AwsDeploymentTarget,
|
|
43349
43661
|
AwsTeardownWorkflow,
|
|
43662
|
+
BUILD_ARTIFACT_NAME,
|
|
43350
43663
|
BUILT_IN_BUNDLES,
|
|
43351
43664
|
BUNDLE_OWNERSHIP,
|
|
43352
43665
|
CDK_BOOTSTRAP_DEFAULTS_BY_STAGE,
|
|
@@ -43445,7 +43758,9 @@ export {
|
|
|
43445
43758
|
MONOREPO_LAYOUT,
|
|
43446
43759
|
MonorepoProject,
|
|
43447
43760
|
Nvmrc,
|
|
43761
|
+
PERMISSION_BACKUP_FILE,
|
|
43448
43762
|
PHASE_LABEL_TYPE_MAP,
|
|
43763
|
+
PLAN_RUN_ID_INPUT,
|
|
43449
43764
|
PROD_DEPLOY_NAME,
|
|
43450
43765
|
PROGRESS_FILES_FORMAT_VALUES,
|
|
43451
43766
|
PnpmWorkspace,
|
|
@@ -43479,6 +43794,7 @@ export {
|
|
|
43479
43794
|
TypeScriptConfig,
|
|
43480
43795
|
TypeScriptProject,
|
|
43481
43796
|
UNKNOWN_TYPE_FALLBACK_TIER,
|
|
43797
|
+
VALIDATE_PLAN_JOB_ID,
|
|
43482
43798
|
VALID_PRIORITY_VALUES,
|
|
43483
43799
|
VALID_STATUS_VALUES,
|
|
43484
43800
|
VERSION,
|
|
@@ -43623,6 +43939,7 @@ export {
|
|
|
43623
43939
|
renderNextRequirementIdProcedure,
|
|
43624
43940
|
renderPhaseTypeInvariantSection,
|
|
43625
43941
|
renderPhaseTypeInvariantShellHelpers,
|
|
43942
|
+
renderPlanValidationScript,
|
|
43626
43943
|
renderPriorityRulesSection,
|
|
43627
43944
|
renderProgressFileName,
|
|
43628
43945
|
renderProgressFilePath,
|