@smoothbricks/nx-plugin 0.7.12 → 0.7.13
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 +78 -24
- package/dist/.build-inputs.json +20 -12
- package/dist/built-output-packages.d.ts +27 -0
- package/dist/built-output-packages.d.ts.map +1 -0
- package/dist/built-output-packages.js +97 -0
- package/dist/cross-check-policy.d.ts +13 -1
- package/dist/cross-check-policy.d.ts.map +1 -1
- package/dist/cross-check-policy.js +13 -1
- package/dist/executors/bounded-exec/admission-queue.d.ts +68 -0
- package/dist/executors/bounded-exec/admission-queue.d.ts.map +1 -0
- package/dist/executors/bounded-exec/admission-queue.js +131 -0
- package/dist/executors/bounded-exec/cpu-grant.d.ts +14 -0
- package/dist/executors/bounded-exec/cpu-grant.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-grant.js +18 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts +1 -14
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +2 -49
- package/dist/executors/bounded-exec/executor.d.ts +5 -12
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +51 -154
- package/dist/executors/bounded-exec/memory-retry.d.ts +39 -0
- package/dist/executors/bounded-exec/memory-retry.d.ts.map +1 -0
- package/dist/executors/bounded-exec/memory-retry.js +33 -0
- package/dist/executors/bounded-exec/parent-grant.d.ts +43 -0
- package/dist/executors/bounded-exec/parent-grant.d.ts.map +1 -0
- package/dist/executors/bounded-exec/parent-grant.js +37 -0
- package/dist/executors/bounded-exec/peak-charge.d.ts +17 -0
- package/dist/executors/bounded-exec/peak-charge.d.ts.map +1 -0
- package/dist/executors/bounded-exec/peak-charge.js +20 -0
- package/dist/executors/bounded-exec/pool-environment.d.ts +25 -0
- package/dist/executors/bounded-exec/pool-environment.d.ts.map +1 -0
- package/dist/executors/bounded-exec/pool-environment.js +34 -0
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +1 -1
- package/dist/executors/bounded-exec/verdict.d.ts +3 -18
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +4 -25
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +62 -21
- package/dist/managed-files/ci-workflow.d.ts +29 -5
- package/dist/managed-files/ci-workflow.d.ts.map +1 -1
- package/dist/managed-files/ci-workflow.js +111 -16
- package/dist/managed-files/context.d.ts.map +1 -1
- package/dist/managed-files/context.js +1 -0
- package/dist/managed-files/files.d.ts +3 -1
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +2 -0
- package/dist/managed-files/publish-workflow.d.ts +6 -1
- package/dist/managed-files/publish-workflow.d.ts.map +1 -1
- package/dist/managed-files/publish-workflow.js +16 -11
- package/dist/owned-installation.d.ts.map +1 -1
- package/dist/owned-installation.js +48 -14
- package/dist/typecheck-route.d.ts +28 -0
- package/dist/typecheck-route.d.ts.map +1 -0
- package/dist/typecheck-route.js +109 -0
- package/dist/workspace-manifest.d.ts +50 -5
- package/dist/workspace-manifest.d.ts.map +1 -1
- package/executors.json +10 -0
- package/managed/raw/patches/ttsc@0.34.1.patch +93 -8
- package/managed/raw/tooling/direnv/apple-developer.sh +8 -1
- package/managed/raw/tooling/direnv/compiler-variables.sh +1 -1
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +4 -2
- package/managed/raw/tooling/direnv/secret-references.ts +19 -5
- package/managed/raw/tooling/git-hooks/pre-push.sh +20 -10
- package/managed/templates/github/actions/forgejo-artifact.cjs +9 -9
- package/managed/templates/github/actions/setup-devenv/action.yml +53 -0
- package/package.json +2 -2
- package/src/built-output-packages.ts +125 -0
- package/src/cross-check-policy.ts +14 -1
- package/src/executors/bounded-exec/admission-queue.ts +163 -0
- package/src/executors/bounded-exec/cpu-grant.ts +32 -0
- package/src/executors/bounded-exec/cpu-pool.ts +2 -33
- package/src/executors/bounded-exec/executor.ts +60 -201
- package/src/executors/bounded-exec/memory-retry.ts +63 -0
- package/src/executors/bounded-exec/parent-grant.ts +75 -0
- package/src/executors/bounded-exec/peak-charge.ts +25 -0
- package/src/executors/bounded-exec/pool-environment.ts +45 -0
- package/src/executors/bounded-exec/run-cpu-pool.ts +2 -1
- package/src/executors/bounded-exec/verdict.ts +7 -35
- package/src/index.ts +70 -21
- package/src/managed-files/ci-workflow.ts +143 -16
- package/src/managed-files/context.ts +1 -0
- package/src/managed-files/files.ts +5 -0
- package/src/managed-files/publish-workflow.ts +26 -10
- package/src/owned-installation.ts +63 -14
- package/src/typecheck-route.ts +64 -0
- package/src/workspace-manifest.ts +56 -5
- package/test-timings.json +141 -139
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CpuGrantRecord } from './cpu-grant.js';
|
|
1
2
|
import type { CpuWaitRow } from './lease-wait.js';
|
|
2
3
|
import { type LockWait } from './lock-wait.js';
|
|
3
4
|
import type { MbxQueuedRequest } from './mbx-queue.js';
|
|
@@ -91,14 +92,10 @@ export interface BoundedExecRecord {
|
|
|
91
92
|
/**
|
|
92
93
|
* The parent CPU pool's grant the run started under: tokens granted of those asked for, and
|
|
93
94
|
* how long it waited for the pool. Absent when it ran ungranted. Its tokens are the parallelism the run's
|
|
94
|
-
* `peakBytes` was measured under, which the task's next run reads (`readLastPeak
|
|
95
|
+
* `peakBytes` was measured under, which the task's next run reads (`readLastPeak`, peak-charge.ts) to charge that peak in proportion
|
|
95
96
|
* to the parallelism it is lent.
|
|
96
97
|
*/
|
|
97
|
-
readonly cpu?:
|
|
98
|
-
readonly tokens: number;
|
|
99
|
-
readonly want: number;
|
|
100
|
-
readonly waitedMs: number;
|
|
101
|
-
};
|
|
98
|
+
readonly cpu?: CpuGrantRecord;
|
|
102
99
|
/**
|
|
103
100
|
* The parent CPU pool's wait that expired and refused the run: its code, bound and elapsed time, the last heartbeat
|
|
104
101
|
* sequence it read, and the pool's socket and pid (specs/cowshed/05_gateway.md, "Deadlines"). Absent when no wait
|
|
@@ -231,18 +228,6 @@ export declare function clearTaskDirectory(directory: string): Promise<void>;
|
|
|
231
228
|
export declare function writeRecord(directory: string, record: BoundedExecRecord): Promise<void>;
|
|
232
229
|
/** The record in `directory`, or `null` when there is none. A malformed record throws. */
|
|
233
230
|
export declare function readRecord(directory: string): Promise<BoundedExecRecord | null>;
|
|
234
|
-
/**
|
|
235
|
-
* The peak the task's last record in `directory` names: its charge in its run's pool. Null when the task has no record
|
|
236
|
-
* or its record no peak; a record that cannot be read is an error naming it, never a charge of nothing.
|
|
237
|
-
*/
|
|
238
|
-
export declare function readLastPeak(directory: string): Promise<{
|
|
239
|
-
ok: true;
|
|
240
|
-
peakBytes: number | null;
|
|
241
|
-
parallelism: number | null;
|
|
242
|
-
} | {
|
|
243
|
-
ok: false;
|
|
244
|
-
error: string;
|
|
245
|
-
}>;
|
|
246
231
|
/** The JUnit report a command wrote into `directory`, or `null` when it wrote none. */
|
|
247
232
|
export declare function readJunitReport(directory: string, bunClosed?: (results: readonly NativeTestResult[]) => void): Promise<JunitFailures | null>;
|
|
248
233
|
/** A failed task of an Nx run, and whether its bounded-exec record shows only a bound. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verdict.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/verdict.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAmB,KAAK,QAAQ,EAAe,MAAM,gBAAgB,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,CAAC,OA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Q,EAAE,eAAe,GAAG,MAAM,CAgBjE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import typia from 'typia';
|
|
4
|
+
import { parseCpuGrant } from './cpu-grant.js';
|
|
4
5
|
import { describeHolders } from './lock-wait.js';
|
|
5
6
|
import { TEST_FAILURES_FILE, TEST_RESULTS_FILE } from './test-results.js';
|
|
6
7
|
const isQueuedVerdict = (() => {
|
|
@@ -321,22 +322,6 @@ export async function readRecord(directory) {
|
|
|
321
322
|
}
|
|
322
323
|
return parseRecord(JSON.parse(text));
|
|
323
324
|
}
|
|
324
|
-
/**
|
|
325
|
-
* The peak the task's last record in `directory` names: its charge in its run's pool. Null when the task has no record
|
|
326
|
-
* or its record no peak; a record that cannot be read is an error naming it, never a charge of nothing.
|
|
327
|
-
*/
|
|
328
|
-
export async function readLastPeak(directory) {
|
|
329
|
-
try {
|
|
330
|
-
const record = await readRecord(directory);
|
|
331
|
-
return { ok: true, peakBytes: record?.peakBytes ?? null, parallelism: record?.cpu?.tokens ?? null };
|
|
332
|
-
}
|
|
333
|
-
catch (error) {
|
|
334
|
-
return {
|
|
335
|
-
ok: false,
|
|
336
|
-
error: `the task's last record ${join(directory, VERDICT_FILE)} cannot be read: ${error instanceof Error ? error.message : String(error)}`,
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
325
|
/** The JUnit report a command wrote into `directory`, or `null` when it wrote none. */
|
|
341
326
|
export async function readJunitReport(directory, bunClosed) {
|
|
342
327
|
try {
|
|
@@ -362,21 +347,15 @@ function parseRecord(value) {
|
|
|
362
347
|
if (!(peakBytes === null || (typeof peakBytes === 'number' && Number.isSafeInteger(peakBytes) && peakBytes >= 0))) {
|
|
363
348
|
throw new Error(`not a bounded-exec record: ${JSON.stringify(value)}`);
|
|
364
349
|
}
|
|
365
|
-
const cpu = value.cpu;
|
|
366
|
-
if (cpu ===
|
|
367
|
-
return { task: value.task, hash: value.hash, verdict: parseVerdict(value.verdict), peakBytes };
|
|
368
|
-
}
|
|
369
|
-
if (!isObject(cpu) ||
|
|
370
|
-
!(typeof cpu.tokens === 'number' && Number.isSafeInteger(cpu.tokens) && cpu.tokens >= 1) ||
|
|
371
|
-
!(typeof cpu.want === 'number' && Number.isSafeInteger(cpu.want) && cpu.want >= 1) ||
|
|
372
|
-
!(typeof cpu.waitedMs === 'number' && Number.isFinite(cpu.waitedMs) && cpu.waitedMs >= 0)) {
|
|
350
|
+
const cpu = parseCpuGrant(value.cpu);
|
|
351
|
+
if (cpu === 'malformed') {
|
|
373
352
|
throw new Error(`not a bounded-exec record: ${JSON.stringify(value)}`);
|
|
374
353
|
}
|
|
375
354
|
return {
|
|
376
355
|
task: value.task,
|
|
377
356
|
hash: value.hash,
|
|
378
357
|
verdict: parseVerdict(value.verdict),
|
|
379
|
-
cpu
|
|
358
|
+
...(cpu === undefined ? {} : { cpu }),
|
|
380
359
|
peakBytes,
|
|
381
360
|
};
|
|
382
361
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -43,7 +43,10 @@ export declare const createNodesV2: CreateNodesV2;
|
|
|
43
43
|
*/
|
|
44
44
|
export declare const preTasksExecution: PreTasksExecution<ProducerReceiptsOptions>;
|
|
45
45
|
export declare const postTasksExecution: PostTasksExecution<ProducerReceiptsOptions>;
|
|
46
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* The lock-scope nodes' edges: each bun node's to the packages and members its manifest resolves; and, for a workspace
|
|
48
|
+
* that names built-output packages, the lockfile's package edges (`built-output-packages.ts`).
|
|
49
|
+
*/
|
|
47
50
|
export declare const createDependencies: CreateDependencies;
|
|
48
51
|
/** Nx invokes this only after merging inferred/declarative targets and every plugin's project dependencies. */
|
|
49
52
|
export declare const createMetadata: CreateMetadata;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAGnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAGtB,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAGnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAGtB,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAqElC,OAAO,EACL,KAAK,uBAAuB,EAG7B,MAAM,wBAAwB,CAAC;AAqBhC,gEAAgE;AAChE,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAudlD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAMtE;AA4aD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,MAAM,EACrB,qBAAqB,UAAkC,GACtD,OAAO,CAoBT;AACD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,OAAO,GACjB,MAAM,EAAE,CAKV;AA6JD,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,GAAG,aAAa,CAEvG;AAED,eAAO,MAAM,aAAa,EAAE,aAG3B,CAAC;AAeF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,uBAAuB,CAQxE,CAAC;AACF,eAAO,MAAM,kBAAkB,EAAE,kBAAkB,CAAC,uBAAuB,CAM1E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAGhC,CAAC;AAEF,+GAA+G;AAC/G,eAAO,MAAM,cAAc,EAAE,cAI5B,CAAC;;;;;;;;;AAiDF,+GAA+G;AAC/G,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,GACrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAmCxB"}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { AggregateCreateNodesError } from 'nx/src/project-graph/error-types.js';
|
|
|
9
9
|
import { parse as parseToml } from 'smol-toml';
|
|
10
10
|
import { BOUNDED_TEST_IDLE_TIMEOUT_MS, BOUNDED_TEST_KILL_AFTER_MS } from './bounded-test-policy.js';
|
|
11
11
|
import { refuseOverlappingOutputs } from './build-state-output-policy.js';
|
|
12
|
+
import { builtOutputLockfileDependencies, builtOutputLockfileNodes } from './built-output-packages.js';
|
|
12
13
|
import { bunLockDependencies, bunLockInput, bunLockNode } from './bun-lock-scope.js';
|
|
13
14
|
import { CARGO_CLOSURE_INPUT, CARGO_LOCK_NODE_PREFIX, cargoClosureInputs, cargoLockNode, cargoLockNodeName, indexedCargoManifests, isCargoLockInput, resolveCargoClosureSource, } from './cargo-closure-input.js';
|
|
14
15
|
import { CARGO_PRODUCER_METADATA, postTasksExecution as postCargoRetention } from './cargo-retention-hook.js';
|
|
@@ -30,6 +31,7 @@ import { postTasksExecution as postTaskResults, preTasksExecution as preTaskResu
|
|
|
30
31
|
import { SHARD_TIMINGS_EXECUTOR, SHARD_TIMINGS_TARGET, timingsShardedSuite, timingsSuiteInputs, } from './test-timings.js';
|
|
31
32
|
import { assertUpstreamBasePrecondition } from './test-walk-policy.js';
|
|
32
33
|
import { nativeToolCommand, nativeToolDependsOn, resolveNativeTools } from './tool-bins.js';
|
|
34
|
+
import { typecheckRoute } from './typecheck-route.js';
|
|
33
35
|
import { isBuildOutputTargetName, isTestNamespaceTargetName, isTestRunnerTargetName, RELEASE_CONFIGURATION, } from './workspace-config-policy.js';
|
|
34
36
|
import { globIndexedFiles } from './workspace-index.js';
|
|
35
37
|
/** Makes a version live and proves it answers; never cached. */
|
|
@@ -48,21 +50,35 @@ const TYPESCRIPT_PATCH_INPUTS = ['{workspaceRoot}/patches/**/*', '!{workspaceRoo
|
|
|
48
50
|
*/
|
|
49
51
|
const WORKSPACE_TSCONFIG_BASE_INPUT = '{workspaceRoot}/tsconfig.base.json';
|
|
50
52
|
/**
|
|
51
|
-
* The native compiler a typecheck runs
|
|
52
|
-
* from a pinned source revision and exports its path. The typecheck targets run it
|
|
53
|
-
* not through ttsc: ttsc auto-loads a dependency's transform plugin (typia) and then checks
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* variable: falling back would check with another compiler under the same key.
|
|
53
|
+
* The native compiler a typecheck runs unless a dependency declares a dialect (typecheck-route.ts), apart from the one
|
|
54
|
+
* emit runs: devenv.smoo.nix builds it from a pinned source revision and exports its path. The typecheck targets run it
|
|
55
|
+
* directly, not through ttsc: ttsc auto-loads a dependency's transform plugin (typia) and then checks inside that
|
|
56
|
+
* plugin's host, which links ttsc's own compiler and never runs the pinned one. Transform diagnostics stay enforced
|
|
57
|
+
* where the transform runs: for the lib program in `tsc-js`'s emit, for test files when the test runner transforms
|
|
58
|
+
* them. A test file no test executes has its types checked here but its transform calls checked nowhere. Hashed by the
|
|
59
|
+
* store path, which carries the revision, so a compiler bump misses the cache. The command refuses an unset variable:
|
|
60
|
+
* falling back would check with another compiler under the same key.
|
|
60
61
|
*/
|
|
61
62
|
const TYPECHECK_COMPILER_ENV = 'SMOO_TYPECHECK_TSC';
|
|
62
63
|
const TYPECHECK_COMPILER_INPUT = { env: TYPECHECK_COMPILER_ENV };
|
|
63
64
|
function typecheckCommand(args) {
|
|
64
65
|
return `"\${${TYPECHECK_COMPILER_ENV}:?is unset, enter the devenv shell (devenv.smoo.nix builds the typecheck compiler)}" ${args}`;
|
|
65
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* A project's typecheck targets. A project whose direct dependency declares a dialect typechecks through ttsc, whose
|
|
69
|
+
* linked plugin lowers the dialect and withdraws the checker's refusals of it; its compiler is the installed ttsc,
|
|
70
|
+
* which bun.lock and the patches in its check inputs already key, and it waits for the targets the declaring package
|
|
71
|
+
* names to prepare the plugin binaries ttsc loads. Every other project runs the pinned native compiler.
|
|
72
|
+
*/
|
|
73
|
+
function typecheckTargets(packageJsonPath, packageJson) {
|
|
74
|
+
const route = typecheckRoute(packageJsonPath, [
|
|
75
|
+
...Object.keys(packageJson.dependencies ?? {}),
|
|
76
|
+
...Object.keys(packageJson.devDependencies ?? {}),
|
|
77
|
+
]);
|
|
78
|
+
return route.declaredBy.length === 0
|
|
79
|
+
? { command: typecheckCommand, inputs: [TYPECHECK_COMPILER_INPUT], dependsOn: [] }
|
|
80
|
+
: { command: (args) => `ttsc ${args}`, inputs: [], dependsOn: route.dependsOn };
|
|
81
|
+
}
|
|
66
82
|
/**
|
|
67
83
|
* The release-rewritten root manifest hashed by field instead of by byte, for
|
|
68
84
|
* a check that only reads it.
|
|
@@ -888,12 +904,13 @@ function supportsJsonInputs() {
|
|
|
888
904
|
return major > minimumMajor || (major === minimumMajor && minor >= minimumMinor);
|
|
889
905
|
}
|
|
890
906
|
function createNodesHandler(hostPlatform) {
|
|
891
|
-
return async (projectConfigurationFiles,
|
|
907
|
+
return async (projectConfigurationFiles, options, context) => {
|
|
892
908
|
const results = [];
|
|
893
909
|
const errors = [];
|
|
894
910
|
let cargoWorkspaces;
|
|
895
911
|
let eslint;
|
|
896
912
|
let nativeTools;
|
|
913
|
+
let lockfileNodes;
|
|
897
914
|
try {
|
|
898
915
|
cargoWorkspaces = await resolveCargoWorkspaces(projectConfigurationFiles, context.workspaceRoot, hostPlatform);
|
|
899
916
|
eslint = await eslintWorkspace(context.workspaceRoot);
|
|
@@ -901,6 +918,7 @@ function createNodesHandler(hostPlatform) {
|
|
|
901
918
|
hostPlatform === null
|
|
902
919
|
? null
|
|
903
920
|
: await resolveNativeTools(context.workspaceRoot, projectConfigurationFiles, EXECUTABLE_PLATFORM_DIRECTORY[hostPlatform.targetFamily][hostPlatform.architecture], scriptcTargetName(hostPlatform));
|
|
921
|
+
lockfileNodes = builtOutputLockfileNodes(options, context);
|
|
904
922
|
}
|
|
905
923
|
catch (error) {
|
|
906
924
|
throw new AggregateCreateNodesError([[null, error instanceof Error ? error : new Error(String(error))]], results);
|
|
@@ -927,6 +945,21 @@ function createNodesHandler(hostPlatform) {
|
|
|
927
945
|
errors.push([packageJsonPath, error instanceof Error ? error : new Error(String(error))]);
|
|
928
946
|
}
|
|
929
947
|
}));
|
|
948
|
+
// The root manifest's result carries the lockfile's package nodes, as it carries the root's lock-scope node.
|
|
949
|
+
if (Object.keys(lockfileNodes).length > 0) {
|
|
950
|
+
const rootIndex = results.findIndex(([file]) => file === 'package.json');
|
|
951
|
+
const rootResult = results[rootIndex];
|
|
952
|
+
if (rootResult === undefined) {
|
|
953
|
+
errors.push([
|
|
954
|
+
null,
|
|
955
|
+
new Error('builtOutputPackages needs a root package.json to publish the lockfile nodes on'),
|
|
956
|
+
]);
|
|
957
|
+
}
|
|
958
|
+
else {
|
|
959
|
+
const [file, result] = rootResult;
|
|
960
|
+
results[rootIndex] = [file, { ...result, externalNodes: { ...lockfileNodes, ...result.externalNodes } }];
|
|
961
|
+
}
|
|
962
|
+
}
|
|
930
963
|
if (errors.length > 0) {
|
|
931
964
|
throw new AggregateCreateNodesError(errors, results);
|
|
932
965
|
}
|
|
@@ -975,8 +1008,14 @@ export const postTasksExecution = async (options, context) => {
|
|
|
975
1008
|
await closeRunReservations(context);
|
|
976
1009
|
await postCargoRetention(options, context);
|
|
977
1010
|
};
|
|
978
|
-
/**
|
|
979
|
-
|
|
1011
|
+
/**
|
|
1012
|
+
* The lock-scope nodes' edges: each bun node's to the packages and members its manifest resolves; and, for a workspace
|
|
1013
|
+
* that names built-output packages, the lockfile's package edges (`built-output-packages.ts`).
|
|
1014
|
+
*/
|
|
1015
|
+
export const createDependencies = (options, context) => [
|
|
1016
|
+
...bunLockDependencies(context),
|
|
1017
|
+
...builtOutputLockfileDependencies(options, context),
|
|
1018
|
+
];
|
|
980
1019
|
/** Nx invokes this only after merging inferred/declarative targets and every plugin's project dependencies. */
|
|
981
1020
|
export const createMetadata = (graph, _options, context) => {
|
|
982
1021
|
refuseOverlappingOutputs(graph, context.workspaceRoot);
|
|
@@ -1233,6 +1272,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1233
1272
|
const projectRoot = dirname(packageJsonPath);
|
|
1234
1273
|
const absoluteProjectRoot = join(workspaceRoot, projectRoot);
|
|
1235
1274
|
const packageJson = await readPackageJson(join(workspaceRoot, packageJsonPath));
|
|
1275
|
+
const typecheck = typecheckTargets(join(workspaceRoot, packageJsonPath), packageJson);
|
|
1236
1276
|
const projectName = packageJson.nx?.name ?? packageJson.name;
|
|
1237
1277
|
if (typeof projectName !== 'string' || projectName.length === 0) {
|
|
1238
1278
|
throw new Error(`${packageJsonPath} must declare a non-empty package or nx project name`);
|
|
@@ -1318,13 +1358,13 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1318
1358
|
selfProduction,
|
|
1319
1359
|
dependencyProduction,
|
|
1320
1360
|
...checkInputs,
|
|
1321
|
-
|
|
1361
|
+
...typecheck.inputs,
|
|
1322
1362
|
'{projectRoot}/tsconfig.lib.json',
|
|
1323
1363
|
],
|
|
1324
1364
|
outputs: [],
|
|
1325
|
-
dependsOn: ['^*-js', ...(cargoWasmConfig ? ['cargo-wasm'] : [])],
|
|
1365
|
+
dependsOn: ['^*-js', ...(cargoWasmConfig ? ['cargo-wasm'] : []), ...typecheck.dependsOn],
|
|
1326
1366
|
options: {
|
|
1327
|
-
command:
|
|
1367
|
+
command: typecheck.command('-p tsconfig.lib.json --noEmit'),
|
|
1328
1368
|
cwd: projectRoot,
|
|
1329
1369
|
},
|
|
1330
1370
|
};
|
|
@@ -1338,12 +1378,12 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1338
1378
|
selfDefault,
|
|
1339
1379
|
dependencyProduction,
|
|
1340
1380
|
...checkInputs,
|
|
1341
|
-
|
|
1381
|
+
...typecheck.inputs,
|
|
1342
1382
|
'{projectRoot}/tsconfig.test.json',
|
|
1343
1383
|
],
|
|
1344
|
-
dependsOn: ['typecheck'],
|
|
1384
|
+
dependsOn: ['typecheck', ...typecheck.dependsOn],
|
|
1345
1385
|
options: {
|
|
1346
|
-
command:
|
|
1386
|
+
command: typecheck.command('-p tsconfig.test.json --noEmit'),
|
|
1347
1387
|
cwd: projectRoot,
|
|
1348
1388
|
},
|
|
1349
1389
|
};
|
|
@@ -1351,7 +1391,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1351
1391
|
executor: 'nx:run-commands',
|
|
1352
1392
|
continuous: true,
|
|
1353
1393
|
options: {
|
|
1354
|
-
command:
|
|
1394
|
+
command: typecheck.command('-p tsconfig.test.json --noEmit --watch'),
|
|
1355
1395
|
cwd: projectRoot,
|
|
1356
1396
|
},
|
|
1357
1397
|
};
|
|
@@ -1877,10 +1917,10 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1877
1917
|
// Test configs may resolve the package's own `./index.js` through dist, so the
|
|
1878
1918
|
// current-project declaration output is rebuilt first, not only the
|
|
1879
1919
|
// dependency-project outputs reached through typecheck.
|
|
1880
|
-
targets['typecheck-tests'].dependsOn = ['tsc-js', 'typecheck'];
|
|
1920
|
+
targets['typecheck-tests'].dependsOn = ['tsc-js', 'typecheck', ...typecheck.dependsOn];
|
|
1881
1921
|
}
|
|
1882
1922
|
else if (targets.build) {
|
|
1883
|
-
targets['typecheck-tests'].dependsOn = ['build'];
|
|
1923
|
+
targets['typecheck-tests'].dependsOn = ['build', ...typecheck.dependsOn];
|
|
1884
1924
|
}
|
|
1885
1925
|
}
|
|
1886
1926
|
// A Bun suite that `--shard` splits and a `--timings` manifest balances gets a
|
|
@@ -2400,6 +2440,7 @@ async function readPackageJson(packageJsonPath) {
|
|
|
2400
2440
|
const rawNx = isRecord(parsed.nx) ? parsed.nx : undefined;
|
|
2401
2441
|
return {
|
|
2402
2442
|
...('bin' in parsed ? { bin: parsed.bin } : {}),
|
|
2443
|
+
...(isRecord(parsed.dependencies) ? { dependencies: parsed.dependencies } : {}),
|
|
2403
2444
|
...(isRecord(parsed.devDependencies) ? { devDependencies: parsed.devDependencies } : {}),
|
|
2404
2445
|
...(typeof parsed.name === 'string' ? { name: parsed.name } : {}),
|
|
2405
2446
|
...(isRecord(parsed.napi) ? { napi: parsed.napi } : {}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NonEmptyArray, PackageCargoCredentialsConfig, PackagePrivateNpmConfig, PackageRemoteCacheConfig, PackageSmooGithub, PackageSmooGithubEnvironments, PackageSourceCheckoutConfig } from '../workspace-manifest.js';
|
|
1
|
+
import type { NonEmptyArray, PackageCargoCredentialsConfig, PackageMbxRemoteConfig, PackagePrivateNpmConfig, PackageRemoteCacheConfig, PackageSmooGithub, PackageSmooGithubEnvironments, PackageSourceCheckoutConfig } from '../workspace-manifest.js';
|
|
2
2
|
export declare const githubActionPins: Readonly<Record<'checkout' | 'nxSetShas' | 'cacheSave' | 'uploadArtifact' | 'downloadArtifact', {
|
|
3
3
|
readonly ref: string;
|
|
4
4
|
readonly version: string;
|
|
@@ -94,6 +94,11 @@ export interface CiWorkflowDefinitionOptions extends DeployStepSecretConfig {
|
|
|
94
94
|
* cache serves the whole fleet. Absent means each runner caches locally.
|
|
95
95
|
*/
|
|
96
96
|
remoteCache?: PackageRemoteCacheConfig;
|
|
97
|
+
/**
|
|
98
|
+
* Declared mbx remote cache (package.json `smoo.mbxRemote`). Every job carries mbx's remote settings, which is
|
|
99
|
+
* what makes setup-devenv route Cargo through mbx. Absent means Cargo builds without mbx.
|
|
100
|
+
*/
|
|
101
|
+
mbxRemote?: PackageMbxRemoteConfig;
|
|
97
102
|
/** GitHub Environments: staging for the validate/e2e jobs, production for the production-on-push job. */
|
|
98
103
|
environments?: PackageSmooGithubEnvironments;
|
|
99
104
|
/** Secrets for the e2e-deployment step, env var name → repository secret name. */
|
|
@@ -179,14 +184,33 @@ export declare function normalizeSourceCheckout(config: PackageSourceCheckoutCon
|
|
|
179
184
|
* fail every task on 401, which is why the job carries the same fork-PR gate
|
|
180
185
|
* as a private dependency install (see `renderCiWorkflowHeader`).
|
|
181
186
|
*
|
|
182
|
-
* A declared `internalServer` is the address
|
|
183
|
-
*
|
|
184
|
-
*
|
|
187
|
+
* A declared `internalServer` is the address the repository's own runners use, exactly as a git origin's
|
|
188
|
+
* `internalMirror` is: both say those runners sit inside that network. A job on any other runner — a GitHub-hosted
|
|
189
|
+
* one, a macOS label — sits outside it and reaches the public `server`, as a developer shell does. Each job names
|
|
190
|
+
* its reach, so no job is pointed at an address its runner cannot route to.
|
|
185
191
|
* Mechanism errors surface at managed-file render time, never inside CI.
|
|
186
192
|
*/
|
|
187
|
-
export declare function remoteCacheJobEnvLines(config: PackageRemoteCacheConfig | undefined): string;
|
|
193
|
+
export declare function remoteCacheJobEnvLines(config: PackageRemoteCacheConfig | undefined, reach: CacheReach): string;
|
|
194
|
+
/**
|
|
195
|
+
* Which origin of a declared remote cache a job reaches: `internal` for a job on the repository's own runners
|
|
196
|
+
* (`smoo.github.runsOn`), inside the network `internalServer` names; `public` for any other runner, which reaches
|
|
197
|
+
* only `server`.
|
|
198
|
+
*/
|
|
199
|
+
export type CacheReach = 'internal' | 'public';
|
|
188
200
|
/** Mechanism errors surface at managed-file render time, never inside CI. */
|
|
189
201
|
export declare function normalizeRemoteCache(config: PackageRemoteCacheConfig): PackageRemoteCacheConfig;
|
|
202
|
+
/**
|
|
203
|
+
* Job env lines carrying the declared mbx remote cache (`smoo.mbxRemote`). setup-devenv routes Cargo through mbx's
|
|
204
|
+
* Cargo shim when `MBX_REMOTE_URL` is set, so these lines are what turn mbx on for the job; `reach` picks the origin
|
|
205
|
+
* exactly as for the Nx cache. The token is chosen by lane: the write token and `MBX_REMOTE_TRUST_WRITES` on the
|
|
206
|
+
* default branch's own runs, the read-only token everywhere else. mbx's own write policy cannot make that call here:
|
|
207
|
+
* it requires `GITHUB_REF_PROTECTED`, which Forgejo Actions never sets, and it reads a release's `workflow_dispatch`
|
|
208
|
+
* as untrusted. The server's grant on the token is what stops any other job publishing.
|
|
209
|
+
* Mechanism errors surface at managed-file render time, never inside CI.
|
|
210
|
+
*/
|
|
211
|
+
export declare function mbxRemoteJobEnvLines(config: PackageMbxRemoteConfig | undefined, reach: CacheReach): string;
|
|
212
|
+
/** Mechanism errors surface at managed-file render time, never inside CI. */
|
|
213
|
+
export declare function normalizeMbxRemote(config: PackageMbxRemoteConfig): PackageMbxRemoteConfig;
|
|
190
214
|
/**
|
|
191
215
|
* Job env lines carrying the declared Cargo credential secrets. Both registry
|
|
192
216
|
* tokens and git-origin tokens ride the job env so the credential helper is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-workflow.d.ts","sourceRoot":"","sources":["../../src/managed-files/ci-workflow.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ci-workflow.d.ts","sourceRoot":"","sources":["../../src/managed-files/ci-workflow.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAEV,aAAa,EACb,6BAA6B,EAE7B,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,6BAA6B,EAC7B,2BAA2B,EAE5B,MAAM,0BAA0B,CAAC;AAGlC,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CACrC,MAAM,CACJ,UAAU,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AAgB,wBAAwB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,EAAE,CAGjF;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,EAAE,CAMxG;AAmRD;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,6CAA6C,CAAC;AAEjF,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,EAC9C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,QAAQ,GAAG,UAAU,EAC3B,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,SAAS,SAAc,GACtB,MAAM,EAAE,CAkBV"}
|
|
@@ -153,7 +153,10 @@ jobs:
|
|
|
153
153
|
name: Validate
|
|
154
154
|
${renderRunsOnLine(options.runsOn)}
|
|
155
155
|
timeout-minutes: 45
|
|
156
|
-
${options.privateNpm?.readTokenEnv ||
|
|
156
|
+
${options.privateNpm?.readTokenEnv ||
|
|
157
|
+
options.cargoCredentials !== undefined ||
|
|
158
|
+
options.remoteCache !== undefined ||
|
|
159
|
+
options.mbxRemote !== undefined
|
|
157
160
|
? ` # Fork PRs receive no secrets, so neither a private dependency install nor an
|
|
158
161
|
# authenticated remote cache read can run there.
|
|
159
162
|
if: \${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
|
|
@@ -164,7 +167,7 @@ ${options.privateNpm?.readTokenEnv || options.cargoCredentials !== undefined ||
|
|
|
164
167
|
`
|
|
165
168
|
: ''} env:
|
|
166
169
|
GH_TOKEN: ${githubExpression('github.token')}
|
|
167
|
-
${remoteCacheJobEnvLines(options.remoteCache)}${cargoCredentialJobEnvLines(options.cargoCredentials)}${privateNpmReadTokenJobEnv(options)} steps:
|
|
170
|
+
${remoteCacheJobEnvLines(options.remoteCache, 'internal')}${mbxRemoteJobEnvLines(options.mbxRemote, 'internal')}${cargoCredentialJobEnvLines(options.cargoCredentials)}${privateNpmReadTokenJobEnv(options)} steps:
|
|
168
171
|
`;
|
|
169
172
|
}
|
|
170
173
|
function githubExpression(expression) {
|
|
@@ -486,28 +489,46 @@ export function normalizeSourceCheckout(config) {
|
|
|
486
489
|
* fail every task on 401, which is why the job carries the same fork-PR gate
|
|
487
490
|
* as a private dependency install (see `renderCiWorkflowHeader`).
|
|
488
491
|
*
|
|
489
|
-
* A declared `internalServer` is the address
|
|
490
|
-
*
|
|
491
|
-
*
|
|
492
|
+
* A declared `internalServer` is the address the repository's own runners use, exactly as a git origin's
|
|
493
|
+
* `internalMirror` is: both say those runners sit inside that network. A job on any other runner — a GitHub-hosted
|
|
494
|
+
* one, a macOS label — sits outside it and reaches the public `server`, as a developer shell does. Each job names
|
|
495
|
+
* its reach, so no job is pointed at an address its runner cannot route to.
|
|
492
496
|
* Mechanism errors surface at managed-file render time, never inside CI.
|
|
493
497
|
*/
|
|
494
|
-
export function remoteCacheJobEnvLines(config) {
|
|
498
|
+
export function remoteCacheJobEnvLines(config, reach) {
|
|
495
499
|
if (config === undefined) {
|
|
496
500
|
return '';
|
|
497
501
|
}
|
|
498
502
|
const normalized = normalizeRemoteCache(config);
|
|
503
|
+
const server = reach === 'internal' ? (normalized.internalServer ?? publicCacheOrigin(normalized)) : publicCacheOrigin(normalized);
|
|
499
504
|
return [
|
|
500
|
-
` NX_SELF_HOSTED_REMOTE_CACHE_SERVER: ${
|
|
505
|
+
` NX_SELF_HOSTED_REMOTE_CACHE_SERVER: ${server}\n`,
|
|
501
506
|
` NX_SELF_HOSTED_REMOTE_CACHE_ACCESS_TOKEN: ${githubExpression(`secrets.${normalized.tokenSecret}`)}\n`,
|
|
502
507
|
].join('');
|
|
503
508
|
}
|
|
509
|
+
/**
|
|
510
|
+
* The public origin as a job env value: the declared origin, or the expression that reads the repository variable
|
|
511
|
+
* naming it.
|
|
512
|
+
*/
|
|
513
|
+
function publicCacheOrigin(config) {
|
|
514
|
+
return 'serverVariable' in config ? githubExpression(`vars.${config.serverVariable}`) : config.server;
|
|
515
|
+
}
|
|
504
516
|
/** Mechanism errors surface at managed-file render time, never inside CI. */
|
|
505
517
|
export function normalizeRemoteCache(config) {
|
|
506
|
-
|
|
518
|
+
const literal = 'server' in config ? config.server : undefined;
|
|
519
|
+
if ('server' in config && 'serverVariable' in config) {
|
|
520
|
+
throw new Error('smoo.remoteCache names its public origin twice; declare server or serverVariable, not both');
|
|
521
|
+
}
|
|
522
|
+
if (literal !== undefined) {
|
|
523
|
+
assertCacheOrigin('smoo.remoteCache', 'server', literal);
|
|
524
|
+
}
|
|
525
|
+
else if (!('serverVariable' in config) || !/^[A-Z_][A-Z0-9_]*$/.test(config.serverVariable)) {
|
|
526
|
+
throw new Error(`smoo.remoteCache needs server, or an upper-case repository variable name for serverVariable, got ${JSON.stringify(config)}`);
|
|
527
|
+
}
|
|
507
528
|
if (config.internalServer !== undefined) {
|
|
508
|
-
assertCacheOrigin('internalServer', config.internalServer);
|
|
509
|
-
if (config.internalServer ===
|
|
510
|
-
throw new Error(`smoo.remoteCache internalServer repeats server ${
|
|
529
|
+
assertCacheOrigin('smoo.remoteCache', 'internalServer', config.internalServer);
|
|
530
|
+
if (config.internalServer === literal) {
|
|
531
|
+
throw new Error(`smoo.remoteCache internalServer repeats server ${literal}; drop internalServer or point it at the address internal runners reach`);
|
|
511
532
|
}
|
|
512
533
|
}
|
|
513
534
|
if (!/^[A-Z_][A-Z0-9_]*$/.test(config.tokenSecret)) {
|
|
@@ -521,7 +542,7 @@ export function normalizeRemoteCache(config) {
|
|
|
521
542
|
* slash the server routes nowhere, and a path or credential would be dropped
|
|
522
543
|
* or leaked rather than honored.
|
|
523
544
|
*/
|
|
524
|
-
function assertCacheOrigin(field, value) {
|
|
545
|
+
function assertCacheOrigin(declaration, field, value) {
|
|
525
546
|
let url = null;
|
|
526
547
|
try {
|
|
527
548
|
url = new URL(value);
|
|
@@ -537,7 +558,81 @@ function assertCacheOrigin(field, value) {
|
|
|
537
558
|
url.password !== '' ||
|
|
538
559
|
url.search !== '' ||
|
|
539
560
|
url.hash !== '') {
|
|
540
|
-
throw new Error(
|
|
561
|
+
throw new Error(`${declaration} ${field} needs a credential-free http(s) origin with no path and no trailing slash, got ${JSON.stringify(value)}`);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* The default branch's own runs: a push to it, or a workflow dispatched on it (a release). These are the only lanes
|
|
566
|
+
* given the mbx write token. A pull request's ref is never the default branch, and `pull_request_target` is left out
|
|
567
|
+
* because its ref is the base branch while the code it runs is not.
|
|
568
|
+
*/
|
|
569
|
+
const DEFAULT_BRANCH_LANE = "(github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)";
|
|
570
|
+
/**
|
|
571
|
+
* Job env lines carrying the declared mbx remote cache (`smoo.mbxRemote`). setup-devenv routes Cargo through mbx's
|
|
572
|
+
* Cargo shim when `MBX_REMOTE_URL` is set, so these lines are what turn mbx on for the job; `reach` picks the origin
|
|
573
|
+
* exactly as for the Nx cache. The token is chosen by lane: the write token and `MBX_REMOTE_TRUST_WRITES` on the
|
|
574
|
+
* default branch's own runs, the read-only token everywhere else. mbx's own write policy cannot make that call here:
|
|
575
|
+
* it requires `GITHUB_REF_PROTECTED`, which Forgejo Actions never sets, and it reads a release's `workflow_dispatch`
|
|
576
|
+
* as untrusted. The server's grant on the token is what stops any other job publishing.
|
|
577
|
+
* Mechanism errors surface at managed-file render time, never inside CI.
|
|
578
|
+
*/
|
|
579
|
+
export function mbxRemoteJobEnvLines(config, reach) {
|
|
580
|
+
if (config === undefined) {
|
|
581
|
+
return '';
|
|
582
|
+
}
|
|
583
|
+
const normalized = normalizeMbxRemote(config);
|
|
584
|
+
const server = reach === 'internal' ? (normalized.internalServer ?? publicCacheOrigin(normalized)) : publicCacheOrigin(normalized);
|
|
585
|
+
const token = `${DEFAULT_BRANCH_LANE} && secrets.${normalized.writeTokenSecret} || secrets.${normalized.readTokenSecret}`;
|
|
586
|
+
return [
|
|
587
|
+
` MBX_REMOTE_URL: ${server}\n`,
|
|
588
|
+
` MBX_REMOTE_NAMESPACE: ${normalized.namespace}\n`,
|
|
589
|
+
// One expression per line: a folded scalar would split the lane condition, and Prettier refolds it otherwise.
|
|
590
|
+
' # prettier-ignore\n',
|
|
591
|
+
` MBX_REMOTE_TOKEN: ${githubExpression(token)}\n`,
|
|
592
|
+
' # prettier-ignore\n',
|
|
593
|
+
` MBX_REMOTE_TRUST_WRITES: ${githubExpression(DEFAULT_BRANCH_LANE)}\n`,
|
|
594
|
+
].join('');
|
|
595
|
+
}
|
|
596
|
+
/** Mechanism errors surface at managed-file render time, never inside CI. */
|
|
597
|
+
export function normalizeMbxRemote(config) {
|
|
598
|
+
if ('server' in config && 'serverVariable' in config) {
|
|
599
|
+
throw new Error('smoo.mbxRemote names its public origin twice; declare server or serverVariable, not both');
|
|
600
|
+
}
|
|
601
|
+
if ('server' in config) {
|
|
602
|
+
assertMbxOrigin('server', config.server);
|
|
603
|
+
}
|
|
604
|
+
else if (!/^[A-Z_][A-Z0-9_]*$/.test(config.serverVariable)) {
|
|
605
|
+
throw new Error(`smoo.mbxRemote needs server, or an upper-case repository variable name for serverVariable, got ${JSON.stringify(config)}`);
|
|
606
|
+
}
|
|
607
|
+
if (config.internalServer !== undefined) {
|
|
608
|
+
assertMbxOrigin('internalServer', config.internalServer);
|
|
609
|
+
}
|
|
610
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]*(\/[A-Za-z0-9][A-Za-z0-9._-]*)*$/.test(config.namespace)) {
|
|
611
|
+
throw new Error(`smoo.mbxRemote namespace must be slash-separated segments of letters, digits, '.', '_' and '-', got ${JSON.stringify(config.namespace)}`);
|
|
612
|
+
}
|
|
613
|
+
for (const [field, name] of [
|
|
614
|
+
['writeTokenSecret', config.writeTokenSecret],
|
|
615
|
+
['readTokenSecret', config.readTokenSecret],
|
|
616
|
+
]) {
|
|
617
|
+
if (!/^[A-Z_][A-Z0-9_]*$/.test(name)) {
|
|
618
|
+
throw new Error(`smoo.mbxRemote needs an upper-case secret name for ${field}, got ${JSON.stringify(name)}`);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
if (config.writeTokenSecret === config.readTokenSecret) {
|
|
622
|
+
throw new Error(`smoo.mbxRemote writeTokenSecret and readTokenSecret both name ${config.writeTokenSecret}; untrusted jobs would hold the write token`);
|
|
623
|
+
}
|
|
624
|
+
return config;
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* An mbx origin is a cache origin mbx will send its token to: HTTPS, or plain HTTP to a loopback address only, which
|
|
628
|
+
* is mbx's own rule (it refuses the remote otherwise), checked here so a bad declaration fails at render time.
|
|
629
|
+
*/
|
|
630
|
+
function assertMbxOrigin(field, value) {
|
|
631
|
+
assertCacheOrigin('smoo.mbxRemote', field, value);
|
|
632
|
+
const url = new URL(value);
|
|
633
|
+
const loopback = url.hostname === 'localhost' || url.hostname === '[::1]' || /^127\.\d+\.\d+\.\d+$/.test(url.hostname);
|
|
634
|
+
if (url.protocol === 'http:' && !loopback) {
|
|
635
|
+
throw new Error(`smoo.mbxRemote ${field} ${JSON.stringify(value)} is plain HTTP to a non-loopback host; mbx sends its token only over HTTPS or to loopback`);
|
|
541
636
|
}
|
|
542
637
|
}
|
|
543
638
|
/**
|
|
@@ -993,7 +1088,7 @@ ${options.macosRunsOn === undefined ? ' runs-on: macos-latest' : renderRunsOn
|
|
|
993
1088
|
if: \${{ needs.main.result == 'success' }}
|
|
994
1089
|
env:
|
|
995
1090
|
GH_TOKEN: \${{ github.token }}
|
|
996
|
-
${remoteCacheJobEnvLines(options.remoteCache)}${cargoCredentialJobEnvLines(options.cargoCredentials)}${privateNpmReadTokenJobEnv(options)} steps:
|
|
1091
|
+
${remoteCacheJobEnvLines(options.remoteCache, 'public')}${mbxRemoteJobEnvLines(options.mbxRemote, 'public')}${cargoCredentialJobEnvLines(options.cargoCredentials)}${privateNpmReadTokenJobEnv(options)} steps:
|
|
997
1092
|
${renderCiWorkflowSteps(followUpSetupSteps(options, numbers), options)}
|
|
998
1093
|
${renderCiWorkflowSteps(middleSteps, options)}
|
|
999
1094
|
${renderCiWorkflowSteps(followUpCleanupStep(numbers), options)}`;
|
|
@@ -1079,7 +1174,7 @@ ${renderRunsOnLine(options.runsOn)}
|
|
|
1079
1174
|
${environmentLine(options.environments?.staging)} if: \${{ needs.main.result == 'success' && needs.main.outputs.deployment-stage != '' }}
|
|
1080
1175
|
env:
|
|
1081
1176
|
GH_TOKEN: \${{ github.token }}
|
|
1082
|
-
${remoteCacheJobEnvLines(options.remoteCache)}${cargoCredentialJobEnvLines(options.cargoCredentials)}${privateNpmReadTokenJobEnv(options)} steps:
|
|
1177
|
+
${remoteCacheJobEnvLines(options.remoteCache, 'internal')}${mbxRemoteJobEnvLines(options.mbxRemote, 'internal')}${cargoCredentialJobEnvLines(options.cargoCredentials)}${privateNpmReadTokenJobEnv(options)} steps:
|
|
1083
1178
|
${renderCiWorkflowSteps(followUpSetupSteps(options, numbers), options)}
|
|
1084
1179
|
# Step ${numbers.middle}
|
|
1085
1180
|
- name: E2E Tests (Deployed Stage)
|
|
@@ -1111,7 +1206,7 @@ ${renderRunsOnLine(options.runsOn)}
|
|
|
1111
1206
|
if: \${{ !cancelled() && github.event_name == 'push' && github.ref == ${stagingRefLiteral(options)} && needs.main.result == 'success'${e2eGate} }}
|
|
1112
1207
|
${environmentLine(options.environments?.production)} env:
|
|
1113
1208
|
GH_TOKEN: \${{ github.token }}
|
|
1114
|
-
${remoteCacheJobEnvLines(options.remoteCache)}${cargoCredentialJobEnvLines(options.cargoCredentials)}${privateNpmReadTokenJobEnv(options)} steps:
|
|
1209
|
+
${remoteCacheJobEnvLines(options.remoteCache, 'internal')}${mbxRemoteJobEnvLines(options.mbxRemote, 'internal')}${cargoCredentialJobEnvLines(options.cargoCredentials)}${privateNpmReadTokenJobEnv(options)} steps:
|
|
1115
1210
|
${renderCiWorkflowSteps(followUpSetupSteps(options, numbers), options)}
|
|
1116
1211
|
# Step ${numbers.middle}
|
|
1117
1212
|
- name: 🚀 Deploy Production
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/managed-files/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAAmD,MAAM,qBAAqB,CAAC;AAE5G,OAAO,EAAkB,KAAK,aAAa,EAAE,KAAK,WAAW,EAA0B,MAAM,0BAA0B,CAAC;AAExH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGrD,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAC9D,UAAU,gBAAgB;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAED,iFAAiF;AACjF,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,WAAW,EACrB,QAAQ,EAAE,SAAS,WAAW,EAAE,EAChC,UAAU,EAAE,iBAAiB,EAC7B,UAAU,EAAE,OAAO,EACnB,KAAK,EAAE,MAAM,GACZ,kBAAkB,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/managed-files/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAAmD,MAAM,qBAAqB,CAAC;AAE5G,OAAO,EAAkB,KAAK,aAAa,EAAE,KAAK,WAAW,EAA0B,MAAM,0BAA0B,CAAC;AAExH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGrD,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAC9D,UAAU,g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