@catladder/cli 0.0.0-next-6ea918c7 → 0.0.0-next-08efdbb7
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/bundles/catenv/index.js +68 -16
- package/dist/bundles/cli/index.js +149 -33
- package/dist/cli/src/apps/cli/commands/project/commandConfigSecrets.js +1 -1
- package/dist/cli/src/apps/cli/commands/project/commandConfigSecrets.js.map +1 -1
- package/dist/cli/src/commands/project/commandSecretsSyncGithub.d.ts +17 -3
- package/dist/cli/src/commands/project/commandSecretsSyncGithub.js +60 -11
- package/dist/cli/src/commands/project/commandSecretsSyncGithub.js.map +1 -1
- package/dist/cli/src/utils/github.d.ts +7 -2
- package/dist/cli/src/utils/github.js +21 -6
- package/dist/cli/src/utils/github.js.map +1 -1
- package/dist/pipeline/src/backends/github/createGithubJobs.js +44 -12
- package/dist/pipeline/src/backends/github/createGithubJobs.js.map +1 -1
- package/dist/pipeline/src/backends/gitlab/createGitlabJobs.js +11 -2
- package/dist/pipeline/src/backends/gitlab/createGitlabJobs.js.map +1 -1
- package/dist/pipeline/src/build/cache/createJobCache.js +4 -0
- package/dist/pipeline/src/build/cache/createJobCache.js.map +1 -1
- package/dist/pipeline/src/build/node/cache.js +8 -1
- package/dist/pipeline/src/build/node/cache.js.map +1 -1
- package/dist/pipeline/src/build/types.d.ts +11 -0
- package/dist/pipeline/src/build/types.js.map +1 -1
- package/dist/pipeline/src/constants.js +1 -1
- package/dist/pipeline/src/types/jobs.d.ts +7 -1
- package/dist/pipeline/src/types/jobs.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +7 -1
- package/src/commands/project/commandSecretsSyncGithub.ts +81 -9
- package/src/utils/github.ts +50 -5
|
@@ -1897,22 +1897,29 @@ const createCacheSteps = (context, job) => {
|
|
|
1897
1897
|
}
|
|
1898
1898
|
const lowered = (_b = (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, job.caches)) !== null && _b !== void 0 ? _b : [];
|
|
1899
1899
|
return (0, utils_1.ensureArray)(lowered).map(cache => {
|
|
1900
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1900
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1901
1901
|
const paths = (0, utils_1.ensureArray)((_a = cache.paths) !== null && _a !== void 0 ? _a : []);
|
|
1902
1902
|
const key = cache.key;
|
|
1903
1903
|
const {
|
|
1904
1904
|
cacheKey,
|
|
1905
1905
|
restoreKeyPrefix,
|
|
1906
1906
|
label
|
|
1907
|
-
} = typeof key === "string" || key === undefined ? {
|
|
1907
|
+
} = typeof key === "string" || key === undefined ? ((_b = cache.keyFiles) === null || _b === void 0 ? void 0 : _b.length) ? {
|
|
1908
|
+
// content-keyed: an unchanged hash is an exact hit and the
|
|
1909
|
+
// cache is never re-saved (no per-run copies, no races
|
|
1910
|
+
// between parallel jobs saving the same key)
|
|
1911
|
+
cacheKey: `${key !== null && key !== void 0 ? key : "cache"}-\${{ hashFiles(${cache.keyFiles.map(f => `'${f}'`).join(", ")}) }}`,
|
|
1912
|
+
restoreKeyPrefix: `${key !== null && key !== void 0 ? key : "cache"}-`,
|
|
1913
|
+
label: key !== null && key !== void 0 ? key : "cache"
|
|
1914
|
+
} : {
|
|
1908
1915
|
// unique key per run so the cache is re-saved, restored via prefix
|
|
1909
1916
|
cacheKey: `${key !== null && key !== void 0 ? key : "cache"}-\${{ github.run_id }}`,
|
|
1910
1917
|
restoreKeyPrefix: `${key !== null && key !== void 0 ? key : "cache"}-`,
|
|
1911
1918
|
label: key !== null && key !== void 0 ? key : "cache"
|
|
1912
1919
|
} : {
|
|
1913
|
-
cacheKey: `${(
|
|
1914
|
-
restoreKeyPrefix: `${(
|
|
1915
|
-
label: (
|
|
1920
|
+
cacheKey: `${(_c = key.prefix) !== null && _c !== void 0 ? _c : "files"}-\${{ hashFiles(${((_d = key.files) !== null && _d !== void 0 ? _d : []).map(f => `'${f}'`).join(", ")}) }}`,
|
|
1921
|
+
restoreKeyPrefix: `${(_e = key.prefix) !== null && _e !== void 0 ? _e : "files"}-`,
|
|
1922
|
+
label: (_f = key.prefix) !== null && _f !== void 0 ? _f : ((_g = key.files) !== null && _g !== void 0 ? _g : []).join(",")
|
|
1916
1923
|
};
|
|
1917
1924
|
return {
|
|
1918
1925
|
name: `Cache ${label}`,
|
|
@@ -2004,6 +2011,36 @@ const makeGithubJob = (context, job, allJobs, uploadProviderIds, images, scripts
|
|
|
2004
2011
|
...getReferencedSecretsEnv(runScript, secretKinds),
|
|
2005
2012
|
CL_JOB_IMAGE: image !== null && image !== void 0 ? image : "runner"
|
|
2006
2013
|
};
|
|
2014
|
+
/**
|
|
2015
|
+
* the github environment of the job — serving two purposes:
|
|
2016
|
+
* deployment tracking on deploy jobs, and access to environment
|
|
2017
|
+
* secrets (the repo-level cap of 100 secrets doesn't scale to
|
|
2018
|
+
* multiple envs). Names are keyed by env NAME, never env type: an
|
|
2019
|
+
* app can have several envs of the same type.
|
|
2020
|
+
*
|
|
2021
|
+
* - deploy jobs: `<env>-<component>` — static (unlike the former
|
|
2022
|
+
* per-PR review names), so environment secrets can attach, and
|
|
2023
|
+
* each component keeps its own deployment badge/url in the
|
|
2024
|
+
* github ui. For review, PRs share the component's environment:
|
|
2025
|
+
* a newer PR's deploy marks the previous one Inactive (the badge,
|
|
2026
|
+
* not the app) — the price of a static name.
|
|
2027
|
+
* - other jobs referencing secrets join the shared `<env>`
|
|
2028
|
+
* environment — deliberately NOT the per-component one, whose
|
|
2029
|
+
* Active deploy badge their deployment records would displace.
|
|
2030
|
+
* NOTE: build-time and deploy-time vars are not differentiated
|
|
2031
|
+
* yet, so this environment holds roughly ALL of the env's
|
|
2032
|
+
* secrets (the build's dotenv references every component).
|
|
2033
|
+
* - jobs without secret references get no environment
|
|
2034
|
+
*/
|
|
2035
|
+
const referencesSecrets = Object.values(env).some(value => typeof value === "string" && (value.includes("${{ secrets.") || value.includes("${{ vars.")));
|
|
2036
|
+
const githubEnvironment = job.environment && isComponent ? {
|
|
2037
|
+
name: `${context.env}-${context.name}`,
|
|
2038
|
+
...(createsJobEnv ? {
|
|
2039
|
+
url: "${{ steps.main.outputs.url }}"
|
|
2040
|
+
} : {})
|
|
2041
|
+
} : referencesSecrets ? {
|
|
2042
|
+
name: context.env
|
|
2043
|
+
} : undefined;
|
|
2007
2044
|
const githubJob = {
|
|
2008
2045
|
name: githubJobName(context, job.name),
|
|
2009
2046
|
"runs-on": "ubuntu-latest",
|
|
@@ -2025,13 +2062,8 @@ const makeGithubJob = (context, job, allJobs, uploadProviderIds, images, scripts
|
|
|
2025
2062
|
...(Object.keys(services).length > 0 ? {
|
|
2026
2063
|
services
|
|
2027
2064
|
} : {}),
|
|
2028
|
-
...(
|
|
2029
|
-
environment:
|
|
2030
|
-
name: context.environment.envType === "review" ? `review-pr\${{ github.event.number }}-${context.name}` : `${context.env}-${context.name}`,
|
|
2031
|
-
...(createsJobEnv ? {
|
|
2032
|
-
url: "${{ steps.main.outputs.url }}"
|
|
2033
|
-
} : {})
|
|
2034
|
-
}
|
|
2065
|
+
...(githubEnvironment ? {
|
|
2066
|
+
environment: githubEnvironment
|
|
2035
2067
|
} : {}),
|
|
2036
2068
|
env,
|
|
2037
2069
|
steps: [...(skipCheckout ? [] : [{
|
|
@@ -2665,8 +2697,17 @@ const makeGitlabJob = (context, job, allJobs, images, baseRules) => {
|
|
|
2665
2697
|
const when = jobWhen !== null && jobWhen !== void 0 ? jobWhen : gate ? gate === "manual" ? "manual" : "on_success" : undefined;
|
|
2666
2698
|
const allow_failure = jobAllowFailure !== null && jobAllowFailure !== void 0 ? jobAllowFailure : gate ? gate === "manual" : undefined;
|
|
2667
2699
|
// the neutral `caches` declarations resolve to gitlab cache configs;
|
|
2668
|
-
// an explicitly set gitlab `cache` takes precedence
|
|
2669
|
-
|
|
2700
|
+
// an explicitly set gitlab `cache` takes precedence. `keyFiles` is a
|
|
2701
|
+
// github-only content-key hint and must not leak into the gitlab yaml
|
|
2702
|
+
const stripKeyFiles = resolved => Array.isArray(resolved) ? resolved.map(({
|
|
2703
|
+
keyFiles: _keyFiles,
|
|
2704
|
+
...cacheRest
|
|
2705
|
+
}) => cacheRest) : (({
|
|
2706
|
+
keyFiles: _keyFiles,
|
|
2707
|
+
...cacheRest
|
|
2708
|
+
}) => cacheRest)(resolved);
|
|
2709
|
+
const resolvedCaches = caches && context.type !== "agent" ? (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, caches) : undefined;
|
|
2710
|
+
const cache = jobCache !== null && jobCache !== void 0 ? jobCache : resolvedCaches && stripKeyFiles(resolvedCaches);
|
|
2670
2711
|
const stage = envMode === "stagePerEnv" && context.type !== "agent" ? `${job.stage} ${context.env}` : job.stage;
|
|
2671
2712
|
const deduplicatedGitlabNeeds = getGitlabNeeds(context, job, allJobs, imageNeeds);
|
|
2672
2713
|
const fullJobName = getFullJobName({
|
|
@@ -3957,6 +3998,7 @@ const createJobCacheFromCacheConfigs = (context, caches) => {
|
|
|
3957
3998
|
scope,
|
|
3958
3999
|
pathMode,
|
|
3959
4000
|
buildDir,
|
|
4001
|
+
keyFiles,
|
|
3960
4002
|
...rest
|
|
3961
4003
|
}) => {
|
|
3962
4004
|
var _a;
|
|
@@ -3970,6 +4012,9 @@ const createJobCacheFromCacheConfigs = (context, caches) => {
|
|
|
3970
4012
|
key: transformedKey,
|
|
3971
4013
|
policy: policy !== null && policy !== void 0 ? policy : "pull-push",
|
|
3972
4014
|
paths: pathMode === "absolute" ? paths : paths === null || paths === void 0 ? void 0 : paths.map(p => (0, path_1.join)(baseDir, p)),
|
|
4015
|
+
...((keyFiles === null || keyFiles === void 0 ? void 0 : keyFiles.length) ? {
|
|
4016
|
+
keyFiles: keyFiles.map(f => pathMode === "absolute" ? f : (0, path_1.join)(baseDir, f))
|
|
4017
|
+
} : {}),
|
|
3973
4018
|
...rest
|
|
3974
4019
|
};
|
|
3975
4020
|
});
|
|
@@ -4521,7 +4566,10 @@ const getYarnCache = async (context, policy = "pull-push") => {
|
|
|
4521
4566
|
pathMode: componentIsInWorkspace ? "absolute" : "relative",
|
|
4522
4567
|
key: "yarn",
|
|
4523
4568
|
policy,
|
|
4524
|
-
paths: [".yarn"]
|
|
4569
|
+
paths: [".yarn"],
|
|
4570
|
+
// content-key for immutable-cache backends (github); the lockfile
|
|
4571
|
+
// decides whether the cached content could have changed
|
|
4572
|
+
keyFiles: ["yarn.lock"]
|
|
4525
4573
|
}];
|
|
4526
4574
|
};
|
|
4527
4575
|
exports.getYarnCache = getYarnCache;
|
|
@@ -4541,6 +4589,10 @@ const getNodeModulesCache = async (context, policy = "pull-push") => {
|
|
|
4541
4589
|
// if component is in a shared workspace, use workspace cache. use individual cache else
|
|
4542
4590
|
key: componentIsInWorkspace ? "node-modules-workspace" : (0, slugify_1.default)(context.build.dir) + "-node-modules",
|
|
4543
4591
|
// we use the dirname, not the component name, because in certain cases we have two apps in the same directory and want to share the cache, e.g. when having storybook in the same package.json
|
|
4592
|
+
// content-key for immutable-cache backends (github); the lockfile
|
|
4593
|
+
// decides whether the cached content could have changed (absolute
|
|
4594
|
+
// pathMode: resolve the standalone component's lockfile explicitly)
|
|
4595
|
+
keyFiles: [componentIsInWorkspace ? "yarn.lock" : (0, path_1.join)(context.build.dir, "yarn.lock")],
|
|
4544
4596
|
policy,
|
|
4545
4597
|
paths: [...(componentIsInWorkspace ? (0, lodash_es_1.uniq)(["node_modules", ...((_a = workspaces.map(w => (0, path_1.join)(w.location, "node_modules"))) !== null && _a !== void 0 ? _a : []), ...(!isClassic ? [".yarn/install-state.gz", ...((_b = workspaces.map(w => (0, path_1.join)(w.location, ".yarn/install-state.gz"))) !== null && _b !== void 0 ? _b : [])] : [])]) : [(0, path_1.join)(context.build.dir, "node_modules"), ...(!isClassic ? [(0, path_1.join)(context.build.dir, ".yarn/install-state.gz")] : [])])]
|
|
4546
4598
|
}];
|
|
@@ -5224,7 +5276,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
5224
5276
|
value: true
|
|
5225
5277
|
}));
|
|
5226
5278
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
5227
|
-
exports.PIPELINE_IMAGE_TAG = "next-
|
|
5279
|
+
exports.PIPELINE_IMAGE_TAG = "next-08efdbb7" || 0;
|
|
5228
5280
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
5229
5281
|
|
|
5230
5282
|
/***/ }),
|
|
@@ -560,7 +560,7 @@ const mirrorSecretsToCiBackends = async (instance, config, envAndComponents, val
|
|
|
560
560
|
return;
|
|
561
561
|
}
|
|
562
562
|
instance.log(`mirroring ${secrets.length} secrets to github ('${repo}')...`);
|
|
563
|
-
await (0, commandSecretsSyncGithub_1.pushSecretsToGithub)(instance, repo, secrets);
|
|
563
|
+
await (0, commandSecretsSyncGithub_1.pushSecretsToGithub)(instance, repo, secrets, await (0, commandSecretsSyncGithub_1.collectSecretTargets)(config));
|
|
564
564
|
};
|
|
565
565
|
const projectConfigSecrets = async (io, envComponent) => {
|
|
566
566
|
if (!envComponent) {
|
|
@@ -3392,7 +3392,7 @@ exports.commandSecretsClearBackups = (0, defineCommand_1.defineCommand)({
|
|
|
3392
3392
|
Object.defineProperty(exports, "__esModule", ({
|
|
3393
3393
|
value: true
|
|
3394
3394
|
}));
|
|
3395
|
-
exports.commandSecretsSyncGithub = exports.getConfiguredGithubRepo = exports.pushSecretsToGithub = exports.collectSecretsFromVault = void 0;
|
|
3395
|
+
exports.commandSecretsSyncGithub = exports.getConfiguredGithubRepo = exports.pushSecretsToGithub = exports.collectSecretTargets = exports.collectSecretsFromVault = void 0;
|
|
3396
3396
|
const pipeline_1 = __nccwpck_require__(60241);
|
|
3397
3397
|
const getProjectConfig_1 = __nccwpck_require__(50001);
|
|
3398
3398
|
const defineCommand_1 = __nccwpck_require__(39489);
|
|
@@ -3437,22 +3437,71 @@ const collectSecretsFromVault = async (io, envFilter) => {
|
|
|
3437
3437
|
};
|
|
3438
3438
|
};
|
|
3439
3439
|
exports.collectSecretsFromVault = collectSecretsFromVault;
|
|
3440
|
+
/** marker for repo-level (environment-less) targets */
|
|
3441
|
+
const REPO_LEVEL = "";
|
|
3440
3442
|
/**
|
|
3441
|
-
*
|
|
3442
|
-
*
|
|
3443
|
+
* derives which github environment(s) each secret/variable must live in
|
|
3444
|
+
* by scanning the GENERATED workflows: a `${{ secrets.X }}` / `${{
|
|
3445
|
+
* vars.X }}` reference in a job's env targets that job's environment
|
|
3446
|
+
* (or the repo level when the job has none). Deriving from the real
|
|
3447
|
+
* output means the sync can never drift from what the workflows expect.
|
|
3448
|
+
*
|
|
3449
|
+
* Environment secrets are the answer to github's cap of 100 secrets
|
|
3450
|
+
* per REPO (a multi-env project easily exceeds it): the cap applies
|
|
3451
|
+
* per environment instead.
|
|
3452
|
+
*/
|
|
3453
|
+
const collectSecretTargets = async config => {
|
|
3454
|
+
var _a;
|
|
3455
|
+
const workflows = await new pipeline_1.GithubBackend().createWorkflows(config);
|
|
3456
|
+
const targets = new Map();
|
|
3457
|
+
for (const workflow of Object.values(workflows)) {
|
|
3458
|
+
for (const job of Object.values(workflow.jobs)) {
|
|
3459
|
+
const environment = typeof job.environment === "object" ? job.environment.name : job.environment;
|
|
3460
|
+
for (const value of Object.values((_a = job.env) !== null && _a !== void 0 ? _a : {})) {
|
|
3461
|
+
if (typeof value !== "string") continue;
|
|
3462
|
+
for (const match of value.matchAll(/\$\{\{\s*(?:secrets|vars)\.([A-Za-z0-9_]+)\s*\}\}/g)) {
|
|
3463
|
+
const name = match[1];
|
|
3464
|
+
if (!targets.has(name)) {
|
|
3465
|
+
targets.set(name, new Set());
|
|
3466
|
+
}
|
|
3467
|
+
targets.get(name).add(environment !== null && environment !== void 0 ? environment : REPO_LEVEL);
|
|
3468
|
+
}
|
|
3469
|
+
}
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
return targets;
|
|
3473
|
+
};
|
|
3474
|
+
exports.collectSecretTargets = collectSecretTargets;
|
|
3475
|
+
/**
|
|
3476
|
+
* pushes vault values to github via the gh cli: sensitive ones as
|
|
3477
|
+
* secrets (masked), "variable"-kind ones as variables (plain) — each
|
|
3478
|
+
* into the environment(s) whose jobs reference them
|
|
3443
3479
|
*/
|
|
3444
|
-
const pushSecretsToGithub = async (io, repo, secrets) => {
|
|
3480
|
+
const pushSecretsToGithub = async (io, repo, secrets, targets) => {
|
|
3481
|
+
const environments = [...new Set([...targets.values()].flatMap(envs => [...envs].filter(env => env !== REPO_LEVEL)))];
|
|
3482
|
+
for (const environment of environments) {
|
|
3483
|
+
await (0, github_1.ensureGithubEnvironment)(repo, environment);
|
|
3484
|
+
io.log(`🌍 environment ${environment}`);
|
|
3485
|
+
}
|
|
3445
3486
|
for (const {
|
|
3446
3487
|
name,
|
|
3447
3488
|
value,
|
|
3448
3489
|
kind
|
|
3449
3490
|
} of secrets) {
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
io.log(
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3491
|
+
const envs = targets.get(name);
|
|
3492
|
+
if (!envs) {
|
|
3493
|
+
io.log(`⏭️ ${name} (not referenced by any generated workflow)`);
|
|
3494
|
+
continue;
|
|
3495
|
+
}
|
|
3496
|
+
for (const environment of envs) {
|
|
3497
|
+
const suffix = environment === REPO_LEVEL ? "" : ` → ${environment}`;
|
|
3498
|
+
if (kind === "variable") {
|
|
3499
|
+
await (0, github_1.setGithubVariable)(repo, name, value, environment || undefined);
|
|
3500
|
+
io.log(`📖 ${name} (variable)${suffix}`);
|
|
3501
|
+
} else {
|
|
3502
|
+
await (0, github_1.setGithubSecret)(repo, name, value, environment || undefined);
|
|
3503
|
+
io.log(`✅ ${name}${suffix}`);
|
|
3504
|
+
}
|
|
3456
3505
|
}
|
|
3457
3506
|
}
|
|
3458
3507
|
};
|
|
@@ -3532,7 +3581,7 @@ exports.commandSecretsSyncGithub = (0, defineCommand_1.defineCommand)({
|
|
|
3532
3581
|
if (!confirmed) {
|
|
3533
3582
|
throw new Error("abort");
|
|
3534
3583
|
}
|
|
3535
|
-
await (0, exports.pushSecretsToGithub)(ctx, repo, secrets);
|
|
3584
|
+
await (0, exports.pushSecretsToGithub)(ctx, repo, secrets, await (0, exports.collectSecretTargets)(config));
|
|
3536
3585
|
ctx.log("");
|
|
3537
3586
|
ctx.log("done! 😻 the github pipeline can use them as ${{ secrets.<NAME> }}");
|
|
3538
3587
|
}
|
|
@@ -5729,7 +5778,7 @@ exports["default"] = async () => {
|
|
|
5729
5778
|
Object.defineProperty(exports, "__esModule", ({
|
|
5730
5779
|
value: true
|
|
5731
5780
|
}));
|
|
5732
|
-
exports.setGithubVariable = exports.setGithubSecret = exports.getGithubRepoFromRemote = exports.isGhAuthenticated = void 0;
|
|
5781
|
+
exports.ensureGithubEnvironment = exports.setGithubVariable = exports.setGithubSecret = exports.getGithubRepoFromRemote = exports.isGhAuthenticated = void 0;
|
|
5733
5782
|
const child_process_1 = __nccwpck_require__(35317);
|
|
5734
5783
|
const util_1 = __nccwpck_require__(39023);
|
|
5735
5784
|
const execFile = (0, util_1.promisify)(child_process_1.execFile);
|
|
@@ -5762,9 +5811,9 @@ const getGithubRepoFromRemote = async remoteName => {
|
|
|
5762
5811
|
}
|
|
5763
5812
|
};
|
|
5764
5813
|
exports.getGithubRepoFromRemote = getGithubRepoFromRemote;
|
|
5765
|
-
const ghSetViaStdin = (kind, repo, name, value) => new Promise((resolve, reject) => {
|
|
5814
|
+
const ghSetViaStdin = (kind, repo, name, value, environment) => new Promise((resolve, reject) => {
|
|
5766
5815
|
var _a, _b;
|
|
5767
|
-
const child = (0, child_process_1.spawn)("gh", [kind, "set", name, "--repo", repo], {
|
|
5816
|
+
const child = (0, child_process_1.spawn)("gh", [kind, "set", name, "--repo", repo, ...(environment ? ["--env", environment] : [])], {
|
|
5768
5817
|
stdio: ["pipe", "ignore", "pipe"]
|
|
5769
5818
|
});
|
|
5770
5819
|
let stderr = "";
|
|
@@ -5777,14 +5826,29 @@ const ghSetViaStdin = (kind, repo, name, value) => new Promise((resolve, reject)
|
|
|
5777
5826
|
* sets a github actions repository secret via the gh cli.
|
|
5778
5827
|
* The value is passed via stdin so it never shows up in a process list.
|
|
5779
5828
|
*/
|
|
5780
|
-
const setGithubSecret = async (repo, name, value) => ghSetViaStdin("secret", repo, name, value);
|
|
5829
|
+
const setGithubSecret = async (repo, name, value, environment) => ghSetViaStdin("secret", repo, name, value, environment);
|
|
5781
5830
|
exports.setGithubSecret = setGithubSecret;
|
|
5782
5831
|
/**
|
|
5783
5832
|
* sets a github actions repository variable (plain, unmasked) via the
|
|
5784
5833
|
* gh cli — for vault values classified as not sensitive
|
|
5785
5834
|
*/
|
|
5786
|
-
const setGithubVariable = async (repo, name, value) => ghSetViaStdin("variable", repo, name, value);
|
|
5835
|
+
const setGithubVariable = async (repo, name, value, environment) => ghSetViaStdin("variable", repo, name, value, environment);
|
|
5787
5836
|
exports.setGithubVariable = setGithubVariable;
|
|
5837
|
+
/**
|
|
5838
|
+
* creates the github environment when it does not exist (idempotent —
|
|
5839
|
+
* PUT with an empty body leaves existing settings untouched)
|
|
5840
|
+
*/
|
|
5841
|
+
const ensureGithubEnvironment = async (repo, environment) => new Promise((resolve, reject) => {
|
|
5842
|
+
var _a;
|
|
5843
|
+
const child = (0, child_process_1.spawn)("gh", ["api", "-X", "PUT", `repos/${repo}/environments/${encodeURIComponent(environment)}`], {
|
|
5844
|
+
stdio: ["ignore", "ignore", "pipe"]
|
|
5845
|
+
});
|
|
5846
|
+
let stderr = "";
|
|
5847
|
+
(_a = child.stderr) === null || _a === void 0 ? void 0 : _a.on("data", data => stderr += data);
|
|
5848
|
+
child.on("error", reject);
|
|
5849
|
+
child.on("close", code => code === 0 ? resolve() : reject(new Error(`creating github environment ${environment} failed: ${stderr.trim()}`)));
|
|
5850
|
+
});
|
|
5851
|
+
exports.ensureGithubEnvironment = ensureGithubEnvironment;
|
|
5788
5852
|
|
|
5789
5853
|
/***/ }),
|
|
5790
5854
|
|
|
@@ -7148,22 +7212,29 @@ const createCacheSteps = (context, job) => {
|
|
|
7148
7212
|
}
|
|
7149
7213
|
const lowered = (_b = (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, job.caches)) !== null && _b !== void 0 ? _b : [];
|
|
7150
7214
|
return (0, utils_1.ensureArray)(lowered).map(cache => {
|
|
7151
|
-
var _a, _b, _c, _d, _e, _f;
|
|
7215
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
7152
7216
|
const paths = (0, utils_1.ensureArray)((_a = cache.paths) !== null && _a !== void 0 ? _a : []);
|
|
7153
7217
|
const key = cache.key;
|
|
7154
7218
|
const {
|
|
7155
7219
|
cacheKey,
|
|
7156
7220
|
restoreKeyPrefix,
|
|
7157
7221
|
label
|
|
7158
|
-
} = typeof key === "string" || key === undefined ? {
|
|
7222
|
+
} = typeof key === "string" || key === undefined ? ((_b = cache.keyFiles) === null || _b === void 0 ? void 0 : _b.length) ? {
|
|
7223
|
+
// content-keyed: an unchanged hash is an exact hit and the
|
|
7224
|
+
// cache is never re-saved (no per-run copies, no races
|
|
7225
|
+
// between parallel jobs saving the same key)
|
|
7226
|
+
cacheKey: `${key !== null && key !== void 0 ? key : "cache"}-\${{ hashFiles(${cache.keyFiles.map(f => `'${f}'`).join(", ")}) }}`,
|
|
7227
|
+
restoreKeyPrefix: `${key !== null && key !== void 0 ? key : "cache"}-`,
|
|
7228
|
+
label: key !== null && key !== void 0 ? key : "cache"
|
|
7229
|
+
} : {
|
|
7159
7230
|
// unique key per run so the cache is re-saved, restored via prefix
|
|
7160
7231
|
cacheKey: `${key !== null && key !== void 0 ? key : "cache"}-\${{ github.run_id }}`,
|
|
7161
7232
|
restoreKeyPrefix: `${key !== null && key !== void 0 ? key : "cache"}-`,
|
|
7162
7233
|
label: key !== null && key !== void 0 ? key : "cache"
|
|
7163
7234
|
} : {
|
|
7164
|
-
cacheKey: `${(
|
|
7165
|
-
restoreKeyPrefix: `${(
|
|
7166
|
-
label: (
|
|
7235
|
+
cacheKey: `${(_c = key.prefix) !== null && _c !== void 0 ? _c : "files"}-\${{ hashFiles(${((_d = key.files) !== null && _d !== void 0 ? _d : []).map(f => `'${f}'`).join(", ")}) }}`,
|
|
7236
|
+
restoreKeyPrefix: `${(_e = key.prefix) !== null && _e !== void 0 ? _e : "files"}-`,
|
|
7237
|
+
label: (_f = key.prefix) !== null && _f !== void 0 ? _f : ((_g = key.files) !== null && _g !== void 0 ? _g : []).join(",")
|
|
7167
7238
|
};
|
|
7168
7239
|
return {
|
|
7169
7240
|
name: `Cache ${label}`,
|
|
@@ -7255,6 +7326,36 @@ const makeGithubJob = (context, job, allJobs, uploadProviderIds, images, scripts
|
|
|
7255
7326
|
...getReferencedSecretsEnv(runScript, secretKinds),
|
|
7256
7327
|
CL_JOB_IMAGE: image !== null && image !== void 0 ? image : "runner"
|
|
7257
7328
|
};
|
|
7329
|
+
/**
|
|
7330
|
+
* the github environment of the job — serving two purposes:
|
|
7331
|
+
* deployment tracking on deploy jobs, and access to environment
|
|
7332
|
+
* secrets (the repo-level cap of 100 secrets doesn't scale to
|
|
7333
|
+
* multiple envs). Names are keyed by env NAME, never env type: an
|
|
7334
|
+
* app can have several envs of the same type.
|
|
7335
|
+
*
|
|
7336
|
+
* - deploy jobs: `<env>-<component>` — static (unlike the former
|
|
7337
|
+
* per-PR review names), so environment secrets can attach, and
|
|
7338
|
+
* each component keeps its own deployment badge/url in the
|
|
7339
|
+
* github ui. For review, PRs share the component's environment:
|
|
7340
|
+
* a newer PR's deploy marks the previous one Inactive (the badge,
|
|
7341
|
+
* not the app) — the price of a static name.
|
|
7342
|
+
* - other jobs referencing secrets join the shared `<env>`
|
|
7343
|
+
* environment — deliberately NOT the per-component one, whose
|
|
7344
|
+
* Active deploy badge their deployment records would displace.
|
|
7345
|
+
* NOTE: build-time and deploy-time vars are not differentiated
|
|
7346
|
+
* yet, so this environment holds roughly ALL of the env's
|
|
7347
|
+
* secrets (the build's dotenv references every component).
|
|
7348
|
+
* - jobs without secret references get no environment
|
|
7349
|
+
*/
|
|
7350
|
+
const referencesSecrets = Object.values(env).some(value => typeof value === "string" && (value.includes("${{ secrets.") || value.includes("${{ vars.")));
|
|
7351
|
+
const githubEnvironment = job.environment && isComponent ? {
|
|
7352
|
+
name: `${context.env}-${context.name}`,
|
|
7353
|
+
...(createsJobEnv ? {
|
|
7354
|
+
url: "${{ steps.main.outputs.url }}"
|
|
7355
|
+
} : {})
|
|
7356
|
+
} : referencesSecrets ? {
|
|
7357
|
+
name: context.env
|
|
7358
|
+
} : undefined;
|
|
7258
7359
|
const githubJob = {
|
|
7259
7360
|
name: githubJobName(context, job.name),
|
|
7260
7361
|
"runs-on": "ubuntu-latest",
|
|
@@ -7276,13 +7377,8 @@ const makeGithubJob = (context, job, allJobs, uploadProviderIds, images, scripts
|
|
|
7276
7377
|
...(Object.keys(services).length > 0 ? {
|
|
7277
7378
|
services
|
|
7278
7379
|
} : {}),
|
|
7279
|
-
...(
|
|
7280
|
-
environment:
|
|
7281
|
-
name: context.environment.envType === "review" ? `review-pr\${{ github.event.number }}-${context.name}` : `${context.env}-${context.name}`,
|
|
7282
|
-
...(createsJobEnv ? {
|
|
7283
|
-
url: "${{ steps.main.outputs.url }}"
|
|
7284
|
-
} : {})
|
|
7285
|
-
}
|
|
7380
|
+
...(githubEnvironment ? {
|
|
7381
|
+
environment: githubEnvironment
|
|
7286
7382
|
} : {}),
|
|
7287
7383
|
env,
|
|
7288
7384
|
steps: [...(skipCheckout ? [] : [{
|
|
@@ -7916,8 +8012,17 @@ const makeGitlabJob = (context, job, allJobs, images, baseRules) => {
|
|
|
7916
8012
|
const when = jobWhen !== null && jobWhen !== void 0 ? jobWhen : gate ? gate === "manual" ? "manual" : "on_success" : undefined;
|
|
7917
8013
|
const allow_failure = jobAllowFailure !== null && jobAllowFailure !== void 0 ? jobAllowFailure : gate ? gate === "manual" : undefined;
|
|
7918
8014
|
// the neutral `caches` declarations resolve to gitlab cache configs;
|
|
7919
|
-
// an explicitly set gitlab `cache` takes precedence
|
|
7920
|
-
|
|
8015
|
+
// an explicitly set gitlab `cache` takes precedence. `keyFiles` is a
|
|
8016
|
+
// github-only content-key hint and must not leak into the gitlab yaml
|
|
8017
|
+
const stripKeyFiles = resolved => Array.isArray(resolved) ? resolved.map(({
|
|
8018
|
+
keyFiles: _keyFiles,
|
|
8019
|
+
...cacheRest
|
|
8020
|
+
}) => cacheRest) : (({
|
|
8021
|
+
keyFiles: _keyFiles,
|
|
8022
|
+
...cacheRest
|
|
8023
|
+
}) => cacheRest)(resolved);
|
|
8024
|
+
const resolvedCaches = caches && context.type !== "agent" ? (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, caches) : undefined;
|
|
8025
|
+
const cache = jobCache !== null && jobCache !== void 0 ? jobCache : resolvedCaches && stripKeyFiles(resolvedCaches);
|
|
7921
8026
|
const stage = envMode === "stagePerEnv" && context.type !== "agent" ? `${job.stage} ${context.env}` : job.stage;
|
|
7922
8027
|
const deduplicatedGitlabNeeds = getGitlabNeeds(context, job, allJobs, imageNeeds);
|
|
7923
8028
|
const fullJobName = getFullJobName({
|
|
@@ -9208,6 +9313,7 @@ const createJobCacheFromCacheConfigs = (context, caches) => {
|
|
|
9208
9313
|
scope,
|
|
9209
9314
|
pathMode,
|
|
9210
9315
|
buildDir,
|
|
9316
|
+
keyFiles,
|
|
9211
9317
|
...rest
|
|
9212
9318
|
}) => {
|
|
9213
9319
|
var _a;
|
|
@@ -9221,6 +9327,9 @@ const createJobCacheFromCacheConfigs = (context, caches) => {
|
|
|
9221
9327
|
key: transformedKey,
|
|
9222
9328
|
policy: policy !== null && policy !== void 0 ? policy : "pull-push",
|
|
9223
9329
|
paths: pathMode === "absolute" ? paths : paths === null || paths === void 0 ? void 0 : paths.map(p => (0, path_1.join)(baseDir, p)),
|
|
9330
|
+
...((keyFiles === null || keyFiles === void 0 ? void 0 : keyFiles.length) ? {
|
|
9331
|
+
keyFiles: keyFiles.map(f => pathMode === "absolute" ? f : (0, path_1.join)(baseDir, f))
|
|
9332
|
+
} : {}),
|
|
9224
9333
|
...rest
|
|
9225
9334
|
};
|
|
9226
9335
|
});
|
|
@@ -9772,7 +9881,10 @@ const getYarnCache = async (context, policy = "pull-push") => {
|
|
|
9772
9881
|
pathMode: componentIsInWorkspace ? "absolute" : "relative",
|
|
9773
9882
|
key: "yarn",
|
|
9774
9883
|
policy,
|
|
9775
|
-
paths: [".yarn"]
|
|
9884
|
+
paths: [".yarn"],
|
|
9885
|
+
// content-key for immutable-cache backends (github); the lockfile
|
|
9886
|
+
// decides whether the cached content could have changed
|
|
9887
|
+
keyFiles: ["yarn.lock"]
|
|
9776
9888
|
}];
|
|
9777
9889
|
};
|
|
9778
9890
|
exports.getYarnCache = getYarnCache;
|
|
@@ -9792,6 +9904,10 @@ const getNodeModulesCache = async (context, policy = "pull-push") => {
|
|
|
9792
9904
|
// if component is in a shared workspace, use workspace cache. use individual cache else
|
|
9793
9905
|
key: componentIsInWorkspace ? "node-modules-workspace" : (0, slugify_1.default)(context.build.dir) + "-node-modules",
|
|
9794
9906
|
// we use the dirname, not the component name, because in certain cases we have two apps in the same directory and want to share the cache, e.g. when having storybook in the same package.json
|
|
9907
|
+
// content-key for immutable-cache backends (github); the lockfile
|
|
9908
|
+
// decides whether the cached content could have changed (absolute
|
|
9909
|
+
// pathMode: resolve the standalone component's lockfile explicitly)
|
|
9910
|
+
keyFiles: [componentIsInWorkspace ? "yarn.lock" : (0, path_1.join)(context.build.dir, "yarn.lock")],
|
|
9795
9911
|
policy,
|
|
9796
9912
|
paths: [...(componentIsInWorkspace ? (0, lodash_es_1.uniq)(["node_modules", ...((_a = workspaces.map(w => (0, path_1.join)(w.location, "node_modules"))) !== null && _a !== void 0 ? _a : []), ...(!isClassic ? [".yarn/install-state.gz", ...((_b = workspaces.map(w => (0, path_1.join)(w.location, ".yarn/install-state.gz"))) !== null && _b !== void 0 ? _b : [])] : [])]) : [(0, path_1.join)(context.build.dir, "node_modules"), ...(!isClassic ? [(0, path_1.join)(context.build.dir, ".yarn/install-state.gz")] : [])])]
|
|
9797
9913
|
}];
|
|
@@ -10475,7 +10591,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
10475
10591
|
value: true
|
|
10476
10592
|
}));
|
|
10477
10593
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
10478
|
-
exports.PIPELINE_IMAGE_TAG = "next-
|
|
10594
|
+
exports.PIPELINE_IMAGE_TAG = "next-08efdbb7" || 0;
|
|
10479
10595
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
10480
10596
|
|
|
10481
10597
|
/***/ }),
|
|
@@ -166,7 +166,7 @@ const mirrorSecretsToCiBackends = async (instance, config, envAndComponents, val
|
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
168
|
instance.log(`mirroring ${secrets.length} secrets to github ('${repo}')...`);
|
|
169
|
-
await (0, commandSecretsSyncGithub_1.pushSecretsToGithub)(instance, repo, secrets);
|
|
169
|
+
await (0, commandSecretsSyncGithub_1.pushSecretsToGithub)(instance, repo, secrets, await (0, commandSecretsSyncGithub_1.collectSecretTargets)(config));
|
|
170
170
|
};
|
|
171
171
|
const projectConfigSecrets = async (io, envComponent) => {
|
|
172
172
|
if (!envComponent) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandConfigSecrets.js","sourceRoot":"","sources":["../../../../../../../src/apps/cli/commands/project/commandConfigSecrets.ts"],"names":[],"mappings":";;;AAAA,kDAI6B;AAE7B,6CAA2C;AAC3C,yCAAuC;AAEvC,0EAQ6C;AAC7C,
|
|
1
|
+
{"version":3,"file":"commandConfigSecrets.js","sourceRoot":"","sources":["../../../../../../../src/apps/cli/commands/project/commandConfigSecrets.ts"],"names":[],"mappings":";;;AAAA,kDAI6B;AAE7B,6CAA2C;AAC3C,yCAAuC;AAEvC,0EAQ6C;AAC7C,oGAI+D;AAC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8CAAmB,EACvB,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,MAAM,IAAA,+CAAoB,EAAC,MAAM,CAAC,CACnC,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,oBAAoB,GAAG,KAAK,EAAE,EAAM,EAAE,YAAqB,EAAE,EAAE;IAC1E,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,mBAAmB,GAAG,MAAM,IAAA,0DAAuC,GAAE,CAAC;QAC5E,MAAM,OAAO,CAAC,EAAE,EAAE,mBAAmB,CAAC,CAAC;IACzC,CAAC;SAAM,CAAC;QACN,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,IAAA,8BAAW,EAAC,YAAY,CAAC,CAAC;QAEzD,wEAAwE;QACxE,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,MAAM,UAAU,GAAG,MAAM,IAAA,uCAAoB,GAAE,CAAC;YAChD,MAAM,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3E,CAAC;QACD,IAAI,aAAa,EAAE,CAAC;YAClB,MAAM,OAAO,CAAC,EAAE,EAAE;gBAChB,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,CAAC;aACvB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAlBW,QAAA,oBAAoB,wBAkB/B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Config } from "../../../../pipeline/src/index.js";
|
|
1
2
|
import type { IO } from "../../core/types";
|
|
2
3
|
/**
|
|
3
4
|
* all secrets declared in the config, with their values read from the
|
|
@@ -12,14 +13,27 @@ export declare const collectSecretsFromVault: (io: IO, envFilter?: string[]) =>
|
|
|
12
13
|
missing: string[];
|
|
13
14
|
}>;
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
16
|
+
* derives which github environment(s) each secret/variable must live in
|
|
17
|
+
* by scanning the GENERATED workflows: a `${{ secrets.X }}` / `${{
|
|
18
|
+
* vars.X }}` reference in a job's env targets that job's environment
|
|
19
|
+
* (or the repo level when the job has none). Deriving from the real
|
|
20
|
+
* output means the sync can never drift from what the workflows expect.
|
|
21
|
+
*
|
|
22
|
+
* Environment secrets are the answer to github's cap of 100 secrets
|
|
23
|
+
* per REPO (a multi-env project easily exceeds it): the cap applies
|
|
24
|
+
* per environment instead.
|
|
25
|
+
*/
|
|
26
|
+
export declare const collectSecretTargets: (config: Config) => Promise<Map<string, Set<string>>>;
|
|
27
|
+
/**
|
|
28
|
+
* pushes vault values to github via the gh cli: sensitive ones as
|
|
29
|
+
* secrets (masked), "variable"-kind ones as variables (plain) — each
|
|
30
|
+
* into the environment(s) whose jobs reference them
|
|
17
31
|
*/
|
|
18
32
|
export declare const pushSecretsToGithub: (io: IO, repo: string, secrets: {
|
|
19
33
|
name: string;
|
|
20
34
|
value: string;
|
|
21
35
|
kind: "secret" | "variable";
|
|
22
|
-
}[]) => Promise<void>;
|
|
36
|
+
}[], targets: Map<string, Set<string>>) => Promise<void>;
|
|
23
37
|
/**
|
|
24
38
|
* resolves the github repository from the configured git remote
|
|
25
39
|
* (`pipelines.github.gitRemote`, defaults to origin)
|