@codedrifters/configulator 0.0.428 → 0.0.429
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 +194 -11
- package/lib/index.d.ts +195 -12
- package/lib/index.js +324 -164
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +305 -147
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -41927,61 +41927,15 @@ import { merge as merge4 } from "ts-deepmerge";
|
|
|
41927
41927
|
|
|
41928
41928
|
// src/workflows/aws-deploy-workflow.ts
|
|
41929
41929
|
var import_utils11 = __toESM(require_lib());
|
|
41930
|
-
import { Component as
|
|
41930
|
+
import { Component as Component24 } from "projen";
|
|
41931
41931
|
import { BuildWorkflow } from "projen/lib/build";
|
|
41932
|
-
import { GitHub as
|
|
41933
|
-
import { JobPermission as
|
|
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
|
-
* 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"
|
|
41953
|
-
};
|
|
41954
|
-
var resolveEnvironmentGate = (gate, environmentName, componentName) => {
|
|
41955
|
-
const trimmed = environmentName?.trim();
|
|
41956
|
-
if (gate === void 0) {
|
|
41957
|
-
if (trimmed) {
|
|
41958
|
-
throw new Error(
|
|
41959
|
-
`${componentName} requires \`gate\` to be set when \`environmentName\` is supplied, got "${environmentName}" with no gate`
|
|
41960
|
-
);
|
|
41961
|
-
}
|
|
41962
|
-
return void 0;
|
|
41963
|
-
}
|
|
41964
|
-
if (gate === DEPLOY_GATE.ENVIRONMENT && !trimmed) {
|
|
41965
|
-
throw new Error(
|
|
41966
|
-
`${componentName} requires a non-empty \`environmentName\` when \`gate\` is "${gate}"`
|
|
41967
|
-
);
|
|
41968
|
-
}
|
|
41969
|
-
return trimmed;
|
|
41970
|
-
};
|
|
41932
|
+
import { GitHub as GitHub6, WorkflowSteps as WorkflowSteps2 } from "projen/lib/github";
|
|
41933
|
+
import { JobPermission as JobPermission6 } from "projen/lib/github/workflows-model";
|
|
41971
41934
|
|
|
41972
|
-
// src/workflows/
|
|
41973
|
-
|
|
41974
|
-
|
|
41975
|
-
|
|
41976
|
-
return void 0;
|
|
41977
|
-
}
|
|
41978
|
-
if (!HOME_REPOSITORY_PATTERN.test(homeRepository)) {
|
|
41979
|
-
throw new Error(
|
|
41980
|
-
`${componentName} requires \`homeRepository\` to be an \`owner/repo\` slug, got "${homeRepository}"`
|
|
41981
|
-
);
|
|
41982
|
-
}
|
|
41983
|
-
return `github.repository == '${homeRepository}'`;
|
|
41984
|
-
};
|
|
41935
|
+
// src/workflows/apply-workflow.ts
|
|
41936
|
+
import { Component as Component22 } from "projen";
|
|
41937
|
+
import { GithubWorkflow } from "projen/lib/github";
|
|
41938
|
+
import { JobPermission as JobPermission5 } from "projen/lib/github/workflows-model";
|
|
41985
41939
|
|
|
41986
41940
|
// src/workflows/plan-apply.ts
|
|
41987
41941
|
var VALIDATE_PLAN_JOB_ID = "validate-plan";
|
|
@@ -42082,11 +42036,244 @@ var renderPlanValidationScript = (options) => {
|
|
|
42082
42036
|
].join("\n");
|
|
42083
42037
|
};
|
|
42084
42038
|
|
|
42039
|
+
// src/workflows/apply-workflow.ts
|
|
42040
|
+
var ApplyWorkflow = class _ApplyWorkflow extends Component22 {
|
|
42041
|
+
constructor(project, github, options) {
|
|
42042
|
+
super(project);
|
|
42043
|
+
/**
|
|
42044
|
+
* Every attached component's targets, in attach order. Held as targets rather
|
|
42045
|
+
* than branches because `AwsDeploymentTarget.branches` is mutable — the
|
|
42046
|
+
* branch union is read at `preSynthesize`, once every component has attached.
|
|
42047
|
+
*/
|
|
42048
|
+
this.attachedTargets = [];
|
|
42049
|
+
/**
|
|
42050
|
+
* Attach another component's apply jobs to this workflow.
|
|
42051
|
+
*
|
|
42052
|
+
* Every setting the shared `validate-plan` job bakes in must match what the
|
|
42053
|
+
* workflow was created with — there is one validation job for the whole file,
|
|
42054
|
+
* so a disagreement cannot be honoured and is rejected rather than resolved
|
|
42055
|
+
* in favour of whichever component happened to be constructed first.
|
|
42056
|
+
*/
|
|
42057
|
+
this.attach = (options) => {
|
|
42058
|
+
const { componentName } = options;
|
|
42059
|
+
const name = this.workflow.name;
|
|
42060
|
+
if (options.planWorkflowName !== this.contract.planWorkflowName) {
|
|
42061
|
+
throw new Error(
|
|
42062
|
+
`${componentName} cannot attach to the apply workflow "${name}": it plans from build workflow "${options.planWorkflowName}", but that apply workflow only accepts runs of "${this.contract.planWorkflowName}". Every component sharing an apply workflow must share one build workflow.`
|
|
42063
|
+
);
|
|
42064
|
+
}
|
|
42065
|
+
this.requireAgreement(
|
|
42066
|
+
componentName,
|
|
42067
|
+
"requireCurrentHead",
|
|
42068
|
+
options.requireCurrentHead,
|
|
42069
|
+
this.contract.requireCurrentHead
|
|
42070
|
+
);
|
|
42071
|
+
this.requireAgreement(
|
|
42072
|
+
componentName,
|
|
42073
|
+
"verifyArtifactDigest",
|
|
42074
|
+
options.verifyArtifactDigest,
|
|
42075
|
+
this.contract.verifyArtifactDigest
|
|
42076
|
+
);
|
|
42077
|
+
this.attachedTargets.push(...options.awsDeploymentTargets);
|
|
42078
|
+
};
|
|
42079
|
+
/**
|
|
42080
|
+
* Reject a boolean `planApply` setting that differs from the one this
|
|
42081
|
+
* workflow was created with.
|
|
42082
|
+
*/
|
|
42083
|
+
this.requireAgreement = (componentName, option, supplied, expected) => {
|
|
42084
|
+
if (supplied === expected) {
|
|
42085
|
+
return;
|
|
42086
|
+
}
|
|
42087
|
+
throw new Error(
|
|
42088
|
+
`${componentName} cannot attach to the apply workflow "${this.workflow.name}": \`planApply.${option}\` is ${supplied} here and ${expected} on the components already attached. The setting is baked into the one shared \`${VALIDATE_PLAN_JOB_ID}\` job, so every component sharing an apply workflow must agree on it.`
|
|
42089
|
+
);
|
|
42090
|
+
};
|
|
42091
|
+
/**
|
|
42092
|
+
* Render the validation job every apply job depends on.
|
|
42093
|
+
*
|
|
42094
|
+
* `allowedBranches` is the union of every attached target's branches, deduped
|
|
42095
|
+
* and left in attach order. The apply run's own `github.ref` says nothing
|
|
42096
|
+
* about what was planned, so the list is checked against the *plan run's*
|
|
42097
|
+
* `head_branch` rather than against a workflow-level branch filter.
|
|
42098
|
+
*/
|
|
42099
|
+
this.renderValidateJob = () => {
|
|
42100
|
+
const { planWorkflowName, requireCurrentHead, verifyArtifactDigest } = this.contract;
|
|
42101
|
+
const allowedBranches = Array.from(
|
|
42102
|
+
new Set(
|
|
42103
|
+
this.attachedTargets.flatMap(
|
|
42104
|
+
(target) => target.branches.map((b) => b.branch)
|
|
42105
|
+
)
|
|
42106
|
+
)
|
|
42107
|
+
);
|
|
42108
|
+
return {
|
|
42109
|
+
name: "Validate plan run",
|
|
42110
|
+
runsOn: ["ubuntu-latest"],
|
|
42111
|
+
permissions: {
|
|
42112
|
+
actions: JobPermission5.READ,
|
|
42113
|
+
contents: JobPermission5.READ
|
|
42114
|
+
},
|
|
42115
|
+
...this.homeRepositoryCondition ? { if: `\${{ ${this.homeRepositoryCondition} }}` } : {},
|
|
42116
|
+
outputs: {
|
|
42117
|
+
head_sha: { stepId: "validate_plan_run", outputName: "head_sha" },
|
|
42118
|
+
head_branch: { stepId: "validate_plan_run", outputName: "head_branch" },
|
|
42119
|
+
...verifyArtifactDigest ? {
|
|
42120
|
+
artifact_digest: {
|
|
42121
|
+
stepId: "validate_plan_run",
|
|
42122
|
+
outputName: "artifact_digest"
|
|
42123
|
+
}
|
|
42124
|
+
} : {}
|
|
42125
|
+
},
|
|
42126
|
+
steps: [
|
|
42127
|
+
{
|
|
42128
|
+
name: "Validate plan run",
|
|
42129
|
+
id: "validate_plan_run",
|
|
42130
|
+
uses: "actions/github-script@v9",
|
|
42131
|
+
/**
|
|
42132
|
+
* The dispatch input reaches the script through the environment
|
|
42133
|
+
* rather than a `${{ }}` interpolation, so a crafted run id cannot
|
|
42134
|
+
* inject JavaScript into the validation itself.
|
|
42135
|
+
*/
|
|
42136
|
+
env: {
|
|
42137
|
+
PLAN_RUN_ID: `\${{ inputs.${PLAN_RUN_ID_INPUT} }}`
|
|
42138
|
+
},
|
|
42139
|
+
with: {
|
|
42140
|
+
script: renderPlanValidationScript({
|
|
42141
|
+
planWorkflowPath: `.github/workflows/${planWorkflowName}.yml`,
|
|
42142
|
+
allowedBranches,
|
|
42143
|
+
requireCurrentHead,
|
|
42144
|
+
verifyArtifactDigest
|
|
42145
|
+
})
|
|
42146
|
+
}
|
|
42147
|
+
}
|
|
42148
|
+
]
|
|
42149
|
+
};
|
|
42150
|
+
};
|
|
42151
|
+
const { applyWorkflowName } = options;
|
|
42152
|
+
if (github.tryFindWorkflow(applyWorkflowName)) {
|
|
42153
|
+
throw new Error(
|
|
42154
|
+
`${options.componentName} cannot create the apply workflow "${applyWorkflowName}" because a workflow with that name already exists. Set \`planApply.applyWorkflow\` to share the existing one, or \`planApply.applyWorkflowName\` to something unique.`
|
|
42155
|
+
);
|
|
42156
|
+
}
|
|
42157
|
+
this.contract = {
|
|
42158
|
+
planWorkflowName: options.planWorkflowName,
|
|
42159
|
+
requireCurrentHead: options.requireCurrentHead,
|
|
42160
|
+
verifyArtifactDigest: options.verifyArtifactDigest
|
|
42161
|
+
};
|
|
42162
|
+
this.homeRepositoryCondition = options.homeRepositoryCondition;
|
|
42163
|
+
this.attachedTargets.push(...options.awsDeploymentTargets);
|
|
42164
|
+
this.workflow = new GithubWorkflow(github, applyWorkflowName);
|
|
42165
|
+
this.workflow.on({
|
|
42166
|
+
workflowDispatch: {
|
|
42167
|
+
inputs: {
|
|
42168
|
+
[PLAN_RUN_ID_INPUT]: {
|
|
42169
|
+
description: "Run id of the plan workflow run to apply. Its build artifact is deployed verbatim.",
|
|
42170
|
+
required: true,
|
|
42171
|
+
type: "string"
|
|
42172
|
+
}
|
|
42173
|
+
}
|
|
42174
|
+
}
|
|
42175
|
+
});
|
|
42176
|
+
this.workflow.addJob(VALIDATE_PLAN_JOB_ID, this.renderValidateJob());
|
|
42177
|
+
}
|
|
42178
|
+
static of(project, workflow) {
|
|
42179
|
+
const isDefined = (c) => c instanceof _ApplyWorkflow && c.workflow === workflow;
|
|
42180
|
+
return project.components.find(isDefined);
|
|
42181
|
+
}
|
|
42182
|
+
preSynthesize() {
|
|
42183
|
+
this.workflow.updateJob(VALIDATE_PLAN_JOB_ID, this.renderValidateJob());
|
|
42184
|
+
super.preSynthesize();
|
|
42185
|
+
}
|
|
42186
|
+
};
|
|
42187
|
+
|
|
42188
|
+
// src/workflows/deploy-gate.ts
|
|
42189
|
+
var DEPLOY_GATE = {
|
|
42190
|
+
/**
|
|
42191
|
+
* Hold each deploy job behind a GitHub environment so its protection rules —
|
|
42192
|
+
* required reviewers, wait timers, deployment branch policies — apply before
|
|
42193
|
+
* the job is sent to a runner.
|
|
42194
|
+
*/
|
|
42195
|
+
ENVIRONMENT: "environment",
|
|
42196
|
+
/**
|
|
42197
|
+
* Split the workflow in two. A **plan** workflow builds and diffs but never
|
|
42198
|
+
* deploys; a dispatch-only **apply** workflow deploys the exact cloud
|
|
42199
|
+
* assembly a nominated plan run produced.
|
|
42200
|
+
*
|
|
42201
|
+
* Needs no protection rule, so unlike {@link DEPLOY_GATE.ENVIRONMENT} it
|
|
42202
|
+
* works on every GitHub plan. `environmentName` is optional here and layers
|
|
42203
|
+
* an environment onto the apply jobs.
|
|
42204
|
+
*/
|
|
42205
|
+
PLAN_APPLY: "plan-apply"
|
|
42206
|
+
};
|
|
42207
|
+
var resolveEnvironmentGate = (gate, environmentName, componentName) => {
|
|
42208
|
+
const trimmed = environmentName?.trim();
|
|
42209
|
+
if (gate === void 0) {
|
|
42210
|
+
if (trimmed) {
|
|
42211
|
+
throw new Error(
|
|
42212
|
+
`${componentName} requires \`gate\` to be set when \`environmentName\` is supplied, got "${environmentName}" with no gate`
|
|
42213
|
+
);
|
|
42214
|
+
}
|
|
42215
|
+
return void 0;
|
|
42216
|
+
}
|
|
42217
|
+
if (gate === DEPLOY_GATE.ENVIRONMENT && !trimmed) {
|
|
42218
|
+
throw new Error(
|
|
42219
|
+
`${componentName} requires a non-empty \`environmentName\` when \`gate\` is "${gate}"`
|
|
42220
|
+
);
|
|
42221
|
+
}
|
|
42222
|
+
return trimmed;
|
|
42223
|
+
};
|
|
42224
|
+
|
|
42225
|
+
// src/workflows/home-repository.ts
|
|
42226
|
+
import { Component as Component23 } from "projen";
|
|
42227
|
+
var HOME_REPOSITORY_PATTERN = /^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/;
|
|
42228
|
+
var renderHomeRepositoryCondition = (homeRepository, componentName) => {
|
|
42229
|
+
if (homeRepository === void 0) {
|
|
42230
|
+
return void 0;
|
|
42231
|
+
}
|
|
42232
|
+
if (!HOME_REPOSITORY_PATTERN.test(homeRepository)) {
|
|
42233
|
+
throw new Error(
|
|
42234
|
+
`${componentName} requires \`homeRepository\` to be an \`owner/repo\` slug, got "${homeRepository}"`
|
|
42235
|
+
);
|
|
42236
|
+
}
|
|
42237
|
+
return `github.repository == '${homeRepository}'`;
|
|
42238
|
+
};
|
|
42239
|
+
var describePin = (homeRepository) => homeRepository === void 0 ? "unset" : `"${homeRepository}"`;
|
|
42240
|
+
var WorkflowHomeRepository = class _WorkflowHomeRepository extends Component23 {
|
|
42241
|
+
static of(project, workflow) {
|
|
42242
|
+
const isDefined = (c) => c instanceof _WorkflowHomeRepository && c.workflow === workflow;
|
|
42243
|
+
return project.components.find(isDefined);
|
|
42244
|
+
}
|
|
42245
|
+
/**
|
|
42246
|
+
* Record a pin against a workflow, throwing when it disagrees with what an
|
|
42247
|
+
* earlier component declared for the same one.
|
|
42248
|
+
*
|
|
42249
|
+
* @param project - Project the record is attached to. Use the root project,
|
|
42250
|
+
* so components on sibling sub-projects find each other.
|
|
42251
|
+
*/
|
|
42252
|
+
static require(project, options) {
|
|
42253
|
+
const { workflow, workflowName, homeRepository, componentName } = options;
|
|
42254
|
+
const existing = _WorkflowHomeRepository.of(project, workflow);
|
|
42255
|
+
if (!existing) {
|
|
42256
|
+
return new _WorkflowHomeRepository(project, options);
|
|
42257
|
+
}
|
|
42258
|
+
if (existing.homeRepository !== homeRepository) {
|
|
42259
|
+
throw new Error(
|
|
42260
|
+
`${componentName} requires every component sharing the workflow "${workflowName}" to declare the same \`homeRepository\`, got ${describePin(homeRepository)} here and ${describePin(existing.homeRepository)} already declared. The pin guards every job in one workflow file, so it cannot differ between them.`
|
|
42261
|
+
);
|
|
42262
|
+
}
|
|
42263
|
+
return existing;
|
|
42264
|
+
}
|
|
42265
|
+
constructor(project, options) {
|
|
42266
|
+
super(project);
|
|
42267
|
+
this.workflow = options.workflow;
|
|
42268
|
+
this.homeRepository = options.homeRepository;
|
|
42269
|
+
}
|
|
42270
|
+
};
|
|
42271
|
+
|
|
42085
42272
|
// src/workflows/aws-deploy-workflow.ts
|
|
42086
42273
|
var PROD_DEPLOY_NAME = "prod-deploy";
|
|
42087
42274
|
var DIFF_OUTPUT_FILE = "cdk-diff.txt";
|
|
42088
42275
|
var DIFF_SUMMARY_BYTE_LIMIT = 9e5;
|
|
42089
|
-
var AwsDeployWorkflow = class _AwsDeployWorkflow extends
|
|
42276
|
+
var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component24 {
|
|
42090
42277
|
constructor(project, options = {}) {
|
|
42091
42278
|
super(project);
|
|
42092
42279
|
this.project = project;
|
|
@@ -42186,83 +42373,28 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42186
42373
|
].join("-");
|
|
42187
42374
|
};
|
|
42188
42375
|
/**
|
|
42189
|
-
*
|
|
42376
|
+
* Join an apply workflow another `AwsDeployWorkflow` already created, so this
|
|
42377
|
+
* component's apply jobs land in that file rather than a second one.
|
|
42190
42378
|
*
|
|
42191
|
-
*
|
|
42192
|
-
*
|
|
42193
|
-
*
|
|
42194
|
-
* `AwsDeployWorkflow`s sharing one build workflow, and the fix is an explicit
|
|
42195
|
-
* `planApply.applyWorkflowName`.
|
|
42379
|
+
* Rejects a `GithubWorkflow` that is not an apply workflow: attaching to an
|
|
42380
|
+
* arbitrary one would add apply jobs depending on a `validate-plan` job that
|
|
42381
|
+
* does not exist there, which GitHub rejects only at run time.
|
|
42196
42382
|
*/
|
|
42197
|
-
this.
|
|
42198
|
-
const
|
|
42199
|
-
if (
|
|
42383
|
+
this.attachApplyWorkflow = (workflow) => {
|
|
42384
|
+
const shared = ApplyWorkflow.of(this.rootProject, workflow);
|
|
42385
|
+
if (!shared) {
|
|
42200
42386
|
throw new Error(
|
|
42201
|
-
`AwsDeployWorkflow cannot
|
|
42387
|
+
`AwsDeployWorkflow cannot attach to the workflow "${workflow.name}" because it is not an apply workflow. Pass the \`applyWorkflow\` of an AwsDeployWorkflow built with the \`plan-apply\` gate.`
|
|
42202
42388
|
);
|
|
42203
42389
|
}
|
|
42204
|
-
|
|
42205
|
-
|
|
42206
|
-
|
|
42207
|
-
|
|
42208
|
-
|
|
42209
|
-
|
|
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
|
-
]
|
|
42390
|
+
shared.attach({
|
|
42391
|
+
planWorkflowName: this.buildWorkflow.name,
|
|
42392
|
+
requireCurrentHead: this.planApplyOptions.requireCurrentHead,
|
|
42393
|
+
verifyArtifactDigest: this.planApplyOptions.verifyArtifactDigest,
|
|
42394
|
+
awsDeploymentTargets: this.awsDeploymentTargets,
|
|
42395
|
+
componentName: "AwsDeployWorkflow"
|
|
42264
42396
|
});
|
|
42265
|
-
return
|
|
42397
|
+
return shared;
|
|
42266
42398
|
};
|
|
42267
42399
|
/**
|
|
42268
42400
|
* Register one target's apply job on the apply workflow.
|
|
@@ -42297,9 +42429,9 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42297
42429
|
],
|
|
42298
42430
|
runsOn: ["ubuntu-latest"],
|
|
42299
42431
|
permissions: {
|
|
42300
|
-
actions:
|
|
42301
|
-
contents:
|
|
42302
|
-
idToken:
|
|
42432
|
+
actions: JobPermission6.READ,
|
|
42433
|
+
contents: JobPermission6.READ,
|
|
42434
|
+
idToken: JobPermission6.WRITE
|
|
42303
42435
|
},
|
|
42304
42436
|
...this.environmentName ? { environment: this.environmentName } : void 0,
|
|
42305
42437
|
/**
|
|
@@ -42582,7 +42714,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42582
42714
|
);
|
|
42583
42715
|
}
|
|
42584
42716
|
this.rootProject = project.root;
|
|
42585
|
-
const github =
|
|
42717
|
+
const github = GitHub6.of(this.rootProject);
|
|
42586
42718
|
if (!github) {
|
|
42587
42719
|
throw new Error(
|
|
42588
42720
|
"AwsDeployWorkflow requires a GitHub component in the root project"
|
|
@@ -42689,16 +42821,40 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42689
42821
|
...buildWorkflowOptions?.preBuildSteps ?? []
|
|
42690
42822
|
]
|
|
42691
42823
|
});
|
|
42824
|
+
WorkflowHomeRepository.require(this.rootProject, {
|
|
42825
|
+
workflow: this.buildWorkflow,
|
|
42826
|
+
workflowName: this.buildWorkflow.name,
|
|
42827
|
+
homeRepository: this.homeRepository,
|
|
42828
|
+
componentName: "AwsDeployWorkflow"
|
|
42829
|
+
});
|
|
42830
|
+
const sharedApplyWorkflow = options.planApply?.applyWorkflow;
|
|
42831
|
+
if (sharedApplyWorkflow && options.planApply?.applyWorkflowName) {
|
|
42832
|
+
throw new Error(
|
|
42833
|
+
"Cannot provide both planApply.applyWorkflow and planApply.applyWorkflowName: the workflow being joined already has a name."
|
|
42834
|
+
);
|
|
42835
|
+
}
|
|
42692
42836
|
this.planApplyOptions = {
|
|
42693
|
-
applyWorkflowName: options.planApply?.applyWorkflowName ?? `${this.buildWorkflow.name}-apply`,
|
|
42837
|
+
applyWorkflowName: sharedApplyWorkflow?.name ?? options.planApply?.applyWorkflowName ?? `${this.buildWorkflow.name}-apply`,
|
|
42694
42838
|
requireCurrentHead: options.planApply?.requireCurrentHead ?? false,
|
|
42695
42839
|
verifyArtifactDigest: options.planApply?.verifyArtifactDigest ?? false
|
|
42696
42840
|
};
|
|
42697
42841
|
if (isPlanApply) {
|
|
42698
|
-
|
|
42699
|
-
|
|
42700
|
-
|
|
42701
|
-
|
|
42842
|
+
const applyWorkflow = sharedApplyWorkflow ? this.attachApplyWorkflow(sharedApplyWorkflow) : new ApplyWorkflow(this.rootProject, github, {
|
|
42843
|
+
applyWorkflowName: this.planApplyOptions.applyWorkflowName,
|
|
42844
|
+
planWorkflowName: this.buildWorkflow.name,
|
|
42845
|
+
requireCurrentHead: this.planApplyOptions.requireCurrentHead,
|
|
42846
|
+
verifyArtifactDigest: this.planApplyOptions.verifyArtifactDigest,
|
|
42847
|
+
homeRepositoryCondition,
|
|
42848
|
+
awsDeploymentTargets: this.awsDeploymentTargets,
|
|
42849
|
+
componentName: "AwsDeployWorkflow"
|
|
42850
|
+
});
|
|
42851
|
+
this.applyWorkflow = applyWorkflow.workflow;
|
|
42852
|
+
WorkflowHomeRepository.require(this.rootProject, {
|
|
42853
|
+
workflow: applyWorkflow.workflow,
|
|
42854
|
+
workflowName: this.planApplyOptions.applyWorkflowName,
|
|
42855
|
+
homeRepository: this.homeRepository,
|
|
42856
|
+
componentName: "AwsDeployWorkflow"
|
|
42857
|
+
});
|
|
42702
42858
|
}
|
|
42703
42859
|
this.awsDeploymentTargets.forEach((target) => {
|
|
42704
42860
|
const deployJobName = this.buildJobName(target);
|
|
@@ -42725,9 +42881,9 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42725
42881
|
],
|
|
42726
42882
|
runsOn: ["ubuntu-latest"],
|
|
42727
42883
|
permissions: {
|
|
42728
|
-
contents:
|
|
42729
|
-
idToken:
|
|
42730
|
-
pullRequests:
|
|
42884
|
+
contents: JobPermission6.READ,
|
|
42885
|
+
idToken: JobPermission6.WRITE,
|
|
42886
|
+
pullRequests: JobPermission6.WRITE
|
|
42731
42887
|
},
|
|
42732
42888
|
...this.environmentName ? { environment: this.environmentName } : void 0,
|
|
42733
42889
|
concurrency: deployJobName,
|
|
@@ -42742,8 +42898,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42742
42898
|
needs: ["build"],
|
|
42743
42899
|
runsOn: ["ubuntu-latest"],
|
|
42744
42900
|
permissions: {
|
|
42745
|
-
contents:
|
|
42746
|
-
idToken:
|
|
42901
|
+
contents: JobPermission6.READ,
|
|
42902
|
+
idToken: JobPermission6.WRITE
|
|
42747
42903
|
},
|
|
42748
42904
|
if: jobCondition,
|
|
42749
42905
|
steps: [...this.diffSteps(target)]
|
|
@@ -42779,9 +42935,9 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component22 {
|
|
|
42779
42935
|
};
|
|
42780
42936
|
|
|
42781
42937
|
// src/workflows/aws-teardown-workflow.ts
|
|
42782
|
-
import { Component as
|
|
42783
|
-
import { GitHub as
|
|
42784
|
-
import { JobPermission as
|
|
42938
|
+
import { Component as Component25 } from "projen";
|
|
42939
|
+
import { GitHub as GitHub7, GithubWorkflow as GithubWorkflow3 } from "projen/lib/github";
|
|
42940
|
+
import { JobPermission as JobPermission7 } from "projen/lib/github/workflows-model";
|
|
42785
42941
|
var DEFAULT_TEARDOWN_BRANCH_PATTERNS = [
|
|
42786
42942
|
"feat/*",
|
|
42787
42943
|
"fix/*",
|
|
@@ -42801,7 +42957,7 @@ var resolveBranchPatterns = (explicit, targets) => {
|
|
|
42801
42957
|
}
|
|
42802
42958
|
return [...DEFAULT_TEARDOWN_BRANCH_PATTERNS];
|
|
42803
42959
|
};
|
|
42804
|
-
var AwsTeardownWorkflow = class extends
|
|
42960
|
+
var AwsTeardownWorkflow = class extends Component25 {
|
|
42805
42961
|
constructor(rootProject, options) {
|
|
42806
42962
|
super(rootProject);
|
|
42807
42963
|
this.rootProject = rootProject;
|
|
@@ -42831,7 +42987,7 @@ var AwsTeardownWorkflow = class extends Component23 {
|
|
|
42831
42987
|
"AwsTeardownWorkflow requires the root project to be a MonorepoProject"
|
|
42832
42988
|
);
|
|
42833
42989
|
}
|
|
42834
|
-
const github =
|
|
42990
|
+
const github = GitHub7.of(this.rootProject);
|
|
42835
42991
|
if (!github) {
|
|
42836
42992
|
throw new Error(
|
|
42837
42993
|
"AwsTeardownWorkflow requires a GitHub component in the root project"
|
|
@@ -42845,7 +43001,7 @@ var AwsTeardownWorkflow = class extends Component23 {
|
|
|
42845
43001
|
homeRepository,
|
|
42846
43002
|
"AwsTeardownWorkflow"
|
|
42847
43003
|
);
|
|
42848
|
-
const workflow = new
|
|
43004
|
+
const workflow = new GithubWorkflow3(github, "teardown-dev");
|
|
42849
43005
|
workflow.on({
|
|
42850
43006
|
workflowDispatch: {},
|
|
42851
43007
|
schedule: [
|
|
@@ -42873,8 +43029,8 @@ var AwsTeardownWorkflow = class extends Component23 {
|
|
|
42873
43029
|
runsOn: ["ubuntu-latest"],
|
|
42874
43030
|
...homeRepositoryCondition ? { if: `\${{ ${homeRepositoryCondition} }}` } : {},
|
|
42875
43031
|
permissions: {
|
|
42876
|
-
contents:
|
|
42877
|
-
idToken:
|
|
43032
|
+
contents: JobPermission7.READ,
|
|
43033
|
+
idToken: JobPermission7.WRITE
|
|
42878
43034
|
},
|
|
42879
43035
|
env: {
|
|
42880
43036
|
REPO: "${{ github.repository }}",
|
|
@@ -43638,6 +43794,7 @@ export {
|
|
|
43638
43794
|
AUDIT_CATEGORY_ORDER,
|
|
43639
43795
|
AgentConfig,
|
|
43640
43796
|
ApiExtractor,
|
|
43797
|
+
ApplyWorkflow,
|
|
43641
43798
|
AstroConfig,
|
|
43642
43799
|
AstroOutput,
|
|
43643
43800
|
AstroProject,
|
|
@@ -43792,6 +43949,7 @@ export {
|
|
|
43792
43949
|
VERSION_NPM_PACKAGES,
|
|
43793
43950
|
VSCodeConfig,
|
|
43794
43951
|
Vitest,
|
|
43952
|
+
WorkflowHomeRepository,
|
|
43795
43953
|
addApproveMergeUpgradeWorkflow,
|
|
43796
43954
|
addBuildCompleteJob,
|
|
43797
43955
|
addPlaywright,
|