@catladder/cli 5.6.0 → 5.7.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/apps/cli/src/catci.js +22 -0
- package/dist/apps/cli/src/catci.js.map +1 -1
- package/dist/apps/cli/src/commands/index.d.ts +1 -0
- package/dist/apps/cli/src/commands/index.js +4 -1
- package/dist/apps/cli/src/commands/index.js.map +1 -1
- package/dist/apps/cli/src/commands/project/commandMrPin.d.ts +9 -0
- package/dist/apps/cli/src/commands/project/commandMrPin.js +11 -13
- package/dist/apps/cli/src/commands/project/commandMrPin.js.map +1 -1
- package/dist/apps/cli/src/commands/project/commandMrReviewApp.d.ts +21 -0
- package/dist/apps/cli/src/commands/project/commandMrReviewApp.js +102 -0
- package/dist/apps/cli/src/commands/project/commandMrReviewApp.js.map +1 -0
- package/dist/apps/cli/src/reviewApps/github.d.ts +10 -0
- package/dist/apps/cli/src/reviewApps/github.js +196 -0
- package/dist/apps/cli/src/reviewApps/github.js.map +1 -0
- package/dist/bundles/catci/index.js +4 -4
- package/dist/bundles/catenv/index.js +897 -25
- package/dist/bundles/cli/index.js +1021 -39
- package/dist/bundles/skills/catladder-cli/references/commands.md +13 -0
- package/dist/bundles/skills/catladder-config/SKILL.md +4 -0
- package/dist/bundles/skills/catladder-deploys/SKILL.md +6 -0
- package/dist/bundles/skills/catladder-pipelines/SKILL.md +79 -1
- package/dist/packages/pipeline/src/backends/github/GithubBackend.js +60 -3
- package/dist/packages/pipeline/src/backends/github/GithubBackend.js.map +1 -1
- package/dist/packages/pipeline/src/backends/github/aggregateCheckJob.d.ts +1 -1
- package/dist/packages/pipeline/src/backends/github/aggregateCheckJob.js +22 -8
- package/dist/packages/pipeline/src/backends/github/aggregateCheckJob.js.map +1 -1
- package/dist/packages/pipeline/src/backends/github/reviewDeployWorkflow.d.ts +128 -0
- package/dist/packages/pipeline/src/backends/github/reviewDeployWorkflow.js +510 -0
- package/dist/packages/pipeline/src/backends/github/reviewDeployWorkflow.js.map +1 -0
- package/dist/packages/pipeline/src/backends/gitlab/GitlabBackend.js +29 -4
- package/dist/packages/pipeline/src/backends/gitlab/GitlabBackend.js.map +1 -1
- package/dist/packages/pipeline/src/backends/gitlab/createGitlabPipeline.d.ts +11 -1
- package/dist/packages/pipeline/src/backends/gitlab/createGitlabPipeline.js +17 -5
- package/dist/packages/pipeline/src/backends/gitlab/createGitlabPipeline.js.map +1 -1
- package/dist/packages/pipeline/src/backends/gitlab/reviewDeployGate.d.ts +26 -0
- package/dist/packages/pipeline/src/backends/gitlab/reviewDeployGate.js +94 -0
- package/dist/packages/pipeline/src/backends/gitlab/reviewDeployGate.js.map +1 -0
- package/dist/packages/pipeline/src/deploy/base/deploy.js +10 -3
- package/dist/packages/pipeline/src/deploy/base/deploy.js.map +1 -1
- package/dist/packages/pipeline/src/index.d.ts +1 -0
- package/dist/packages/pipeline/src/index.js +1 -0
- package/dist/packages/pipeline/src/index.js.map +1 -1
- package/dist/packages/pipeline/src/pipeline/resolveRequirements.d.ts +2 -0
- package/dist/packages/pipeline/src/pipeline/resolveRequirements.js +3 -2
- package/dist/packages/pipeline/src/pipeline/resolveRequirements.js.map +1 -1
- package/dist/packages/pipeline/src/reviewApps.d.ts +38 -0
- package/dist/packages/pipeline/src/reviewApps.js +86 -0
- package/dist/packages/pipeline/src/reviewApps.js.map +1 -0
- package/dist/packages/pipeline/src/reviewAppsPolicy.d.ts +46 -0
- package/dist/packages/pipeline/src/reviewAppsPolicy.js +37 -0
- package/dist/packages/pipeline/src/reviewAppsPolicy.js.map +1 -0
- package/dist/packages/pipeline/src/types/config.d.ts +55 -0
- package/dist/packages/pipeline/src/types/config.js.map +1 -1
- package/dist/skills/catladder-cli/references/commands.md +13 -0
- package/dist/skills/catladder-config/SKILL.md +4 -0
- package/dist/skills/catladder-deploys/SKILL.md +6 -0
- package/dist/skills/catladder-pipelines/SKILL.md +79 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/catci.ts +29 -0
- package/src/commands/index.ts +4 -0
- package/src/commands/project/commandMrPin.ts +15 -14
- package/src/commands/project/commandMrReviewApp.ts +143 -0
- package/src/reviewApps/github.ts +253 -0
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withDraftsSkipped = exports.withReviewStopSwitch = exports.makeReviewDeployTriggerJob = exports.makeReviewAppAggregateJob = exports.REVIEW_APP_STATUS_CONTEXT = exports.REVIEW_APP_AGGREGATE_JOB_NAME = exports.REVIEW_APP_AGGREGATE_JOB_ID = exports.makeReviewDeployWorkflow = exports.getGatedReviewDeliveryJobIds = exports.withInRunCondition = exports.getInRunDeployCondition = exports.REVIEW_DEPLOY_WORKFLOW_FILE = void 0;
|
|
4
|
+
const shippedCatci_1 = require("../../catci/shippedCatci");
|
|
5
|
+
const resolveRequirements_1 = require("../../pipeline/resolveRequirements");
|
|
6
|
+
const reviewApps_1 = require("../../reviewApps");
|
|
7
|
+
const aggregateCheckJob_1 = require("./aggregateCheckJob");
|
|
8
|
+
const ensureImageJobs_1 = require("./ensureImageJobs");
|
|
9
|
+
const CATCI = `${shippedCatci_1.GENERATED_CATCI_FOLDER}/index.js`;
|
|
10
|
+
/**
|
|
11
|
+
* the generated review deploy workflow. Keep in sync with
|
|
12
|
+
* GITHUB_REVIEW_DEPLOY_WORKFLOW in apps/cli/src/reviewApps/github.ts.
|
|
13
|
+
*/
|
|
14
|
+
exports.REVIEW_DEPLOY_WORKFLOW_FILE = "catladder-deploy-review.yml";
|
|
15
|
+
const GUARD_JOB_ID = "catladder-review-deploy-guard";
|
|
16
|
+
const TRIGGER_JOB_ID = "catladder-review-deploy-trigger";
|
|
17
|
+
/** the PR of the run — from the event, or the dispatch input */
|
|
18
|
+
const PR_NUMBER_EXPRESSION = "github.event.number || inputs.pr";
|
|
19
|
+
/** quote a value for a github expression string literal */
|
|
20
|
+
const literal = (value) => `'${value.replaceAll("'", "''")}'`;
|
|
21
|
+
/** combine a job's existing `if` with another condition */
|
|
22
|
+
const andIf = (existing, condition) => {
|
|
23
|
+
if (!existing) {
|
|
24
|
+
return `\${{ ${condition} }}`;
|
|
25
|
+
}
|
|
26
|
+
const unwrapped = existing.replace(/^\$\{\{\s*([\s\S]*?)\s*\}\}$/, "$1");
|
|
27
|
+
return `\${{ (${unwrapped}) && (${condition}) }}`;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* the condition under which the review workflow deploys the review apps
|
|
31
|
+
* ITSELF, decided from the pull request event at the start of the run
|
|
32
|
+
* (labels, draft) — the common case then needs one run and one app
|
|
33
|
+
* build, like gitlab's switch job. Whatever changes later (a label set
|
|
34
|
+
* during or after the run, a draft marked ready, an explicit request) is
|
|
35
|
+
* handled by the review deploy workflow. `deploy: "manual"` never
|
|
36
|
+
* deploys on its own: undefined.
|
|
37
|
+
*/
|
|
38
|
+
const getInRunDeployCondition = (reviewApps) => {
|
|
39
|
+
const labels = "github.event.pull_request.labels.*.name";
|
|
40
|
+
const policy = reviewApps.deploy === "optIn"
|
|
41
|
+
? `contains(${labels}, ${literal(reviewApps.label)})`
|
|
42
|
+
: reviewApps.deploy === "optOut"
|
|
43
|
+
? `!contains(${labels}, ${literal(reviewApps.skipLabel)})`
|
|
44
|
+
: reviewApps.deploy === "auto"
|
|
45
|
+
? undefined
|
|
46
|
+
: null;
|
|
47
|
+
if (policy === null) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
const notDraft = reviewApps.drafts !== "likeReady"
|
|
51
|
+
? "!github.event.pull_request.draft"
|
|
52
|
+
: undefined;
|
|
53
|
+
return [policy, notDraft].filter(Boolean).join(" && ") || "true";
|
|
54
|
+
};
|
|
55
|
+
exports.getInRunDeployCondition = getInRunDeployCondition;
|
|
56
|
+
/** combine a job's `if` with the in-run deploy condition */
|
|
57
|
+
const withInRunCondition = (job, condition) => ({
|
|
58
|
+
...job,
|
|
59
|
+
if: andIf(job.if, condition),
|
|
60
|
+
});
|
|
61
|
+
exports.withInRunCondition = withInRunCondition;
|
|
62
|
+
/**
|
|
63
|
+
* the review delivery jobs (docker → deploy → verify) that move out of
|
|
64
|
+
* the review workflow into the review deploy workflow:
|
|
65
|
+
* - all of them when the reviewApps config gates review deploys
|
|
66
|
+
* - otherwise those of components whose review deploy is manual
|
|
67
|
+
* (`deploy.when: "manual"`) — github has no manual jobs inside a run,
|
|
68
|
+
* and the generic manual-task dispatch can't carry the pull request
|
|
69
|
+
*/
|
|
70
|
+
const getGatedReviewDeliveryJobIds = (triggerJobs, reviewApps) => {
|
|
71
|
+
var _a;
|
|
72
|
+
const gatedByConfig = (0, reviewApps_1.isReviewDeployGated)(reviewApps);
|
|
73
|
+
const manualComponents = new Set([...triggerJobs.values()]
|
|
74
|
+
.filter(({ job, context }) => (0, reviewApps_1.isReviewDeliveryJob)(context, job) &&
|
|
75
|
+
job.stage === "deploy" &&
|
|
76
|
+
job.gate === "manual")
|
|
77
|
+
.map(({ context }) => context.name));
|
|
78
|
+
const ids = new Set([...triggerJobs]
|
|
79
|
+
.filter(([, { job, context }]) => (0, reviewApps_1.isReviewDeliveryJob)(context, job) &&
|
|
80
|
+
(gatedByConfig || manualComponents.has(context.name)))
|
|
81
|
+
.map(([id]) => id));
|
|
82
|
+
// jobs depending on a moved job (e.g. a custom e2e job waiting for a
|
|
83
|
+
// review deploy) can't stay behind: they move along
|
|
84
|
+
let grown = ids.size > 0;
|
|
85
|
+
while (grown) {
|
|
86
|
+
grown = false;
|
|
87
|
+
for (const [id, { githubJob }] of triggerJobs) {
|
|
88
|
+
if (!ids.has(id) && ((_a = githubJob.needs) === null || _a === void 0 ? void 0 : _a.some((need) => ids.has(need)))) {
|
|
89
|
+
ids.add(id);
|
|
90
|
+
grown = true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return [...ids];
|
|
95
|
+
};
|
|
96
|
+
exports.getGatedReviewDeliveryJobIds = getGatedReviewDeliveryJobIds;
|
|
97
|
+
/**
|
|
98
|
+
* the review deploy workflow (`▶️ catladder deploy review`): the review
|
|
99
|
+
* delivery chains of a pull request, behind a guard that decides
|
|
100
|
+
* whether this run deploys (see `catci review-app github-guard`).
|
|
101
|
+
*
|
|
102
|
+
* Started by
|
|
103
|
+
* - the review workflow, once it is green and the label/draft policy
|
|
104
|
+
* says the PR deploys (`source: ci`)
|
|
105
|
+
* - switching the label on (opt-in: adding it, opt-out: removing the
|
|
106
|
+
* skip label) or marking a draft ready (`drafts: "checksOnly"`)
|
|
107
|
+
* - a human or agent dispatching it with the PR number — explicit
|
|
108
|
+
* requests always deploy, provided the PR's CI is green
|
|
109
|
+
*
|
|
110
|
+
* Artifacts are scoped to a single run, so the run rebuilds what the
|
|
111
|
+
* chains need (the app build); tests are not rerun — the guard checks
|
|
112
|
+
* the PR's `catladder ✅` instead.
|
|
113
|
+
*/
|
|
114
|
+
const makeReviewDeployWorkflow = ({ deliveryIds, triggerJobs, reviewApps, images, workflowEnv, permissions, }) => {
|
|
115
|
+
var _a, _b;
|
|
116
|
+
const delivery = new Set(deliveryIds);
|
|
117
|
+
const isQualityJob = (id) => {
|
|
118
|
+
const entry = triggerJobs.get(id);
|
|
119
|
+
return !!entry && (0, resolveRequirements_1.providesCapability)(entry.job, "qualityGate");
|
|
120
|
+
};
|
|
121
|
+
// the delivery jobs plus everything upstream they need from the
|
|
122
|
+
// trigger (rebuilt in this run), except the quality jobs
|
|
123
|
+
const included = new Set();
|
|
124
|
+
const stack = [...deliveryIds];
|
|
125
|
+
let current;
|
|
126
|
+
while ((current = stack.pop()) !== undefined) {
|
|
127
|
+
if (included.has(current))
|
|
128
|
+
continue;
|
|
129
|
+
included.add(current);
|
|
130
|
+
for (const need of (_b = (_a = triggerJobs.get(current)) === null || _a === void 0 ? void 0 : _a.githubJob.needs) !== null && _b !== void 0 ? _b : []) {
|
|
131
|
+
if (triggerJobs.has(need) && !isQualityJob(need))
|
|
132
|
+
stack.push(need);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// the guard runs first, every other job only when it says deploy
|
|
136
|
+
const gatedJob = (job) => {
|
|
137
|
+
var _a;
|
|
138
|
+
return ({
|
|
139
|
+
...job,
|
|
140
|
+
needs: [GUARD_JOB_ID, ...((_a = job.needs) !== null && _a !== void 0 ? _a : [])],
|
|
141
|
+
if: andIf(job.if, `needs.${GUARD_JOB_ID}.outputs.deploy == 'true'`),
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
const checkoutPrHead = (step) => {
|
|
145
|
+
var _a;
|
|
146
|
+
return ((_a = step.uses) === null || _a === void 0 ? void 0 : _a.startsWith("actions/checkout@"))
|
|
147
|
+
? {
|
|
148
|
+
...step,
|
|
149
|
+
// the PR head — a label event's default is the merge ref
|
|
150
|
+
with: {
|
|
151
|
+
...step.with,
|
|
152
|
+
ref: "${{ github.event.pull_request.head.sha || github.sha }}",
|
|
153
|
+
},
|
|
154
|
+
}
|
|
155
|
+
: step;
|
|
156
|
+
};
|
|
157
|
+
const chainJobs = Object.fromEntries([...included].sort().map((id) => {
|
|
158
|
+
const { githubJob } = triggerJobs.get(id);
|
|
159
|
+
return [
|
|
160
|
+
id,
|
|
161
|
+
gatedJob({
|
|
162
|
+
...githubJob,
|
|
163
|
+
// the quality jobs stay in the review workflow — the guard
|
|
164
|
+
// checks their aggregate instead
|
|
165
|
+
...(githubJob.needs
|
|
166
|
+
? {
|
|
167
|
+
needs: githubJob.needs.filter((need) => !isQualityJob(need) || delivery.has(need)),
|
|
168
|
+
}
|
|
169
|
+
: {}),
|
|
170
|
+
steps: githubJob.steps.map(checkoutPrHead),
|
|
171
|
+
}),
|
|
172
|
+
];
|
|
173
|
+
}));
|
|
174
|
+
// only the images the chains run in (not e.g. the release image)
|
|
175
|
+
const neededIds = new Set(Object.values(chainJobs).flatMap((job) => { var _a; return (_a = job.needs) !== null && _a !== void 0 ? _a : []; }));
|
|
176
|
+
const imageJobs = Object.fromEntries(Object.entries((0, ensureImageJobs_1.makeEnsureImageGithubJobs)(images))
|
|
177
|
+
.filter(([id]) => neededIds.has(id))
|
|
178
|
+
.map(([id, job]) => [id, gatedJob(job)]));
|
|
179
|
+
const switchLabel = (0, reviewApps_1.getReviewAppsSwitchLabel)(reviewApps);
|
|
180
|
+
const pullRequestTypes = [
|
|
181
|
+
...(switchLabel ? [switchLabel.deployOn] : []),
|
|
182
|
+
...(reviewApps.drafts === "checksOnly" ? ["ready_for_review"] : []),
|
|
183
|
+
];
|
|
184
|
+
// pull request events that concern the review apps — other label
|
|
185
|
+
// changes must neither run the guard nor cancel a running deploy
|
|
186
|
+
const relevantEvent = [
|
|
187
|
+
"github.event_name == 'workflow_dispatch'",
|
|
188
|
+
...(switchLabel
|
|
189
|
+
? [
|
|
190
|
+
`(github.event.action == ${literal(switchLabel.deployOn)} && github.event.label.name == ${literal(switchLabel.label)})`,
|
|
191
|
+
]
|
|
192
|
+
: []),
|
|
193
|
+
...(reviewApps.drafts === "checksOnly"
|
|
194
|
+
? ["github.event.action == 'ready_for_review'"]
|
|
195
|
+
: []),
|
|
196
|
+
].join(" || ");
|
|
197
|
+
return {
|
|
198
|
+
name: "▶️ catladder deploy review",
|
|
199
|
+
on: {
|
|
200
|
+
workflow_dispatch: {
|
|
201
|
+
inputs: {
|
|
202
|
+
pr: {
|
|
203
|
+
description: "number of the pull request whose review apps to deploy",
|
|
204
|
+
required: true,
|
|
205
|
+
type: "string",
|
|
206
|
+
},
|
|
207
|
+
source: {
|
|
208
|
+
description: "who requests the deploy: manual (always deploys) or ci (applies the label/draft policy)",
|
|
209
|
+
required: false,
|
|
210
|
+
type: "choice",
|
|
211
|
+
options: ["manual", "ci"],
|
|
212
|
+
default: "manual",
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
...(pullRequestTypes.length > 0
|
|
217
|
+
? { pull_request: { types: pullRequestTypes } }
|
|
218
|
+
: {}),
|
|
219
|
+
},
|
|
220
|
+
concurrency: reviewDeployConcurrency(relevantEvent),
|
|
221
|
+
permissions,
|
|
222
|
+
env: { ...workflowEnv, CL_PR_NUMBER: `\${{ ${PR_NUMBER_EXPRESSION} }}` },
|
|
223
|
+
jobs: {
|
|
224
|
+
[GUARD_JOB_ID]: {
|
|
225
|
+
name: "🚦 review deploy guard",
|
|
226
|
+
"runs-on": "ubuntu-latest",
|
|
227
|
+
...(pullRequestTypes.length > 0
|
|
228
|
+
? { if: `\${{ ${relevantEvent} }}` }
|
|
229
|
+
: {}),
|
|
230
|
+
permissions: {
|
|
231
|
+
contents: "read",
|
|
232
|
+
"pull-requests": "read",
|
|
233
|
+
checks: "read",
|
|
234
|
+
statuses: "write",
|
|
235
|
+
},
|
|
236
|
+
env: {
|
|
237
|
+
GITHUB_TOKEN: "${{ github.token }}",
|
|
238
|
+
CL_REVIEW_APPS: JSON.stringify(reviewApps),
|
|
239
|
+
CL_DEPLOY_SOURCE: "${{ github.event_name == 'workflow_dispatch' && (inputs.source || 'manual') || 'label' }}",
|
|
240
|
+
CL_HEAD_SHA: "${{ github.event.pull_request.head.sha || github.sha }}",
|
|
241
|
+
},
|
|
242
|
+
outputs: { deploy: "${{ steps.main.outputs.deploy }}" },
|
|
243
|
+
steps: [
|
|
244
|
+
catciCheckout(),
|
|
245
|
+
{
|
|
246
|
+
name: "🚦 review deploy guard",
|
|
247
|
+
id: "main",
|
|
248
|
+
run: `node ${CATCI} review-app github-guard`,
|
|
249
|
+
shell: "bash",
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
// the pull request shows the deploy in flight
|
|
253
|
+
name: "report pending review app",
|
|
254
|
+
if: "${{ steps.main.outputs.deploy == 'true' }}",
|
|
255
|
+
env: { GH_TOKEN: "${{ github.token }}" },
|
|
256
|
+
run: `gh api "repos/$GITHUB_REPOSITORY/statuses/$CL_HEAD_SHA" -f state=pending -f context="${exports.REVIEW_APP_STATUS_CONTEXT}" -f description="deploying the review apps" -f target_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" > /dev/null`,
|
|
257
|
+
shell: "bash",
|
|
258
|
+
},
|
|
259
|
+
],
|
|
260
|
+
},
|
|
261
|
+
...imageJobs,
|
|
262
|
+
...chainJobs,
|
|
263
|
+
...(0, exports.makeReviewAppAggregateJob)([GUARD_JOB_ID, ...Object.keys(imageJobs), ...Object.keys(chainJobs)], `needs.${GUARD_JOB_ID}.outputs.deploy == 'true'`),
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
exports.makeReviewDeployWorkflow = makeReviewDeployWorkflow;
|
|
268
|
+
exports.REVIEW_APP_AGGREGATE_JOB_ID = "catladder-review-app-ok";
|
|
269
|
+
exports.REVIEW_APP_AGGREGATE_JOB_NAME = "catladder review app ✅";
|
|
270
|
+
/** the commit status context the aggregate job reports */
|
|
271
|
+
exports.REVIEW_APP_STATUS_CONTEXT = "catladder review app";
|
|
272
|
+
/**
|
|
273
|
+
* one job with a STABLE name that succeeds exactly when the review apps
|
|
274
|
+
* of this run deployed and verified — the result a merge gate (a bot,
|
|
275
|
+
* or a branch rule for projects that deploy every PR) waits for,
|
|
276
|
+
* regardless of the project's components.
|
|
277
|
+
*
|
|
278
|
+
* It also reports a commit status on the PR head: runs started by a
|
|
279
|
+
* dispatch (the trigger job, or by hand) are attached to the commit but
|
|
280
|
+
* not shown on the pull request, a commit status always is.
|
|
281
|
+
*
|
|
282
|
+
* Runs only when the run deploys (the guard decided so, or the review
|
|
283
|
+
* workflow's start condition held) — a run that doesn't deploy says
|
|
284
|
+
* nothing about the review app (its check is skipped, the commit status
|
|
285
|
+
* untouched). Neither does a cancelled run (superseded by a newer
|
|
286
|
+
* deploy, or stopped): a gate keeps waiting instead of seeing red.
|
|
287
|
+
*/
|
|
288
|
+
const makeReviewAppAggregateJob = (needs,
|
|
289
|
+
/** when the run deploys the review apps (a github expression) */
|
|
290
|
+
deploysWhen) => ({
|
|
291
|
+
[exports.REVIEW_APP_AGGREGATE_JOB_ID]: {
|
|
292
|
+
name: exports.REVIEW_APP_AGGREGATE_JOB_NAME,
|
|
293
|
+
"runs-on": "ubuntu-latest",
|
|
294
|
+
needs: [...needs].sort(),
|
|
295
|
+
if: `\${{ always() && (${deploysWhen}) }}`,
|
|
296
|
+
permissions: { statuses: "write" },
|
|
297
|
+
env: {
|
|
298
|
+
GH_TOKEN: "${{ github.token }}",
|
|
299
|
+
HEAD_SHA: "${{ github.event.pull_request.head.sha || github.sha }}",
|
|
300
|
+
RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
|
|
301
|
+
},
|
|
302
|
+
steps: [
|
|
303
|
+
{
|
|
304
|
+
name: exports.REVIEW_APP_AGGREGATE_JOB_NAME,
|
|
305
|
+
// the needs context only interpolates inside the workflow file,
|
|
306
|
+
// so this script stays inline
|
|
307
|
+
run: [
|
|
308
|
+
`results='\${{ toJSON(needs) }}'`,
|
|
309
|
+
`echo "$results"`,
|
|
310
|
+
`if echo "$results" | grep -qE '"result": "failure"'; then`,
|
|
311
|
+
` state=failure; description="the review apps did not deploy and verify"`,
|
|
312
|
+
`elif echo "$results" | grep -qE '"result": "cancelled"'; then`,
|
|
313
|
+
` # superseded by a newer deploy, or stopped: no result, not red`,
|
|
314
|
+
` echo "cancelled — no review app result reported"; exit 0`,
|
|
315
|
+
`elif echo "$results" | grep -qE '"result": "skipped"'; then`,
|
|
316
|
+
` state=failure; description="the review apps did not deploy and verify"`,
|
|
317
|
+
`else`,
|
|
318
|
+
` state=success; description="review apps deployed and verified"`,
|
|
319
|
+
`fi`,
|
|
320
|
+
`gh api "repos/$GITHUB_REPOSITORY/statuses/$HEAD_SHA" -f state="$state" -f context="${exports.REVIEW_APP_STATUS_CONTEXT}" -f description="$description" -f target_url="$RUN_URL" > /dev/null`,
|
|
321
|
+
`echo "$description"`,
|
|
322
|
+
`[ "$state" = success ]`,
|
|
323
|
+
].join("\n"),
|
|
324
|
+
shell: "bash",
|
|
325
|
+
},
|
|
326
|
+
],
|
|
327
|
+
},
|
|
328
|
+
});
|
|
329
|
+
exports.makeReviewAppAggregateJob = makeReviewAppAggregateJob;
|
|
330
|
+
/** a checkout of just the materialized catci */
|
|
331
|
+
const catciCheckout = () => ({
|
|
332
|
+
name: "Checkout",
|
|
333
|
+
uses: "actions/checkout@v4",
|
|
334
|
+
with: { "sparse-checkout": shippedCatci_1.GENERATED_CATCI_FOLDER },
|
|
335
|
+
});
|
|
336
|
+
/**
|
|
337
|
+
* one deploy/stop of a PR's review apps at a time, the newest wins —
|
|
338
|
+
* shared by the deploy and the stop workflow, so closing a PR or
|
|
339
|
+
* switching the label off cancels a deploy in flight before tearing
|
|
340
|
+
* down. Events that don't concern the review apps get a group of
|
|
341
|
+
* their own, so they never cancel anything.
|
|
342
|
+
*/
|
|
343
|
+
const reviewDeployConcurrency = (relevantEvent) => ({
|
|
344
|
+
group: `catladder-review-deploy-\${{ ${PR_NUMBER_EXPRESSION} }}\${{ !(${relevantEvent}) && format('-ignored-{0}', github.run_id) || '' }}`,
|
|
345
|
+
"cancel-in-progress": true,
|
|
346
|
+
});
|
|
347
|
+
/**
|
|
348
|
+
* the last job of the review workflow: once it is green, dispatch the
|
|
349
|
+
* review deploy workflow when the label/draft policy says this PR
|
|
350
|
+
* deploys (read fresh from the PR, so a label set while CI ran counts).
|
|
351
|
+
* Only for policies that deploy on their own — `deploy: "manual"` waits
|
|
352
|
+
* for an explicit dispatch.
|
|
353
|
+
*/
|
|
354
|
+
const makeReviewDeployTriggerJob = (reviewApps,
|
|
355
|
+
/** the review workflow deployed itself when this held at its start */
|
|
356
|
+
inRunCondition) => reviewApps.deploy === "manual"
|
|
357
|
+
? {}
|
|
358
|
+
: {
|
|
359
|
+
[TRIGGER_JOB_ID]: {
|
|
360
|
+
name: "▶️ trigger review deploy",
|
|
361
|
+
"runs-on": "ubuntu-latest",
|
|
362
|
+
needs: [aggregateCheckJob_1.AGGREGATE_CHECK_JOB_ID],
|
|
363
|
+
...(inRunCondition
|
|
364
|
+
? {
|
|
365
|
+
// NOT success(): it also checks the transitive needs,
|
|
366
|
+
// and the chains this run skipped on purpose would make
|
|
367
|
+
// it false — exactly when the trigger is needed
|
|
368
|
+
if: `\${{ !cancelled() && needs.${aggregateCheckJob_1.AGGREGATE_CHECK_JOB_ID}.result == 'success' && !(${inRunCondition}) }}`,
|
|
369
|
+
}
|
|
370
|
+
: {}),
|
|
371
|
+
permissions: {
|
|
372
|
+
contents: "read",
|
|
373
|
+
"pull-requests": "read",
|
|
374
|
+
actions: "write",
|
|
375
|
+
},
|
|
376
|
+
env: {
|
|
377
|
+
GITHUB_TOKEN: "${{ github.token }}",
|
|
378
|
+
CL_REVIEW_APPS: JSON.stringify(reviewApps),
|
|
379
|
+
CL_HEAD_REF: "${{ github.head_ref }}",
|
|
380
|
+
CL_HEAD_SHA: "${{ github.event.pull_request.head.sha }}",
|
|
381
|
+
},
|
|
382
|
+
steps: [
|
|
383
|
+
catciCheckout(),
|
|
384
|
+
{
|
|
385
|
+
name: "▶️ trigger review deploy",
|
|
386
|
+
run: `node ${CATCI} review-app github-trigger`,
|
|
387
|
+
shell: "bash",
|
|
388
|
+
},
|
|
389
|
+
],
|
|
390
|
+
},
|
|
391
|
+
};
|
|
392
|
+
exports.makeReviewDeployTriggerJob = makeReviewDeployTriggerJob;
|
|
393
|
+
/**
|
|
394
|
+
* the review stop workflow under a label policy: switching the label
|
|
395
|
+
* off (opt-in: removing it, opt-out: adding the skip label) stops the
|
|
396
|
+
* review apps, like closing the PR does. It shares the deploy
|
|
397
|
+
* workflow's concurrency group, so a deploy in flight is cancelled
|
|
398
|
+
* first.
|
|
399
|
+
*/
|
|
400
|
+
const withReviewStopSwitch = (workflow, reviewApps,
|
|
401
|
+
/** the review workflow deploys itself (see getInRunDeployCondition) */
|
|
402
|
+
reviewRunDeploys = false) => {
|
|
403
|
+
const switchLabel = (0, reviewApps_1.getReviewAppsSwitchLabel)(reviewApps);
|
|
404
|
+
const relevantEvent = [
|
|
405
|
+
"github.event_name == 'workflow_dispatch'",
|
|
406
|
+
"github.event.action == 'closed'",
|
|
407
|
+
...(switchLabel
|
|
408
|
+
? [
|
|
409
|
+
`(github.event.action == ${literal(switchLabel.stopOn)} && github.event.label.name == ${literal(switchLabel.label)})`,
|
|
410
|
+
]
|
|
411
|
+
: []),
|
|
412
|
+
].join(" || ");
|
|
413
|
+
return {
|
|
414
|
+
...workflow,
|
|
415
|
+
on: {
|
|
416
|
+
...workflow.on,
|
|
417
|
+
pull_request: {
|
|
418
|
+
types: ["closed", ...(switchLabel ? [switchLabel.stopOn] : [])],
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
concurrency: reviewDeployConcurrency(relevantEvent),
|
|
422
|
+
jobs: Object.fromEntries(Object.entries({
|
|
423
|
+
...(reviewRunDeploys ? makeCancelReviewRunsJob() : {}),
|
|
424
|
+
...Object.fromEntries(Object.entries(workflow.jobs).map(([id, job]) => {
|
|
425
|
+
var _a;
|
|
426
|
+
return [
|
|
427
|
+
id,
|
|
428
|
+
// the teardown waits until no review run deploys anymore
|
|
429
|
+
reviewRunDeploys && !id.startsWith("catladder-image-")
|
|
430
|
+
? {
|
|
431
|
+
...job,
|
|
432
|
+
needs: [CANCEL_REVIEW_RUNS_JOB_ID, ...((_a = job.needs) !== null && _a !== void 0 ? _a : [])],
|
|
433
|
+
}
|
|
434
|
+
: job,
|
|
435
|
+
];
|
|
436
|
+
})),
|
|
437
|
+
}).map(([id, job]) => [
|
|
438
|
+
id,
|
|
439
|
+
switchLabel ? { ...job, if: andIf(job.if, relevantEvent) } : job,
|
|
440
|
+
])),
|
|
441
|
+
};
|
|
442
|
+
};
|
|
443
|
+
exports.withReviewStopSwitch = withReviewStopSwitch;
|
|
444
|
+
const CANCEL_REVIEW_RUNS_JOB_ID = "catladder-wait-review-runs";
|
|
445
|
+
/**
|
|
446
|
+
* the review workflow deploys review apps itself, outside the deploy /
|
|
447
|
+
* stop concurrency group — a teardown would race a deploy still running
|
|
448
|
+
* there (the deploy finishing after the stop leaves the app and its
|
|
449
|
+
* database behind). So the stop first waits for the PR's unfinished
|
|
450
|
+
* review runs to end — cancelling them when the PR was closed, letting
|
|
451
|
+
* them finish when only the label was switched off (their CI still
|
|
452
|
+
* counts). Never fails: a stuck run must not keep the teardown from
|
|
453
|
+
* running (it gives up after 30 minutes).
|
|
454
|
+
*/
|
|
455
|
+
const makeCancelReviewRunsJob = () => ({
|
|
456
|
+
[CANCEL_REVIEW_RUNS_JOB_ID]: {
|
|
457
|
+
name: "wait for running review deploys",
|
|
458
|
+
"runs-on": "ubuntu-latest",
|
|
459
|
+
permissions: { actions: "write", "pull-requests": "read" },
|
|
460
|
+
env: { GH_TOKEN: "${{ github.token }}" },
|
|
461
|
+
steps: [
|
|
462
|
+
{
|
|
463
|
+
name: "wait for running review deploys",
|
|
464
|
+
run: [
|
|
465
|
+
`branch=$(gh pr view "$CL_PR_NUMBER" -R "$GITHUB_REPOSITORY" --json headRefName -q .headRefName) || exit 0`,
|
|
466
|
+
`runs=$(gh run list -R "$GITHUB_REPOSITORY" --workflow catladder-review.yml --branch "$branch" --limit 20 --json databaseId,status -q '.[] | select(.status != "completed") | .databaseId') || exit 0`,
|
|
467
|
+
`# a closed PR's CI is worthless: cancel it. Otherwise let the`,
|
|
468
|
+
`# PR's CI finish (cancelling it would leave catladder ✅ red)`,
|
|
469
|
+
`if [ "$(jq -r '.action // ""' "$GITHUB_EVENT_PATH")" = closed ]; then`,
|
|
470
|
+
` for id in $runs; do echo "cancelling review run $id"; gh run cancel "$id" -R "$GITHUB_REPOSITORY" || true; done`,
|
|
471
|
+
`fi`,
|
|
472
|
+
`for id in $runs; do`,
|
|
473
|
+
` echo "waiting for review run $id"`,
|
|
474
|
+
` for _ in $(seq 1 360); do`,
|
|
475
|
+
` [ "$(gh run view "$id" -R "$GITHUB_REPOSITORY" --json status -q .status)" = completed ] && break`,
|
|
476
|
+
` sleep 5`,
|
|
477
|
+
` done`,
|
|
478
|
+
`done`,
|
|
479
|
+
`exit 0`,
|
|
480
|
+
].join("\n"),
|
|
481
|
+
shell: "bash",
|
|
482
|
+
},
|
|
483
|
+
],
|
|
484
|
+
},
|
|
485
|
+
});
|
|
486
|
+
/**
|
|
487
|
+
* `drafts: "skip"`: draft PRs run nothing — every job of the review
|
|
488
|
+
* workflow skips them, and marking the PR ready starts the run. A
|
|
489
|
+
* skipped `catladder ✅` can't let a draft through: drafts can't be
|
|
490
|
+
* merged.
|
|
491
|
+
*/
|
|
492
|
+
const withDraftsSkipped = (workflow) => {
|
|
493
|
+
const on = workflow.on;
|
|
494
|
+
return {
|
|
495
|
+
...workflow,
|
|
496
|
+
on: {
|
|
497
|
+
...workflow.on,
|
|
498
|
+
pull_request: {
|
|
499
|
+
...on.pull_request,
|
|
500
|
+
types: [...on.pull_request.types, "ready_for_review"],
|
|
501
|
+
},
|
|
502
|
+
},
|
|
503
|
+
jobs: Object.fromEntries(Object.entries(workflow.jobs).map(([id, job]) => [
|
|
504
|
+
id,
|
|
505
|
+
{ ...job, if: andIf(job.if, "!github.event.pull_request.draft") },
|
|
506
|
+
])),
|
|
507
|
+
};
|
|
508
|
+
};
|
|
509
|
+
exports.withDraftsSkipped = withDraftsSkipped;
|
|
510
|
+
//# sourceMappingURL=reviewDeployWorkflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviewDeployWorkflow.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/github/reviewDeployWorkflow.ts"],"names":[],"mappings":";;;AAAA,2DAAkE;AAElE,4EAAwE;AACxE,iDAK0B;AAQ1B,2DAA6D;AAC7D,uDAA8D;AAE9D,MAAM,KAAK,GAAG,GAAG,qCAAsB,WAAW,CAAC;AAEnD;;;GAGG;AACU,QAAA,2BAA2B,GAAG,6BAA6B,CAAC;AAEzE,MAAM,YAAY,GAAG,+BAA+B,CAAC;AACrD,MAAM,cAAc,GAAG,iCAAiC,CAAC;AAEzD,gEA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AAC,EAA2C,CAAC;IAChE,OAAO;QACL,GAAG,QAAQ;QACX,EAAE,EAAE;YACF,GAAG,QAAQ,CAAC,EAAE;YACd,YAAY,EAAE;gBACZ,GAAG,EAAE,CAAC,YAAY;gBAClB,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,kBAAkB,CAAC;aACtD;SACF;QACD,IAAI,EAAE,MAAM,CAAC,WAAW,CACtB,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;YAC/C,EAAE;YACF,EAAE,GAAG,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,kCAAkC,CAAC,EAAE;SAClE,CAAC,CACH;KACF,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,iBAAiB,qBAkB5B"}
|
|
@@ -6,6 +6,8 @@ const rules_1 = require("../../rules");
|
|
|
6
6
|
const config_1 = require("../../types/config");
|
|
7
7
|
const configruedEnvs_1 = require("../../config/configruedEnvs");
|
|
8
8
|
const autoStop_1 = require("../../autoStop");
|
|
9
|
+
const reviewApps_1 = require("../../reviewApps");
|
|
10
|
+
const reviewDeployGate_1 = require("./reviewDeployGate");
|
|
9
11
|
const createAllJobs_1 = require("../../pipeline/createAllJobs");
|
|
10
12
|
const jobImagesPlan_1 = require("../../customImages/jobImagesPlan");
|
|
11
13
|
const shippedCatci_1 = require("../../catci/shippedCatci");
|
|
@@ -119,10 +121,32 @@ class GitlabBackend {
|
|
|
119
121
|
...config_1.ALL_PIPELINE_TRIGGERS,
|
|
120
122
|
...branchTriggers,
|
|
121
123
|
];
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
const reviewApps = (0, reviewApps_1.getReviewAppsConfig)(config);
|
|
125
|
+
const jobsPerTrigger = await Promise.all(allTriggers.map(async (trigger) => {
|
|
126
|
+
const catladderJobs = await (0, createAllJobs_1.createAllJobs)({
|
|
127
|
+
config,
|
|
128
|
+
trigger,
|
|
129
|
+
pipelineType: this.type,
|
|
130
|
+
});
|
|
131
|
+
// review deploys behind one switch per MR (reviewApps config)
|
|
132
|
+
const reviewDeployGate = trigger === "mr"
|
|
133
|
+
? (0, reviewDeployGate_1.addGitlabReviewDeployGate)(catladderJobs, reviewApps)
|
|
134
|
+
: undefined;
|
|
135
|
+
const jobs = await (0, createGitlabJobs_1.createGitlabJobs)(catladderJobs, images, getGitlabRulesForTrigger(trigger));
|
|
136
|
+
return {
|
|
137
|
+
trigger,
|
|
138
|
+
jobs: reviewDeployGate
|
|
139
|
+
? [
|
|
140
|
+
{
|
|
141
|
+
name: reviewDeployGate_1.REVIEW_DEPLOY_GATE_JOB_NAME,
|
|
142
|
+
gitlabJob: reviewDeployGate,
|
|
143
|
+
context: null,
|
|
144
|
+
},
|
|
145
|
+
...jobs,
|
|
146
|
+
]
|
|
147
|
+
: jobs,
|
|
148
|
+
};
|
|
149
|
+
}));
|
|
126
150
|
const allJobsPerTrigger = jobsPerTrigger.flatMap(({ jobs }) => jobs);
|
|
127
151
|
const stages = (0, getPipelineStages_1.getPipelineStages)(config, new Set(allJobsPerTrigger
|
|
128
152
|
.map(({ gitlabJob }) => gitlabJob.stage)
|
|
@@ -202,6 +226,7 @@ class GitlabBackend {
|
|
|
202
226
|
},
|
|
203
227
|
branchPipelines: branchTriggers.map(({ branch }) => branch),
|
|
204
228
|
autoStop: (0, autoStop_1.getAutoStopConfig)(config),
|
|
229
|
+
reviewApps,
|
|
205
230
|
});
|
|
206
231
|
}
|
|
207
232
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitlabBackend.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/gitlab/GitlabBackend.ts"],"names":[],"mappings":";;;AAAA,0CAA2C;AAC3C,uCAKqB;AAUrB,+CAA4E;AAC5E,gEAA0E;AAC1E,6CAAmD;AACnD,gEAA6D;AAC7D,oEAAiE;AACjE,2DAAkE;AAClE,2CAAiD;AAEjD,oCAA8C;AAE9C,yDAAsD;AACtD,iEAA0E;AAC1E,2DAA2D;AAC3D,2DAAwD;AACxD,uDAA2D;AAC3D,mEAAgE;AAChE,uDAA+D;AAE/D,MAAM,0BAA0B,GAAG,sBAAsB,CAAC;AAE1D,MAAM,uBAAuB,GAAG,0BAA0B,GAAG,SAAS,CAAC;AAEvE,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAE1C,MAAa,aAAa;IAA1B;QACW,SAAI,GAAG,QAAiB,CAAC;QAEzB,oBAAe,GAAG,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"GitlabBackend.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/backends/gitlab/GitlabBackend.ts"],"names":[],"mappings":";;;AAAA,0CAA2C;AAC3C,uCAKqB;AAUrB,+CAA4E;AAC5E,gEAA0E;AAC1E,6CAAmD;AACnD,iDAAuD;AACvD,yDAG4B;AAC5B,gEAA6D;AAC7D,oEAAiE;AACjE,2DAAkE;AAClE,2CAAiD;AAEjD,oCAA8C;AAE9C,yDAAsD;AACtD,iEAA0E;AAC1E,2DAA2D;AAC3D,2DAAwD;AACxD,uDAA2D;AAC3D,mEAAgE;AAChE,uDAA+D;AAE/D,MAAM,0BAA0B,GAAG,sBAAsB,CAAC;AAE1D,MAAM,uBAAuB,GAAG,0BAA0B,GAAG,SAAS,CAAC;AAEvE,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAE1C,MAAa,aAAa;IAA1B;QACW,SAAI,GAAG,QAAiB,CAAC;QAEzB,oBAAe,GAAG,uBAAuB,CAAC;IAiRrD,CAAC;IA/QC,KAAK,CAAC,OAAO;QACX,MAAM,IAAA,aAAE,EAAC,IAAI,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACjE,qEAAqE;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,KAAK,eAAe;YAClB,OAAO,CAAC,mCAA2B,EAAE,8BAAsB,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,mBAAmB,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import type { Pipeline } from "../../types";
|
|
2
2
|
import { type ResolvedAutoStopConfig } from "../../autoStop";
|
|
3
|
+
import { type ResolvedReviewAppsConfig } from "../../reviewApps";
|
|
3
4
|
type PickRequired<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* gitlab requires a top-level default image for jobs that don't set their
|
|
7
|
+
* own. Every catladder-generated job sets an explicit image, so this
|
|
8
|
+
* fallback is never pulled for them — it just needs to be a valid,
|
|
9
|
+
* build-free image (a catladder job image would drag in a build job).
|
|
10
|
+
* Trivial jobs (the review deploy switch) reuse it explicitly.
|
|
11
|
+
*/
|
|
12
|
+
export declare const DEFAULT_PIPELINE_IMAGE = "node:22";
|
|
13
|
+
export declare const createGitlabPipelineWithDefaults: ({ image, variables, before_script, branchPipelines, autoStop, reviewApps, ...config }: PickRequired<Partial<Pipeline<"gitlab">>, "stages" | "jobs"> & {
|
|
5
14
|
/**
|
|
6
15
|
* branches with their own pipeline (envs with `on: { branch: ... }`) —
|
|
7
16
|
* they get a named entry in the workflow name rules
|
|
8
17
|
*/
|
|
9
18
|
branchPipelines?: string[];
|
|
10
19
|
autoStop?: ResolvedAutoStopConfig;
|
|
20
|
+
reviewApps?: ResolvedReviewAppsConfig;
|
|
11
21
|
}) => Pipeline<"gitlab">;
|
|
12
22
|
export {};
|