@venturekit/cli 0.0.0-dev.20260430162351 → 0.0.0-dev.20260504234818
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/README.md +65 -0
- package/dist/commands/cert.d.ts +25 -0
- package/dist/commands/cert.d.ts.map +1 -0
- package/dist/commands/cert.js +371 -0
- package/dist/commands/cert.js.map +1 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +70 -0
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +28 -0
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/gha.d.ts +32 -0
- package/dist/commands/gha.d.ts.map +1 -0
- package/dist/commands/gha.js +645 -0
- package/dist/commands/gha.js.map +1 -0
- package/dist/commands/help.js +1 -1
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/open.d.ts.map +1 -1
- package/dist/commands/open.js +104 -3
- package/dist/commands/open.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/cognito-local.d.ts +18 -2
- package/dist/utils/cognito-local.d.ts.map +1 -1
- package/dist/utils/cognito-local.js +19 -0
- package/dist/utils/cognito-local.js.map +1 -1
- package/dist/utils/dev-cognito-ui-page.d.ts +18 -0
- package/dist/utils/dev-cognito-ui-page.d.ts.map +1 -0
- package/dist/utils/dev-cognito-ui-page.js +858 -0
- package/dist/utils/dev-cognito-ui-page.js.map +1 -0
- package/dist/utils/dev-cognito-ui.d.ts +91 -0
- package/dist/utils/dev-cognito-ui.d.ts.map +1 -0
- package/dist/utils/dev-cognito-ui.js +546 -0
- package/dist/utils/dev-cognito-ui.js.map +1 -0
- package/dist/utils/dev-server-discovery.d.ts +52 -0
- package/dist/utils/dev-server-discovery.d.ts.map +1 -0
- package/dist/utils/dev-server-discovery.js +128 -0
- package/dist/utils/dev-server-discovery.js.map +1 -0
- package/dist/utils/local-server.d.ts +9 -0
- package/dist/utils/local-server.d.ts.map +1 -1
- package/dist/utils/local-server.js +41 -0
- package/dist/utils/local-server.js.map +1 -1
- package/package.json +7 -4
|
@@ -0,0 +1,645 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vk gha — GitHub Actions plumbing.
|
|
3
|
+
*
|
|
4
|
+
* Two subcommands absorb the "30 lines of AWS CLI + hand-rolled JSON"
|
|
5
|
+
* dance that most projects copy-paste into their DEPLOYMENT.md:
|
|
6
|
+
*
|
|
7
|
+
* vk gha bootstrap Create the OIDC provider + deploy IAM role.
|
|
8
|
+
* vk gha workflow Generate .github/workflows/deploy.yml.
|
|
9
|
+
*
|
|
10
|
+
* `bootstrap` auto-detects the GitHub repo from `git remote origin`
|
|
11
|
+
* and the deployable stages from `vk.config.ts`, then idempotently
|
|
12
|
+
* provisions:
|
|
13
|
+
* - a single account-wide OpenID Connect provider for GitHub, and
|
|
14
|
+
* - an IAM role whose trust policy accepts tokens minted by this
|
|
15
|
+
* repo for each declared stage (both `ref:refs/heads/<stage>` and
|
|
16
|
+
* `environment:<stage>` subject forms).
|
|
17
|
+
*
|
|
18
|
+
* The role gets `AdministratorAccess` by default (pragmatic, matches
|
|
19
|
+
* the historical DEPLOYMENT.md) or a VentureKit-maintained scoped
|
|
20
|
+
* inline policy with `--scoped`. Flip between them freely —
|
|
21
|
+
* re-running the command tidies up the previous attachment.
|
|
22
|
+
*
|
|
23
|
+
* `workflow` writes a ready-to-commit deploy pipeline that:
|
|
24
|
+
* - triggers on pushes to the branches you map to stages,
|
|
25
|
+
* - authenticates to AWS via OIDC (no long-lived keys),
|
|
26
|
+
* - runs `vk deploy --stage <stage>` with concurrency scoped to
|
|
27
|
+
* that stage so parallel pushes serialise instead of racing the
|
|
28
|
+
* CloudFormation stack.
|
|
29
|
+
*/
|
|
30
|
+
import chalk from 'chalk';
|
|
31
|
+
import ora from 'ora';
|
|
32
|
+
import { execSync } from 'node:child_process';
|
|
33
|
+
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
34
|
+
import { dirname, join } from 'node:path';
|
|
35
|
+
import { loadVentureConfig } from '../utils/config-loader.js';
|
|
36
|
+
// ── Constants ─────────────────────────────────────────────────────
|
|
37
|
+
/** GitHub's OIDC issuer — never changes, defined by GitHub. */
|
|
38
|
+
const OIDC_URL = 'https://token.actions.githubusercontent.com';
|
|
39
|
+
/** The only audience GitHub's OIDC issues for AWS role federation. */
|
|
40
|
+
const OIDC_AUDIENCE = 'sts.amazonaws.com';
|
|
41
|
+
/**
|
|
42
|
+
* GitHub's (current) TLS thumbprint. AWS re-verifies GitHub's cert
|
|
43
|
+
* chain dynamically, so the thumbprint here is mostly ceremonial;
|
|
44
|
+
* pinning one value is enough even when GitHub rotates its cert.
|
|
45
|
+
*/
|
|
46
|
+
const OIDC_THUMBPRINT = '6938fd4d98bab03faadb97b34396831e3780aea1';
|
|
47
|
+
/** Default role name when --role isn't passed. Prefixed for easy auditing. */
|
|
48
|
+
const DEFAULT_ROLE_NAME = 'venturekit-gha-deploy';
|
|
49
|
+
// ── Repo / stage discovery ────────────────────────────────────────
|
|
50
|
+
/**
|
|
51
|
+
* Parse GitHub owner/repo from `git remote get-url origin`. Handles
|
|
52
|
+
* the three URL forms GitHub emits (HTTPS with .git, SSH `:path`
|
|
53
|
+
* notation, SSH `ssh://` URL) without pulling in a git-url parser.
|
|
54
|
+
*/
|
|
55
|
+
function detectRepoFromGit(projectDir) {
|
|
56
|
+
try {
|
|
57
|
+
const url = execSync('git remote get-url origin', {
|
|
58
|
+
cwd: projectDir,
|
|
59
|
+
encoding: 'utf-8',
|
|
60
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
61
|
+
}).trim();
|
|
62
|
+
const match = url.match(/github\.com[:/]([^/]+)\/([^/.]+?)(?:\.git)?\s*$/i);
|
|
63
|
+
if (!match)
|
|
64
|
+
return undefined;
|
|
65
|
+
return { owner: match[1], repo: match[2] };
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** Parse `--repo owner/repo` or `--repo https://github.com/owner/repo`. */
|
|
72
|
+
function parseRepoFlag(value) {
|
|
73
|
+
const direct = value.match(/^([^/\s]+)\/([^/\s]+?)(?:\.git)?$/);
|
|
74
|
+
if (direct)
|
|
75
|
+
return { owner: direct[1], repo: direct[2] };
|
|
76
|
+
const url = value.match(/github\.com[:/]([^/]+)\/([^/.]+?)(?:\.git)?\s*$/i);
|
|
77
|
+
if (url)
|
|
78
|
+
return { owner: url[1], repo: url[2] };
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Return all stage names declared under `definition.envs`. Only
|
|
83
|
+
* non-empty string keys are returned, so the defaults a project ships
|
|
84
|
+
* but hasn't declared (e.g. `stage` when the user only has
|
|
85
|
+
* `dev`/`prod`) stay out of the trust policy.
|
|
86
|
+
*/
|
|
87
|
+
async function detectStagesFromConfig(projectDir) {
|
|
88
|
+
try {
|
|
89
|
+
const cfg = await loadVentureConfig(projectDir);
|
|
90
|
+
const envs = cfg.definition?.envs ?? {};
|
|
91
|
+
return Object.keys(envs).filter((k) => typeof k === 'string' && k.length > 0);
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// ── Policy builders ───────────────────────────────────────────────
|
|
98
|
+
/**
|
|
99
|
+
* Trust policy that lets GitHub Actions workflows in this repo
|
|
100
|
+
* assume the deploy role. Each stage contributes two `sub` patterns:
|
|
101
|
+
*
|
|
102
|
+
* - `ref:refs/heads/<stage>` — ordinary push-triggered jobs
|
|
103
|
+
* - `environment:<stage>` — jobs bound to a GitHub environment
|
|
104
|
+
*
|
|
105
|
+
* Both are necessary because GH environment-gated jobs mint tokens
|
|
106
|
+
* whose `sub` claim uses the `environment:` form, not `ref:`.
|
|
107
|
+
*/
|
|
108
|
+
function buildTrustPolicy(providerArn, repo, stages) {
|
|
109
|
+
const subs = [];
|
|
110
|
+
for (const stage of stages) {
|
|
111
|
+
subs.push(`repo:${repo.owner}/${repo.repo}:ref:refs/heads/${stage}`);
|
|
112
|
+
subs.push(`repo:${repo.owner}/${repo.repo}:environment:${stage}`);
|
|
113
|
+
}
|
|
114
|
+
// Always accept the `main` branch too — even projects without a
|
|
115
|
+
// `main` stage often push tags or manually trigger from `main`.
|
|
116
|
+
if (!subs.some((s) => s.endsWith(':ref:refs/heads/main'))) {
|
|
117
|
+
subs.push(`repo:${repo.owner}/${repo.repo}:ref:refs/heads/main`);
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
Version: '2012-10-17',
|
|
121
|
+
Statement: [{
|
|
122
|
+
Effect: 'Allow',
|
|
123
|
+
Principal: { Federated: providerArn },
|
|
124
|
+
Action: 'sts:AssumeRoleWithWebIdentity',
|
|
125
|
+
Condition: {
|
|
126
|
+
StringEquals: { 'token.actions.githubusercontent.com:aud': OIDC_AUDIENCE },
|
|
127
|
+
StringLike: { 'token.actions.githubusercontent.com:sub': subs },
|
|
128
|
+
},
|
|
129
|
+
}],
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Scoped permissions policy for `vk deploy`. Covers every AWS service
|
|
134
|
+
* VentureKit's CDK stack provisions today, plus the IAM surface CDK
|
|
135
|
+
* itself needs (create/update execution roles, pass them to CFN).
|
|
136
|
+
*
|
|
137
|
+
* Compared to `AdministratorAccess`: this role can't touch billing,
|
|
138
|
+
* Organizations, or IAM users — which is the blast-radius most
|
|
139
|
+
* SRE teams care about reducing first.
|
|
140
|
+
*/
|
|
141
|
+
function buildScopedPolicy() {
|
|
142
|
+
return {
|
|
143
|
+
Version: '2012-10-17',
|
|
144
|
+
Statement: [
|
|
145
|
+
{
|
|
146
|
+
Sid: 'VentureKitDeployServices',
|
|
147
|
+
Effect: 'Allow',
|
|
148
|
+
Action: [
|
|
149
|
+
// CDK / CloudFormation orchestration
|
|
150
|
+
'cloudformation:*',
|
|
151
|
+
'sts:GetCallerIdentity',
|
|
152
|
+
'sts:AssumeRole',
|
|
153
|
+
'tag:*',
|
|
154
|
+
// Compute + API
|
|
155
|
+
'lambda:*',
|
|
156
|
+
'apigateway:*',
|
|
157
|
+
'ec2:*',
|
|
158
|
+
// Data stores
|
|
159
|
+
'rds:*',
|
|
160
|
+
's3:*',
|
|
161
|
+
'dynamodb:*',
|
|
162
|
+
'elasticache:*',
|
|
163
|
+
// Messaging + events
|
|
164
|
+
'sqs:*',
|
|
165
|
+
'sns:*',
|
|
166
|
+
'events:*',
|
|
167
|
+
// Auth + secrets
|
|
168
|
+
'cognito-idp:*',
|
|
169
|
+
'secretsmanager:*',
|
|
170
|
+
'ssm:*',
|
|
171
|
+
'kms:*',
|
|
172
|
+
// Observability
|
|
173
|
+
'logs:*',
|
|
174
|
+
'cloudwatch:*',
|
|
175
|
+
'xray:*',
|
|
176
|
+
// Migration runner
|
|
177
|
+
'codebuild:*',
|
|
178
|
+
// Custom domains
|
|
179
|
+
'acm:*',
|
|
180
|
+
'route53:*',
|
|
181
|
+
],
|
|
182
|
+
Resource: '*',
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
// IAM operations — CDK creates Lambda execution roles etc.
|
|
186
|
+
// Path-bounded so this role can't craft, say, a billing-admin role.
|
|
187
|
+
Sid: 'VentureKitManageRoles',
|
|
188
|
+
Effect: 'Allow',
|
|
189
|
+
Action: [
|
|
190
|
+
'iam:CreateRole',
|
|
191
|
+
'iam:DeleteRole',
|
|
192
|
+
'iam:GetRole',
|
|
193
|
+
'iam:ListRoles',
|
|
194
|
+
'iam:TagRole',
|
|
195
|
+
'iam:UntagRole',
|
|
196
|
+
'iam:UpdateRole',
|
|
197
|
+
'iam:UpdateAssumeRolePolicy',
|
|
198
|
+
'iam:AttachRolePolicy',
|
|
199
|
+
'iam:DetachRolePolicy',
|
|
200
|
+
'iam:PutRolePolicy',
|
|
201
|
+
'iam:DeleteRolePolicy',
|
|
202
|
+
'iam:GetRolePolicy',
|
|
203
|
+
'iam:ListRolePolicies',
|
|
204
|
+
'iam:ListAttachedRolePolicies',
|
|
205
|
+
'iam:CreateServiceLinkedRole',
|
|
206
|
+
],
|
|
207
|
+
Resource: '*',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
// iam:PassRole is the risky one — limit it to roles CDK
|
|
211
|
+
// itself creates (cdk-*) plus VentureKit-managed (venturekit-*).
|
|
212
|
+
// Users can widen this later if they integrate custom roles.
|
|
213
|
+
Sid: 'VentureKitPassRole',
|
|
214
|
+
Effect: 'Allow',
|
|
215
|
+
Action: 'iam:PassRole',
|
|
216
|
+
Resource: [
|
|
217
|
+
'arn:aws:iam::*:role/cdk-*',
|
|
218
|
+
'arn:aws:iam::*:role/venturekit-*',
|
|
219
|
+
'arn:aws:iam::*:role/*-ServiceRole-*',
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
// ── `vk gha bootstrap` ────────────────────────────────────────────
|
|
226
|
+
/**
|
|
227
|
+
* Ensure the GitHub OIDC provider exists account-wide and return its ARN.
|
|
228
|
+
* Idempotent — never creates a duplicate even if called many times.
|
|
229
|
+
*/
|
|
230
|
+
async function ensureOidcProvider(iam, accountId) {
|
|
231
|
+
const list = await iam.send(new iam.__cmds.ListOpenIDConnectProvidersCommand({}));
|
|
232
|
+
const existing = (list.OpenIDConnectProviderList ?? []).find((p) => typeof p.Arn === 'string' && p.Arn.endsWith('/token.actions.githubusercontent.com'));
|
|
233
|
+
if (existing)
|
|
234
|
+
return existing.Arn;
|
|
235
|
+
const created = await iam.send(new iam.__cmds.CreateOpenIDConnectProviderCommand({
|
|
236
|
+
Url: OIDC_URL,
|
|
237
|
+
ClientIDList: [OIDC_AUDIENCE],
|
|
238
|
+
ThumbprintList: [OIDC_THUMBPRINT],
|
|
239
|
+
}));
|
|
240
|
+
if (!created.OpenIDConnectProviderArn) {
|
|
241
|
+
throw new Error('IAM did not return an OIDC provider ARN.');
|
|
242
|
+
}
|
|
243
|
+
return created.OpenIDConnectProviderArn;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Create or update the deploy role. Returns the role ARN.
|
|
247
|
+
*
|
|
248
|
+
* Flow:
|
|
249
|
+
* 1. Try CreateRole; on EntityAlreadyExists, call UpdateAssumeRolePolicy
|
|
250
|
+
* to refresh the trust policy (stages may have changed).
|
|
251
|
+
* 2. Detach any `venturekit-deploy-scoped` inline policy or
|
|
252
|
+
* AdministratorAccess managed policy, so mode-switches (admin ↔
|
|
253
|
+
* scoped) don't pile up attachments.
|
|
254
|
+
* 3. Attach whichever mode the caller asked for.
|
|
255
|
+
*/
|
|
256
|
+
async function createOrUpdateRole(iam, roleName, trustPolicy, scoped) {
|
|
257
|
+
const policyDocument = JSON.stringify(trustPolicy);
|
|
258
|
+
try {
|
|
259
|
+
await iam.send(new iam.__cmds.CreateRoleCommand({
|
|
260
|
+
RoleName: roleName,
|
|
261
|
+
AssumeRolePolicyDocument: policyDocument,
|
|
262
|
+
Description: 'VentureKit GitHub Actions deploy role — managed by `vk gha bootstrap`.',
|
|
263
|
+
MaxSessionDuration: 3600,
|
|
264
|
+
Tags: [
|
|
265
|
+
{ Key: 'ManagedBy', Value: 'venturekit' },
|
|
266
|
+
{ Key: 'vk:purpose', Value: 'gha-deploy' },
|
|
267
|
+
],
|
|
268
|
+
}));
|
|
269
|
+
}
|
|
270
|
+
catch (err) {
|
|
271
|
+
const code = err?.name || err?.Code;
|
|
272
|
+
if (code === 'EntityAlreadyExistsException' || code === 'EntityAlreadyExists') {
|
|
273
|
+
await iam.send(new iam.__cmds.UpdateAssumeRolePolicyCommand({
|
|
274
|
+
RoleName: roleName,
|
|
275
|
+
PolicyDocument: policyDocument,
|
|
276
|
+
}));
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
throw err;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
// Tidy up any previous attachment so switching --admin ↔ --scoped
|
|
283
|
+
// leaves a single effective policy on the role. Ignore Not-Found
|
|
284
|
+
// errors — an ungated DetachRolePolicy / DeleteRolePolicy throws
|
|
285
|
+
// NoSuchEntity when the attachment we're trying to remove isn't
|
|
286
|
+
// there, which is exactly the "already tidy" case.
|
|
287
|
+
const tidy = async (fn) => {
|
|
288
|
+
try {
|
|
289
|
+
await fn();
|
|
290
|
+
}
|
|
291
|
+
catch (err) {
|
|
292
|
+
const code = err?.name || err?.Code;
|
|
293
|
+
if (code !== 'NoSuchEntityException' && code !== 'NoSuchEntity')
|
|
294
|
+
throw err;
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
await tidy(() => iam.send(new iam.__cmds.DeleteRolePolicyCommand({
|
|
298
|
+
RoleName: roleName,
|
|
299
|
+
PolicyName: 'venturekit-deploy-scoped',
|
|
300
|
+
})));
|
|
301
|
+
await tidy(() => iam.send(new iam.__cmds.DetachRolePolicyCommand({
|
|
302
|
+
RoleName: roleName,
|
|
303
|
+
PolicyArn: 'arn:aws:iam::aws:policy/AdministratorAccess',
|
|
304
|
+
})));
|
|
305
|
+
if (scoped) {
|
|
306
|
+
await iam.send(new iam.__cmds.PutRolePolicyCommand({
|
|
307
|
+
RoleName: roleName,
|
|
308
|
+
PolicyName: 'venturekit-deploy-scoped',
|
|
309
|
+
PolicyDocument: JSON.stringify(buildScopedPolicy()),
|
|
310
|
+
}));
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
await iam.send(new iam.__cmds.AttachRolePolicyCommand({
|
|
314
|
+
RoleName: roleName,
|
|
315
|
+
PolicyArn: 'arn:aws:iam::aws:policy/AdministratorAccess',
|
|
316
|
+
}));
|
|
317
|
+
}
|
|
318
|
+
const got = await iam.send(new iam.__cmds.GetRoleCommand({ RoleName: roleName }));
|
|
319
|
+
if (!got.Role?.Arn)
|
|
320
|
+
throw new Error(`IAM did not return an ARN for role ${roleName}.`);
|
|
321
|
+
return got.Role.Arn;
|
|
322
|
+
}
|
|
323
|
+
// ── `vk gha workflow` ─────────────────────────────────────────────
|
|
324
|
+
/**
|
|
325
|
+
* Parse repeatable `--branch <branch>=<stage>` flags. Missing or
|
|
326
|
+
* malformed entries are silently dropped — the command falls back to
|
|
327
|
+
* the identity mapping (branch name == stage name) with the special
|
|
328
|
+
* `main → <prod-stage>` override handled separately.
|
|
329
|
+
*/
|
|
330
|
+
function parseBranchMap(entries) {
|
|
331
|
+
const out = {};
|
|
332
|
+
for (const entry of entries ?? []) {
|
|
333
|
+
const m = entry.match(/^([^=\s]+)\s*=\s*([^=\s]+)$/);
|
|
334
|
+
if (m)
|
|
335
|
+
out[m[1]] = m[2];
|
|
336
|
+
}
|
|
337
|
+
return out;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Work out the effective branch → stage mapping for the workflow.
|
|
341
|
+
*
|
|
342
|
+
* Precedence:
|
|
343
|
+
* 1. Explicit `--branch` flags (`dev=preview`).
|
|
344
|
+
* 2. `main` branch always maps to the user-declared prod stage
|
|
345
|
+
* (`--prod-stage` or, by default, the stage literally named
|
|
346
|
+
* `prod` if present).
|
|
347
|
+
* 3. Identity mapping: every other stage assumes its branch has
|
|
348
|
+
* the same name.
|
|
349
|
+
*
|
|
350
|
+
* The result drives both the `on.push.branches` trigger list and the
|
|
351
|
+
* case/esac in the resolve-stage step.
|
|
352
|
+
*/
|
|
353
|
+
function resolveBranchMapping(stages, explicit, prodStage) {
|
|
354
|
+
const map = {};
|
|
355
|
+
for (const stage of stages) {
|
|
356
|
+
if (stage === prodStage)
|
|
357
|
+
continue; // handled by `main` below
|
|
358
|
+
map[stage] = stage;
|
|
359
|
+
}
|
|
360
|
+
if (prodStage && stages.includes(prodStage)) {
|
|
361
|
+
map['main'] = prodStage;
|
|
362
|
+
}
|
|
363
|
+
// Explicit overrides win.
|
|
364
|
+
for (const [branch, stage] of Object.entries(explicit)) {
|
|
365
|
+
map[branch] = stage;
|
|
366
|
+
}
|
|
367
|
+
return map;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Build the .github/workflows/deploy.yml contents.
|
|
371
|
+
*
|
|
372
|
+
* We emit YAML as a plain string because pulling in a YAML library
|
|
373
|
+
* for one output file is overkill and the schema is stable. The
|
|
374
|
+
* output is pinned to GitHub-hosted runner versions we know work
|
|
375
|
+
* with VentureKit's CDK synth (Node 20, pnpm 9).
|
|
376
|
+
*/
|
|
377
|
+
function buildWorkflowYaml(args) {
|
|
378
|
+
const { projectName, region, stages, branchToStage, prodStage } = args;
|
|
379
|
+
const branches = Object.keys(branchToStage);
|
|
380
|
+
const branchesYaml = branches.length > 0
|
|
381
|
+
? `[${branches.map((b) => JSON.stringify(b)).join(', ')}]`
|
|
382
|
+
: '[main]';
|
|
383
|
+
const choiceStages = [...new Set([
|
|
384
|
+
...stages,
|
|
385
|
+
...Object.values(branchToStage),
|
|
386
|
+
])];
|
|
387
|
+
const choicesYaml = `[${choiceStages.map((s) => JSON.stringify(s)).join(', ')}]`;
|
|
388
|
+
const defaultStage = prodStage && !choiceStages.includes(prodStage)
|
|
389
|
+
? choiceStages[0]
|
|
390
|
+
: (choiceStages[0] ?? 'dev');
|
|
391
|
+
// `case/esac` in the resolve-stage step: one branch → one stage.
|
|
392
|
+
const caseArms = Object.entries(branchToStage)
|
|
393
|
+
.map(([branch, stage]) => ` ${branch}) stage=${stage} ;;`)
|
|
394
|
+
.join('\n');
|
|
395
|
+
// Environment name in the job header mirrors the case/esac so
|
|
396
|
+
// required reviewers on prod environments actually gate the job.
|
|
397
|
+
const envExpr = [
|
|
398
|
+
'${{',
|
|
399
|
+
'(github.event.inputs.stage)',
|
|
400
|
+
...Object.entries(branchToStage).map(([branch, stage]) => `|| (github.ref_name == '${branch}' && '${stage}')`),
|
|
401
|
+
`|| '${defaultStage}'`,
|
|
402
|
+
'}}',
|
|
403
|
+
].join(' ');
|
|
404
|
+
return `# Generated by \`vk gha workflow\` — edit if you need custom steps,
|
|
405
|
+
# but re-running the command will overwrite this file unless you
|
|
406
|
+
# pass --no-force. Commit the file so GitHub Actions can find it.
|
|
407
|
+
name: deploy
|
|
408
|
+
|
|
409
|
+
on:
|
|
410
|
+
push:
|
|
411
|
+
branches: ${branchesYaml}
|
|
412
|
+
workflow_dispatch:
|
|
413
|
+
inputs:
|
|
414
|
+
stage:
|
|
415
|
+
description: Stage to deploy
|
|
416
|
+
required: true
|
|
417
|
+
default: ${JSON.stringify(defaultStage)}
|
|
418
|
+
type: choice
|
|
419
|
+
options: ${choicesYaml}
|
|
420
|
+
|
|
421
|
+
# Serialize deploys per stage so concurrent pushes don't race on the
|
|
422
|
+
# CloudFormation stack. VentureKit's in-VPC migration CodeBuild
|
|
423
|
+
# project has its own concurrent-build limit of 1, so this is belt-
|
|
424
|
+
# and-braces but cheap.
|
|
425
|
+
concurrency:
|
|
426
|
+
group: deploy-\${{ github.event.inputs.stage || github.ref_name }}
|
|
427
|
+
cancel-in-progress: false
|
|
428
|
+
|
|
429
|
+
jobs:
|
|
430
|
+
deploy:
|
|
431
|
+
name: deploy
|
|
432
|
+
runs-on: ubuntu-latest
|
|
433
|
+
|
|
434
|
+
# OIDC federation into AWS. The role ARN comes from a repo secret
|
|
435
|
+
# that \`vk gha bootstrap\` tells you to create.
|
|
436
|
+
permissions:
|
|
437
|
+
id-token: write
|
|
438
|
+
contents: read
|
|
439
|
+
|
|
440
|
+
environment:
|
|
441
|
+
name: ${envExpr}
|
|
442
|
+
|
|
443
|
+
steps:
|
|
444
|
+
- uses: actions/checkout@v4
|
|
445
|
+
|
|
446
|
+
- uses: pnpm/action-setup@v4
|
|
447
|
+
with:
|
|
448
|
+
version: 9
|
|
449
|
+
|
|
450
|
+
- uses: actions/setup-node@v4
|
|
451
|
+
with:
|
|
452
|
+
node-version: '20'
|
|
453
|
+
cache: pnpm
|
|
454
|
+
|
|
455
|
+
- name: Resolve target stage
|
|
456
|
+
id: stage
|
|
457
|
+
run: |
|
|
458
|
+
if [[ -n "\${{ github.event.inputs.stage }}" ]]; then
|
|
459
|
+
stage="\${{ github.event.inputs.stage }}"
|
|
460
|
+
else
|
|
461
|
+
case "\${{ github.ref_name }}" in
|
|
462
|
+
${caseArms}
|
|
463
|
+
*) stage="${defaultStage}" ;;
|
|
464
|
+
esac
|
|
465
|
+
fi
|
|
466
|
+
echo "stage=$stage" >> "$GITHUB_OUTPUT"
|
|
467
|
+
|
|
468
|
+
- uses: aws-actions/configure-aws-credentials@v4
|
|
469
|
+
with:
|
|
470
|
+
role-to-assume: \${{ secrets.AWS_DEPLOY_ROLE_ARN }}
|
|
471
|
+
aws-region: ${region}
|
|
472
|
+
role-session-name: gha-${projectName}-\${{ steps.stage.outputs.stage }}
|
|
473
|
+
|
|
474
|
+
- run: pnpm install --frozen-lockfile
|
|
475
|
+
|
|
476
|
+
# Typecheck + tests are best-effort so deploys aren't blocked on
|
|
477
|
+
# peripheral issues (e.g. flaky snapshot tests). Remove the
|
|
478
|
+
# \`|| true\` suffix on the lines below if you want hard gates.
|
|
479
|
+
- run: pnpm run typecheck --if-present || true
|
|
480
|
+
- run: pnpm test --if-present || true
|
|
481
|
+
|
|
482
|
+
- name: Deploy
|
|
483
|
+
run: pnpm exec vk deploy --stage \${{ steps.stage.outputs.stage }}
|
|
484
|
+
`;
|
|
485
|
+
}
|
|
486
|
+
// ── Command wiring ────────────────────────────────────────────────
|
|
487
|
+
export function ghaCommand(program) {
|
|
488
|
+
const gha = program
|
|
489
|
+
.command('gha')
|
|
490
|
+
.description('GitHub Actions plumbing for VentureKit (OIDC role, workflow template)');
|
|
491
|
+
// ---- vk gha bootstrap ----
|
|
492
|
+
gha
|
|
493
|
+
.command('bootstrap')
|
|
494
|
+
.description('Provision the GitHub OIDC provider + IAM deploy role for this repo')
|
|
495
|
+
.option('--repo <owner/repo>', 'GitHub repository (auto-detected from `git remote origin`)')
|
|
496
|
+
.option('--role <name>', 'IAM role name', DEFAULT_ROLE_NAME)
|
|
497
|
+
.option('--stages <list>', 'Comma-separated stages (auto-detected from vk.config.ts)')
|
|
498
|
+
.option('--region <region>', 'AWS region for STS + IAM calls (default: us-east-1 — IAM is global)', 'us-east-1')
|
|
499
|
+
.option('--admin', 'Attach AdministratorAccess (default, pragmatic)')
|
|
500
|
+
.option('--scoped', 'Attach a scoped inline policy instead of AdministratorAccess')
|
|
501
|
+
.action(async (options) => {
|
|
502
|
+
const projectDir = process.cwd();
|
|
503
|
+
// Repo — flag first, then git remote.
|
|
504
|
+
let repo;
|
|
505
|
+
if (options.repo) {
|
|
506
|
+
repo = parseRepoFlag(options.repo);
|
|
507
|
+
if (!repo) {
|
|
508
|
+
console.log(chalk.red(`\n✗ --repo "${options.repo}" is not a valid GitHub owner/repo.\n`));
|
|
509
|
+
process.exit(1);
|
|
510
|
+
return; // unreachable, satisfies TS narrowing on repo below
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
repo = detectRepoFromGit(projectDir);
|
|
515
|
+
if (!repo) {
|
|
516
|
+
console.log(chalk.red('\n✗ Could not detect GitHub repo from `git remote origin`.\n'));
|
|
517
|
+
console.log(chalk.gray(' Pass --repo <owner>/<repo> explicitly.\n'));
|
|
518
|
+
process.exit(1);
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
// Stages — flag first, then vk.config.ts.
|
|
523
|
+
let stages = [];
|
|
524
|
+
if (options.stages) {
|
|
525
|
+
stages = options.stages.split(',').map((s) => s.trim()).filter(Boolean);
|
|
526
|
+
}
|
|
527
|
+
else {
|
|
528
|
+
stages = await detectStagesFromConfig(projectDir);
|
|
529
|
+
}
|
|
530
|
+
if (stages.length === 0) {
|
|
531
|
+
console.log(chalk.yellow('\n⚠ No stages detected. Defaulting to [dev, prod].\n' +
|
|
532
|
+
' Pass --stages to override, e.g. --stages preview,prod\n'));
|
|
533
|
+
stages = ['dev', 'prod'];
|
|
534
|
+
}
|
|
535
|
+
// --scoped overrides the default unless --admin is explicit.
|
|
536
|
+
const useScoped = options.scoped === true && options.admin !== true;
|
|
537
|
+
console.log(chalk.blue(`\n🔧 Bootstrapping GitHub Actions deploy role\n`));
|
|
538
|
+
console.log(chalk.gray(` Repo: ${repo.owner}/${repo.repo}`));
|
|
539
|
+
console.log(chalk.gray(` Stages: ${stages.join(', ')}`));
|
|
540
|
+
console.log(chalk.gray(` Role: ${options.role ?? DEFAULT_ROLE_NAME}`));
|
|
541
|
+
console.log(chalk.gray(` Policy: ${useScoped ? 'scoped (venturekit-deploy-scoped)' : 'AdministratorAccess'}\n`));
|
|
542
|
+
// Lazy-load SDKs so CLI startup stays fast for users who don't
|
|
543
|
+
// hit this command. Both clients are hard deps on the CLI, so
|
|
544
|
+
// the import never fails in a real install.
|
|
545
|
+
const iamMod = await import('@aws-sdk/client-iam');
|
|
546
|
+
const stsMod = await import('@aws-sdk/client-sts');
|
|
547
|
+
const iam = new iamMod.IAMClient({ region: options.region });
|
|
548
|
+
iam.__cmds = iamMod;
|
|
549
|
+
const sts = new stsMod.STSClient({ region: options.region });
|
|
550
|
+
// We need the account ID to surface clean error messages only
|
|
551
|
+
// — all IAM calls are account-scoped implicitly.
|
|
552
|
+
const whoami = await sts.send(new stsMod.GetCallerIdentityCommand({}));
|
|
553
|
+
const accountId = whoami.Account ?? 'unknown';
|
|
554
|
+
const providerSpinner = ora('Ensuring GitHub OIDC provider exists...').start();
|
|
555
|
+
let providerArn = '';
|
|
556
|
+
try {
|
|
557
|
+
providerArn = await ensureOidcProvider(iam, accountId);
|
|
558
|
+
providerSpinner.succeed(`OIDC provider ready: ${providerArn}`);
|
|
559
|
+
}
|
|
560
|
+
catch (err) {
|
|
561
|
+
providerSpinner.fail('Could not provision OIDC provider.');
|
|
562
|
+
console.error(chalk.red(` ${err instanceof Error ? err.message : err}`));
|
|
563
|
+
process.exit(1);
|
|
564
|
+
return; // unreachable, satisfies TS definite-assignment on providerArn
|
|
565
|
+
}
|
|
566
|
+
const roleName = options.role ?? DEFAULT_ROLE_NAME;
|
|
567
|
+
const roleSpinner = ora(`Creating / updating role ${roleName}...`).start();
|
|
568
|
+
let roleArn = '';
|
|
569
|
+
try {
|
|
570
|
+
const trust = buildTrustPolicy(providerArn, repo, stages);
|
|
571
|
+
roleArn = await createOrUpdateRole(iam, roleName, trust, useScoped);
|
|
572
|
+
roleSpinner.succeed(`Role ready: ${roleArn}`);
|
|
573
|
+
}
|
|
574
|
+
catch (err) {
|
|
575
|
+
roleSpinner.fail('Could not create or update the deploy role.');
|
|
576
|
+
console.error(chalk.red(` ${err instanceof Error ? err.message : err}`));
|
|
577
|
+
process.exit(1);
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
console.log(chalk.green('\n✅ GitHub Actions deploy role provisioned\n'));
|
|
581
|
+
console.log(' Next steps:\n');
|
|
582
|
+
console.log(' 1. Copy the ARN below into a GitHub repo secret named');
|
|
583
|
+
console.log(chalk.cyan(' AWS_DEPLOY_ROLE_ARN'));
|
|
584
|
+
console.log(' at Settings → Secrets and variables → Actions → New repository secret.\n');
|
|
585
|
+
console.log(' 2. If you haven\'t yet, run ' + chalk.cyan('vk gha workflow') + ' to generate');
|
|
586
|
+
console.log(' the matching ' + chalk.gray('.github/workflows/deploy.yml') + ' .\n');
|
|
587
|
+
console.log(chalk.cyan(` Role ARN: ${roleArn}\n`));
|
|
588
|
+
if (useScoped) {
|
|
589
|
+
console.log(chalk.gray(' Scoped policy notes:\n' +
|
|
590
|
+
' - iam:PassRole is restricted to cdk-*, venturekit-*, and *-ServiceRole-*.\n' +
|
|
591
|
+
' If your project integrates roles outside those names, re-run with --admin\n' +
|
|
592
|
+
' or edit the inline policy manually in the IAM console.\n'));
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
// ---- vk gha workflow ----
|
|
596
|
+
gha
|
|
597
|
+
.command('workflow')
|
|
598
|
+
.description('Generate .github/workflows/deploy.yml from vk.config.ts')
|
|
599
|
+
.option('-p, --path <file>', 'Output path', '.github/workflows/deploy.yml')
|
|
600
|
+
.option('--branch <branch=stage...>', 'Explicit branch→stage mapping (repeatable)')
|
|
601
|
+
.option('--prod-stage <name>', 'Stage name that `main` branch should map to', 'prod')
|
|
602
|
+
.option('--force', 'Overwrite existing workflow file')
|
|
603
|
+
.action(async (options) => {
|
|
604
|
+
const projectDir = process.cwd();
|
|
605
|
+
const cfg = await loadVentureConfig(projectDir).catch(() => undefined);
|
|
606
|
+
if (!cfg) {
|
|
607
|
+
console.log(chalk.red('\n✗ No vk.config.ts found in this directory.\n'));
|
|
608
|
+
process.exit(1);
|
|
609
|
+
return; // unreachable, satisfies TS narrowing on `cfg` below
|
|
610
|
+
}
|
|
611
|
+
const stages = await detectStagesFromConfig(projectDir);
|
|
612
|
+
if (stages.length === 0) {
|
|
613
|
+
console.log(chalk.red('\n✗ No stages declared in vk.config.ts `envs`.\n'));
|
|
614
|
+
process.exit(1);
|
|
615
|
+
}
|
|
616
|
+
const prodStage = stages.includes(options.prodStage ?? 'prod')
|
|
617
|
+
? (options.prodStage ?? 'prod')
|
|
618
|
+
: undefined;
|
|
619
|
+
const explicit = parseBranchMap(options.branch);
|
|
620
|
+
const mapping = resolveBranchMapping(stages, explicit, prodStage);
|
|
621
|
+
const yaml = buildWorkflowYaml({
|
|
622
|
+
projectName: cfg.name,
|
|
623
|
+
region: cfg.region,
|
|
624
|
+
stages,
|
|
625
|
+
branchToStage: mapping,
|
|
626
|
+
prodStage,
|
|
627
|
+
});
|
|
628
|
+
const outPath = join(projectDir, options.path ?? '.github/workflows/deploy.yml');
|
|
629
|
+
if (existsSync(outPath) && !options.force) {
|
|
630
|
+
console.log(chalk.yellow(`\n⚠ ${options.path} already exists. Re-run with --force to overwrite.\n`));
|
|
631
|
+
process.exit(1);
|
|
632
|
+
}
|
|
633
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
634
|
+
writeFileSync(outPath, yaml, 'utf-8');
|
|
635
|
+
console.log(chalk.green(`\n✓ Wrote ${options.path}\n`));
|
|
636
|
+
console.log(chalk.gray(' Branch → stage mapping:'));
|
|
637
|
+
for (const [branch, stage] of Object.entries(mapping)) {
|
|
638
|
+
console.log(chalk.gray(` ${branch.padEnd(12)} → ${stage}`));
|
|
639
|
+
}
|
|
640
|
+
console.log(chalk.gray('\n If this doesn\'t match your flow, re-run with\n' +
|
|
641
|
+
' --branch <branch>=<stage> --force\n' +
|
|
642
|
+
' (repeatable) to override.\n'));
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
//# sourceMappingURL=gha.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gha.js","sourceRoot":"","sources":["../../src/commands/gha.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,qEAAqE;AAErE,+DAA+D;AAC/D,MAAM,QAAQ,GAAG,6CAA6C,CAAC;AAE/D,sEAAsE;AACtE,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAE1C;;;;GAIG;AACH,MAAM,eAAe,GAAG,0CAA0C,CAAC;AAEnE,8EAA8E;AAC9E,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAyBlD,qEAAqE;AAErE;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,UAAkB;IAC3C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,QAAQ,CAAC,2BAA2B,EAAE;YAChD,GAAG,EAAE,UAAU;YACf,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE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