@catladder/cli 5.1.0 → 5.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apps/cli/src/apps/cli/commands/project/doctor/checkGithubImageCasing.d.ts +15 -0
- package/dist/apps/cli/src/apps/cli/commands/project/doctor/checkGithubImageCasing.js +60 -0
- package/dist/apps/cli/src/apps/cli/commands/project/doctor/checkGithubImageCasing.js.map +1 -0
- package/dist/apps/cli/src/apps/cli/commands/project/doctor/index.js +2 -0
- package/dist/apps/cli/src/apps/cli/commands/project/doctor/index.js.map +1 -1
- package/dist/apps/cli/src/utils/github.js +2 -2
- package/dist/apps/cli/src/utils/github.js.map +1 -1
- package/dist/bundles/catenv/index.js +169 -19
- package/dist/bundles/cli/index.js +240 -21
- package/dist/bundles/skills/catladder-config/SKILL.md +3 -1
- package/dist/bundles/skills/catladder-migrate-ci-backend/SKILL.md +11 -0
- package/dist/bundles/skills/catladder-pipelines/SKILL.md +27 -2
- package/dist/packages/pipeline/src/backends/github/GithubBackend.js +11 -5
- package/dist/packages/pipeline/src/backends/github/GithubBackend.js.map +1 -1
- package/dist/packages/pipeline/src/backends/github/ciVariables.d.ts +13 -2
- package/dist/packages/pipeline/src/backends/github/ciVariables.js +18 -5
- package/dist/packages/pipeline/src/backends/github/ciVariables.js.map +1 -1
- package/dist/packages/pipeline/src/backends/github/createGithubJobs.js +1 -1
- package/dist/packages/pipeline/src/backends/github/createGithubJobs.js.map +1 -1
- package/dist/packages/pipeline/src/backends/github/ghcr.d.ts +29 -0
- package/dist/packages/pipeline/src/backends/github/ghcr.js +40 -0
- package/dist/packages/pipeline/src/backends/github/ghcr.js.map +1 -0
- package/dist/packages/pipeline/src/backends/github/index.d.ts +2 -0
- package/dist/packages/pipeline/src/backends/github/index.js +2 -0
- package/dist/packages/pipeline/src/backends/github/index.js.map +1 -1
- package/dist/packages/pipeline/src/backends/github/registryImage.d.ts +20 -0
- package/dist/packages/pipeline/src/backends/github/registryImage.js +49 -0
- package/dist/packages/pipeline/src/backends/github/registryImage.js.map +1 -0
- package/dist/packages/pipeline/src/catci/shippedCatci.d.ts +8 -0
- package/dist/packages/pipeline/src/catci/shippedCatci.js +19 -4
- package/dist/packages/pipeline/src/catci/shippedCatci.js.map +1 -1
- package/dist/packages/pipeline/src/customImages/jobImagesPlan.d.ts +15 -3
- package/dist/packages/pipeline/src/customImages/jobImagesPlan.js +14 -3
- package/dist/packages/pipeline/src/customImages/jobImagesPlan.js.map +1 -1
- package/dist/packages/pipeline/src/types/config.d.ts +12 -0
- package/dist/skills/catladder-config/SKILL.md +3 -1
- package/dist/skills/catladder-migrate-ci-backend/SKILL.md +11 -0
- package/dist/skills/catladder-pipelines/SKILL.md +27 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/cli/commands/project/doctor/checkGithubImageCasing.ts +87 -0
- package/src/apps/cli/commands/project/doctor/index.ts +2 -0
- package/src/utils/github.ts +2 -4
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Config } from "../../../../../../../../packages/pipeline/src/index.js";
|
|
2
|
+
import type { DoctorReport } from "./DoctorReport";
|
|
3
|
+
/**
|
|
4
|
+
* ghcr image paths must be lowercase, but `${{ github.repository }}`
|
|
5
|
+
* interpolates github's display casing — so a repository whose owner or
|
|
6
|
+
* name contains an uppercase character needs a lowercased literal in the
|
|
7
|
+
* generated workflows. Generation bakes that in, which means committed
|
|
8
|
+
* workflows generated by an older catladder (or hand-edited ones) still
|
|
9
|
+
* carry the expression and fail every docker job with
|
|
10
|
+
* `repository name must be lowercase`.
|
|
11
|
+
*
|
|
12
|
+
* Unlike the rest of the github checks this needs no `gh` login — only
|
|
13
|
+
* the git remote and the committed files.
|
|
14
|
+
*/
|
|
15
|
+
export declare const checkGithubImageCasing: (report: DoctorReport, config: Config) => Promise<void>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkGithubImageCasing = void 0;
|
|
4
|
+
const promises_1 = require("fs/promises");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const pipeline_1 = require("../../../../../../../../packages/pipeline/src/index.js");
|
|
7
|
+
const secrets_1 = require("../../../../../secrets");
|
|
8
|
+
const WORKFLOWS_FOLDER = ".github/workflows";
|
|
9
|
+
const GENERATED_FILE_PREFIX = "catladder-";
|
|
10
|
+
/**
|
|
11
|
+
* the generated workflow files, or an empty list when none exist yet
|
|
12
|
+
*/
|
|
13
|
+
const readGeneratedWorkflows = async () => {
|
|
14
|
+
const entries = await (0, promises_1.readdir)(WORKFLOWS_FOLDER).catch(() => []);
|
|
15
|
+
return Promise.all(entries
|
|
16
|
+
.filter((file) => file.startsWith(GENERATED_FILE_PREFIX))
|
|
17
|
+
.map((file) => (0, promises_1.readFile)((0, path_1.join)(WORKFLOWS_FOLDER, file), "utf8")));
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* ghcr image paths must be lowercase, but `${{ github.repository }}`
|
|
21
|
+
* interpolates github's display casing — so a repository whose owner or
|
|
22
|
+
* name contains an uppercase character needs a lowercased literal in the
|
|
23
|
+
* generated workflows. Generation bakes that in, which means committed
|
|
24
|
+
* workflows generated by an older catladder (or hand-edited ones) still
|
|
25
|
+
* carry the expression and fail every docker job with
|
|
26
|
+
* `repository name must be lowercase`.
|
|
27
|
+
*
|
|
28
|
+
* Unlike the rest of the github checks this needs no `gh` login — only
|
|
29
|
+
* the git remote and the committed files.
|
|
30
|
+
*/
|
|
31
|
+
const checkGithubImageCasing = async (report, config) => {
|
|
32
|
+
if (!(0, pipeline_1.getEnabledPipelineTypes)(config).includes("github"))
|
|
33
|
+
return;
|
|
34
|
+
const repo = await (0, secrets_1.getConfiguredGithubRepo)();
|
|
35
|
+
if (!repo || repo === repo.toLowerCase()) {
|
|
36
|
+
// an all-lowercase repository keeps the expression on purpose (it
|
|
37
|
+
// stays correct in forks), and an unresolvable remote is reported
|
|
38
|
+
// by checkGithub already
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
report.section("github image names");
|
|
42
|
+
const workflows = await readGeneratedWorkflows();
|
|
43
|
+
if (workflows.length === 0) {
|
|
44
|
+
report.warn(`no generated workflows in ${WORKFLOWS_FOLDER} to check`, "run: catenv");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const stale = workflows.filter((content) => content.includes(pipeline_1.GHCR_REPOSITORY_EXPRESSION));
|
|
48
|
+
if (stale.length > 0) {
|
|
49
|
+
report.fail(`'${repo}' is mixed-case, but ${stale.length}/${workflows.length} generated workflows still use ${pipeline_1.GHCR_REPOSITORY_EXPRESSION} — ghcr rejects uppercase image paths, so every docker job fails with "repository name must be lowercase"`, "run: catenv (and commit the regenerated workflows)");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const uppercase = workflows.flatMap((content) => [...content.matchAll(/ghcr\.io\/\S*[A-Z]\S*/g)].map(([match]) => match));
|
|
53
|
+
if (uppercase.length > 0) {
|
|
54
|
+
report.fail(`uppercase ghcr image paths in the generated workflows: ${[...new Set(uppercase)].join(", ")}`, `run: catenv — if it persists, set pipelines.github.repository (the '${(0, pipeline_1.getPipelineGitRemote)(config, "github")}' remote resolves to '${repo}')`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
report.ok(`ghcr image paths lowercased for '${repo}'`);
|
|
58
|
+
};
|
|
59
|
+
exports.checkGithubImageCasing = checkGithubImageCasing;
|
|
60
|
+
//# sourceMappingURL=checkGithubImageCasing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkGithubImageCasing.js","sourceRoot":"","sources":["../../../../../../../../../src/apps/cli/commands/project/doctor/checkGithubImageCasing.ts"],"names":[],"mappings":";;;AAAA,0CAAgD;AAChD,+BAA4B;AAE5B,kDAI6B;AAC7B,oDAAiE;AAGjE,MAAM,gBAAgB,GAAG,mBAAmB,CA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E,CACzC,OAAO,CAAC,QAAQ,CAAC,qCAA0B,CAAC,CAC7C,CAAC;IACF,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CACT,IAAI,IAAI,wBAAwB,KAAK,CAAC,MAAM,IAAI,SAAS,CAAC,MAAM,kCAAkC,qCAA0B,2GAA2G,EACvO,oDAAoD,CACrD,CAAC;QACF,OAAO;IACT,CAAC;IAED,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC9C,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CACxE,CAAC;IACF,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,CAAC,IAAI,CACT,0DAA0D,CAAC,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAC9F,uEAAuE,IAAA,+BAAoB,EAAC,MAAM,EAAE,QAAQ,CAAC,yBAAyB,IAAI,IAAI,CAC/I,CAAC;QACF,OAAO;IACT,CAAC;IAED,MAAM,CAAC,EAAE,CAAC,oCAAoC,IAAI,GAAG,CAAC,CAAC;AACzD,CAAC,CAAC;AAhDW,QAAA,sBAAsB,0BAgDjC"}
|
|
@@ -5,6 +5,7 @@ const pipeline_1 = require("../../../../../../../../packages/pipeline/src/index.
|
|
|
5
5
|
const getProjectConfig_1 = require("../../../../../config/getProjectConfig");
|
|
6
6
|
const checkCloudRun_1 = require("./checkCloudRun");
|
|
7
7
|
const checkGithub_1 = require("./checkGithub");
|
|
8
|
+
const checkGithubImageCasing_1 = require("./checkGithubImageCasing");
|
|
8
9
|
const checkGitlab_1 = require("./checkGitlab");
|
|
9
10
|
const checkStore_1 = require("./checkStore");
|
|
10
11
|
const DoctorReport_1 = require("./DoctorReport");
|
|
@@ -40,6 +41,7 @@ const doctorProject = async (instance, onlyComponents) => {
|
|
|
40
41
|
await (0, checkGitlab_1.checkGitlab)(instance, report, contexts);
|
|
41
42
|
}
|
|
42
43
|
await (0, checkCloudRun_1.checkCloudRun)(report, contexts);
|
|
44
|
+
await (0, checkGithubImageCasing_1.checkGithubImageCasing)(report, config);
|
|
43
45
|
await (0, checkGithub_1.checkGithub)(report, config);
|
|
44
46
|
report.summarize();
|
|
45
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../src/apps/cli/commands/project/doctor/index.ts"],"names":[],"mappings":";;;AACA,kDAA8D;AAC9D,6EAGgD;AAEhD,mDAAgD;AAChD,+CAA4C;AAC5C,+CAA4C;AAC5C,6CAA0C;AAC1C,iDAA8C;AAE9C;;;;;;;;;;;GAWG;AACI,MAAM,aAAa,GAAG,KAAK,EAChC,QAAY,EACZ,cAAkC,EAClC,EAAE;IACF,MAAM,MAAM,GAAG,MAAM,IAAA,mCAAgB,GAAE,CAAC;IACxC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IACD,QAAQ,CAAC,GAAG,CACV,oEAAoE,CACrE,CAAC;IAEF,MAAM,MAAM,GAAG,IAAI,2BAAY,CAAC,QAAQ,CAAC,CAAC;IAC1C,MAAM,IAAA,uBAAU,EAAC,MAAM,CAAC,CAAC;IAEzB,IAAI,QAAQ,GAAuB,EAAE,CAAC;IACtC,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,IAAA,yCAAsB,EAAC,cAAc,CAAC,CAAC;IAC1D,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;QACpC,MAAM,CAAC,IAAI,CACT,uCAAuC,CAAC,CAAC,OAAO,EAAE,EAClD,8B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MAAM,CAAC,IAAI,CACT,uCAAuC,CAAC,CAAC,OAAO,EAAE,EAClD,8BAA8B,CAC/B,CAAC;IACJ,CAAC;IAED,IAAI,IAAA,kCAAuB,EAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvD,MAAM,IAAA,yBAAW,EAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAChD,CAAC;IACD,MAAM,IAAA,6BAAa,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACtC,MAAM,IAAA,+CAAsB,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,MAAM,IAAA,yBAAW,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAElC,MAAM,CAAC,SAAS,EAAE,CAAC;AACrB,CAAC,CAAC;AAlCW,QAAA,aAAa,iBAkCxB"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ghApiJson = exports.ensureGithubEnvironment = exports.setGithubVariable = exports.setGithubSecret = exports.listGithubVariableNames = exports.listGithubSecretNames = exports.listGithubEnvironments = exports.getGithubRepoFromRemote = exports.isGhAuthenticated = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const util_1 = require("util");
|
|
6
|
+
const pipeline_1 = require("../../../../packages/pipeline/src/index.js");
|
|
6
7
|
const execFile = (0, util_1.promisify)(child_process_1.execFile);
|
|
7
8
|
/**
|
|
8
9
|
* whether the github cli (gh) is installed and authenticated
|
|
@@ -25,8 +26,7 @@ exports.isGhAuthenticated = isGhAuthenticated;
|
|
|
25
26
|
const getGithubRepoFromRemote = async (remoteName) => {
|
|
26
27
|
try {
|
|
27
28
|
const { stdout } = await execFile("git", ["remote", "get-url", remoteName]);
|
|
28
|
-
|
|
29
|
-
return match === null || match === void 0 ? void 0 : match[1];
|
|
29
|
+
return (0, pipeline_1.parseGithubRepoFromRemoteUrl)(stdout);
|
|
30
30
|
}
|
|
31
31
|
catch (_a) {
|
|
32
32
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.js","sourceRoot":"","sources":["../../../../../src/utils/github.ts"],"names":[],"mappings":";;;AAAA,iDAA8D;AAC9D,+BAAiC;
|
|
1
|
+
{"version":3,"file":"github.js","sourceRoot":"","sources":["../../../../../src/utils/github.ts"],"names":[],"mappings":";;;AAAA,iDAA8D;AAC9D,+BAAiC;AACjC,kDAAmE;AAEnE,MAAM,QAAQ,GAAG,IAAA,gBAAS,EAAC,wBAAU,CAAC,CAAC;AAEvC;;GAEG;AACI,MAAM,iBAAiB,GAAG,KAAK,IAAsB,EAAE;IAC5D,IAAI,CAAC;QACH,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAPW,QAAA,iBAAiB,qBAO5B;AAEF;;;;GAIG;AACI,MAAM,uBAAuB,GAAG,KAAK,EAC1C,UAAkB,EACW,EAAE;IAC/B,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;QAC5E,OAAO,IAAA,uCAA4B,EAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC;AATW,QAAA,uBAAuB,2BASlC;AAEF;;;GAGG;AACH,MAAM,UAAU,GAAG,KAAK,EAAE,IAAY,EAAE,EAAU,EAAqB,EAAE;IACvE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,QAAQ,CAC/B,IAAI,EACJ,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAA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 const path_1 = __nccwpck_require__(16928);
|
|
|
2642
2642
|
const createAllJobs_1 = __nccwpck_require__(83477);
|
|
2643
2643
|
const config_1 = __nccwpck_require__(75591);
|
|
2644
2644
|
const ciVariables_1 = __nccwpck_require__(17300);
|
|
2645
|
+
const registryImage_1 = __nccwpck_require__(24333);
|
|
2645
2646
|
const index_1 = __nccwpck_require__(62853);
|
|
2646
2647
|
const createGithubJobs_1 = __nccwpck_require__(73474);
|
|
2647
2648
|
const jobImagesPlan_1 = __nccwpck_require__(59623);
|
|
@@ -2695,7 +2696,10 @@ class GithubBackend {
|
|
|
2695
2696
|
await (0, promises_1.rm)(scriptFiles_1.GITHUB_SCRIPTS_FOLDER, { recursive: true, force: true });
|
|
2696
2697
|
}
|
|
2697
2698
|
async createFiles(config) {
|
|
2698
|
-
|
|
2699
|
+
// ghcr rejects uppercase image paths, and `${{ github.repository }}`
|
|
2700
|
+
// interpolates github's display casing — a mixed-case owner or repo
|
|
2701
|
+
// needs a lowercased literal instead (see ./ghcr)
|
|
2702
|
+
const images = this.createImagesPlan(config, await (0, registryImage_1.resolveGithubRegistryImage)(config));
|
|
2699
2703
|
const scripts = new scriptFiles_1.GithubScriptFiles();
|
|
2700
2704
|
const workflows = await this.createWorkflows(config, images, scripts);
|
|
2701
2705
|
return [
|
|
@@ -2710,8 +2714,8 @@ class GithubBackend {
|
|
|
2710
2714
|
...(0, shippedCatci_1.getCatciGeneratedFiles)(),
|
|
2711
2715
|
];
|
|
2712
2716
|
}
|
|
2713
|
-
createImagesPlan(config) {
|
|
2714
|
-
return new jobImagesPlan_1.JobImagesPlan(this.type, config.images);
|
|
2717
|
+
createImagesPlan(config, registryImage) {
|
|
2718
|
+
return new jobImagesPlan_1.JobImagesPlan(this.type, config.images, registryImage);
|
|
2715
2719
|
}
|
|
2716
2720
|
/**
|
|
2717
2721
|
* all workflows keyed by file name, mainly for testing purposes
|
|
@@ -2720,9 +2724,11 @@ class GithubBackend {
|
|
|
2720
2724
|
var _a, _b, _c, _d;
|
|
2721
2725
|
const workflows = {};
|
|
2722
2726
|
// per-pipeline-type variables (pipelines.github.runnerVariables);
|
|
2723
|
-
// workflow-level env, so job-level runnerVariables take precedence
|
|
2727
|
+
// workflow-level env, so job-level runnerVariables take precedence.
|
|
2728
|
+
// The images plan is the single source of the ghcr namespace, so the
|
|
2729
|
+
// workflow env and the container images can never disagree.
|
|
2724
2730
|
const workflowEnv = {
|
|
2725
|
-
...ciVariables_1.
|
|
2731
|
+
...(0, ciVariables_1.getGithubInjectedWorkflowEnv)(images.registryImageRef()),
|
|
2726
2732
|
...(0, index_1.getPipelineOptions)(config, this.type).runnerVariables,
|
|
2727
2733
|
};
|
|
2728
2734
|
const reviewStopJobs = {};
|
|
@@ -3065,12 +3071,13 @@ exports.makeAggregateCheckJob = makeAggregateCheckJob;
|
|
|
3065
3071
|
/***/ }),
|
|
3066
3072
|
|
|
3067
3073
|
/***/ 17300:
|
|
3068
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
3074
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
3069
3075
|
|
|
3070
3076
|
"use strict";
|
|
3071
3077
|
|
|
3072
3078
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3073
|
-
exports.
|
|
3079
|
+
exports.GITHUB_INJECTED_WORKFLOW_ENV_NAMES = exports.getGithubInjectedWorkflowEnv = exports.GITHUB_CI_VARIABLES = void 0;
|
|
3080
|
+
const ghcr_1 = __nccwpck_require__(59011);
|
|
3074
3081
|
/**
|
|
3075
3082
|
* how the github backend names the predefined CI variables.
|
|
3076
3083
|
*
|
|
@@ -3091,16 +3098,28 @@ exports.GITHUB_CI_VARIABLES = {
|
|
|
3091
3098
|
};
|
|
3092
3099
|
/**
|
|
3093
3100
|
* the workflow-level env the backend injects to provide the CL_*
|
|
3094
|
-
* variables referenced by {@link GITHUB_CI_VARIABLES}
|
|
3101
|
+
* variables referenced by {@link GITHUB_CI_VARIABLES}.
|
|
3102
|
+
*
|
|
3103
|
+
* `registryImage` is the ghcr namespace to push to — the actions
|
|
3104
|
+
* expression for an all-lowercase repository, a lowercased literal for
|
|
3105
|
+
* a mixed-case one (see `./ghcr`).
|
|
3095
3106
|
*/
|
|
3096
|
-
|
|
3107
|
+
const getGithubInjectedWorkflowEnv = (registryImage = ghcr_1.GHCR_REPOSITORY_EXPRESSION) => ({
|
|
3097
3108
|
CL_JOB_TOKEN: "${{ github.token }}",
|
|
3098
3109
|
CL_REGISTRY: "ghcr.io",
|
|
3099
|
-
CL_REGISTRY_IMAGE:
|
|
3110
|
+
CL_REGISTRY_IMAGE: registryImage,
|
|
3100
3111
|
CL_REGISTRY_USER: "${{ github.actor }}",
|
|
3101
3112
|
// empty outside of pull request events
|
|
3102
3113
|
CL_PR_NUMBER: "${{ github.event.number }}",
|
|
3103
|
-
};
|
|
3114
|
+
});
|
|
3115
|
+
exports.getGithubInjectedWorkflowEnv = getGithubInjectedWorkflowEnv;
|
|
3116
|
+
/**
|
|
3117
|
+
* the names of the injected workflow-level env — the values differ per
|
|
3118
|
+
* repository (see {@link getGithubInjectedWorkflowEnv}), the names never
|
|
3119
|
+
* do, so lookups that only ask "does the workflow already provide this?"
|
|
3120
|
+
* use this instead.
|
|
3121
|
+
*/
|
|
3122
|
+
exports.GITHUB_INJECTED_WORKFLOW_ENV_NAMES = new Set(Object.keys((0, exports.getGithubInjectedWorkflowEnv)()));
|
|
3104
3123
|
//# sourceMappingURL=ciVariables.js.map
|
|
3105
3124
|
|
|
3106
3125
|
/***/ }),
|
|
@@ -3327,7 +3346,7 @@ const getSecretsEnv = (context, kinds) => {
|
|
|
3327
3346
|
*/
|
|
3328
3347
|
const getReferencedSecretsEnv = (script, kinds) => Object.fromEntries([...script.matchAll(/\$\{?(CL_[A-Za-z0-9_]+)\}?/g)]
|
|
3329
3348
|
.map((match) => match[1])
|
|
3330
|
-
.filter((name) => !(name
|
|
3349
|
+
.filter((name) => !ciVariables_1.GITHUB_INJECTED_WORKFLOW_ENV_NAMES.has(name))
|
|
3331
3350
|
.map((name) => [name, vaultValueExpression(name, kinds)]));
|
|
3332
3351
|
const makeGithubJob = (context, job, allJobs, uploadProviderIds, images, scripts, secretKinds = new Map()) => {
|
|
3333
3352
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
@@ -3591,6 +3610,53 @@ exports.makeEnsureImageGithubJobs = makeEnsureImageGithubJobs;
|
|
|
3591
3610
|
|
|
3592
3611
|
/***/ }),
|
|
3593
3612
|
|
|
3613
|
+
/***/ 59011:
|
|
3614
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
3615
|
+
|
|
3616
|
+
"use strict";
|
|
3617
|
+
|
|
3618
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3619
|
+
exports.toGhcrRegistryImage = exports.parseGithubRepoFromRemoteUrl = exports.GHCR_REPOSITORY_EXPRESSION = void 0;
|
|
3620
|
+
/**
|
|
3621
|
+
* the ghcr namespace expressed through the actions context — portable
|
|
3622
|
+
* across forks, and what every all-lowercase repository keeps using
|
|
3623
|
+
*/
|
|
3624
|
+
exports.GHCR_REPOSITORY_EXPRESSION = "ghcr.io/${{ github.repository }}";
|
|
3625
|
+
/**
|
|
3626
|
+
* parses `owner/name` out of a github remote url (ssh or https, with or
|
|
3627
|
+
* without the `.git` suffix).
|
|
3628
|
+
*
|
|
3629
|
+
* Shared with the cli (`apps/cli/src/utils/github.ts`) so the two can't
|
|
3630
|
+
* drift apart.
|
|
3631
|
+
*/
|
|
3632
|
+
const parseGithubRepoFromRemoteUrl = (url) => { var _a; return (_a = url.match(/github\.com[:/]([\w.-]+\/[\w.-]+?)(\.git)?\s*$/)) === null || _a === void 0 ? void 0 : _a[1]; };
|
|
3633
|
+
exports.parseGithubRepoFromRemoteUrl = parseGithubRepoFromRemoteUrl;
|
|
3634
|
+
/**
|
|
3635
|
+
* the ghcr image prefix for an `owner/name` repository.
|
|
3636
|
+
*
|
|
3637
|
+
* The OCI distribution spec only allows `[a-z0-9]` plus `.`, `_` and `-`
|
|
3638
|
+
* separators in a repository name, so a mixed-case owner or repo (very
|
|
3639
|
+
* common for org logins: `AcmeCorp`, …) makes the docker client reject
|
|
3640
|
+
* every tag before it even reaches the network. Lowercasing is not a
|
|
3641
|
+
* workaround: the org `AcmeCorp` owns the namespace `ghcr.io/acmecorp`,
|
|
3642
|
+
* so the lowercased path is the correct address.
|
|
3643
|
+
*
|
|
3644
|
+
* Returns the `${{ github.repository }}` expression when lowercasing
|
|
3645
|
+
* would change nothing — it is equivalent for those repositories, and
|
|
3646
|
+
* unlike a literal it keeps working in a fork (whose token can only
|
|
3647
|
+
* push to the fork's own namespace).
|
|
3648
|
+
*/
|
|
3649
|
+
const toGhcrRegistryImage = (repository) => {
|
|
3650
|
+
const lowercased = repository.toLowerCase();
|
|
3651
|
+
return lowercased === repository
|
|
3652
|
+
? exports.GHCR_REPOSITORY_EXPRESSION
|
|
3653
|
+
: `ghcr.io/${lowercased}`;
|
|
3654
|
+
};
|
|
3655
|
+
exports.toGhcrRegistryImage = toGhcrRegistryImage;
|
|
3656
|
+
//# sourceMappingURL=ghcr.js.map
|
|
3657
|
+
|
|
3658
|
+
/***/ }),
|
|
3659
|
+
|
|
3594
3660
|
/***/ 25073:
|
|
3595
3661
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
3596
3662
|
|
|
@@ -3900,12 +3966,70 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
3900
3966
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3901
3967
|
__exportStar(__nccwpck_require__(48476), exports);
|
|
3902
3968
|
__exportStar(__nccwpck_require__(17300), exports);
|
|
3969
|
+
__exportStar(__nccwpck_require__(59011), exports);
|
|
3970
|
+
__exportStar(__nccwpck_require__(24333), exports);
|
|
3903
3971
|
__exportStar(__nccwpck_require__(61071), exports);
|
|
3904
3972
|
__exportStar(__nccwpck_require__(82145), exports);
|
|
3905
3973
|
//# sourceMappingURL=index.js.map
|
|
3906
3974
|
|
|
3907
3975
|
/***/ }),
|
|
3908
3976
|
|
|
3977
|
+
/***/ 24333:
|
|
3978
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
3979
|
+
|
|
3980
|
+
"use strict";
|
|
3981
|
+
|
|
3982
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3983
|
+
exports.resolveGithubRegistryImage = exports.githubRegistryImageFromConfig = void 0;
|
|
3984
|
+
const child_process_1 = __nccwpck_require__(35317);
|
|
3985
|
+
const util_1 = __nccwpck_require__(39023);
|
|
3986
|
+
const index_1 = __nccwpck_require__(62853);
|
|
3987
|
+
const ghcr_1 = __nccwpck_require__(59011);
|
|
3988
|
+
const execFile = (0, util_1.promisify)(child_process_1.execFile);
|
|
3989
|
+
/**
|
|
3990
|
+
* the ghcr image prefix derived from the config alone
|
|
3991
|
+
* (`pipelines.github.repository`), without touching git.
|
|
3992
|
+
*
|
|
3993
|
+
* Used where generation must stay pure and hermetic (tests, examples);
|
|
3994
|
+
* {@link resolveGithubRegistryImage} adds the git remote fallback.
|
|
3995
|
+
*/
|
|
3996
|
+
const githubRegistryImageFromConfig = (config) => {
|
|
3997
|
+
const { repository } = (0, index_1.getPipelineOptions)(config, "github");
|
|
3998
|
+
return repository ? (0, ghcr_1.toGhcrRegistryImage)(repository) : undefined;
|
|
3999
|
+
};
|
|
4000
|
+
exports.githubRegistryImageFromConfig = githubRegistryImageFromConfig;
|
|
4001
|
+
/**
|
|
4002
|
+
* the ghcr image prefix to generate with: the configured repository, or
|
|
4003
|
+
* the one the github git remote points at.
|
|
4004
|
+
*
|
|
4005
|
+
* Falls back to the `${{ github.repository }}` expression when the
|
|
4006
|
+
* remote is unavailable (a checkout without the remote, a tarball, …).
|
|
4007
|
+
* That is the pre-existing behavior and correct for every all-lowercase
|
|
4008
|
+
* repository; `project doctor` catches the mixed-case case it is not
|
|
4009
|
+
* correct for.
|
|
4010
|
+
*/
|
|
4011
|
+
const resolveGithubRegistryImage = async (config) => {
|
|
4012
|
+
const fromConfig = (0, exports.githubRegistryImageFromConfig)(config);
|
|
4013
|
+
if (fromConfig) {
|
|
4014
|
+
return fromConfig;
|
|
4015
|
+
}
|
|
4016
|
+
const remote = (0, index_1.getPipelineGitRemote)(config, "github");
|
|
4017
|
+
try {
|
|
4018
|
+
const { stdout } = await execFile("git", ["remote", "get-url", remote]);
|
|
4019
|
+
const repository = (0, ghcr_1.parseGithubRepoFromRemoteUrl)(stdout);
|
|
4020
|
+
return repository
|
|
4021
|
+
? (0, ghcr_1.toGhcrRegistryImage)(repository)
|
|
4022
|
+
: ghcr_1.GHCR_REPOSITORY_EXPRESSION;
|
|
4023
|
+
}
|
|
4024
|
+
catch (_a) {
|
|
4025
|
+
return ghcr_1.GHCR_REPOSITORY_EXPRESSION;
|
|
4026
|
+
}
|
|
4027
|
+
};
|
|
4028
|
+
exports.resolveGithubRegistryImage = resolveGithubRegistryImage;
|
|
4029
|
+
//# sourceMappingURL=registryImage.js.map
|
|
4030
|
+
|
|
4031
|
+
/***/ }),
|
|
4032
|
+
|
|
3909
4033
|
/***/ 61071:
|
|
3910
4034
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
3911
4035
|
|
|
@@ -7045,7 +7169,7 @@ exports.isOfBuildType = isOfBuildType;
|
|
|
7045
7169
|
"use strict";
|
|
7046
7170
|
|
|
7047
7171
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7048
|
-
exports.getCatciGeneratedFiles = exports.GENERATED_CATCI_FOLDER = void 0;
|
|
7172
|
+
exports.getCatciGeneratedFiles = exports.makeCatciGeneratedFiles = exports.GENERATED_CATCI_FOLDER = void 0;
|
|
7049
7173
|
const fs_1 = __nccwpck_require__(79896);
|
|
7050
7174
|
const path_1 = __nccwpck_require__(16928);
|
|
7051
7175
|
exports.GENERATED_CATCI_FOLDER = ".catladder-generated/catci";
|
|
@@ -7073,14 +7197,29 @@ const getShippedCatciBundle = () => {
|
|
|
7073
7197
|
return found;
|
|
7074
7198
|
};
|
|
7075
7199
|
/**
|
|
7076
|
-
* the
|
|
7200
|
+
* the files that make up the materialized catci folder for a given
|
|
7201
|
+
* bundle content
|
|
7077
7202
|
*/
|
|
7078
|
-
const
|
|
7203
|
+
const makeCatciGeneratedFiles = (bundle) => [
|
|
7079
7204
|
{
|
|
7080
7205
|
path: (0, path_1.join)(exports.GENERATED_CATCI_FOLDER, "index.js"),
|
|
7081
|
-
content:
|
|
7206
|
+
content: bundle,
|
|
7207
|
+
},
|
|
7208
|
+
{
|
|
7209
|
+
// the bundle is commonjs (ncc output using `__dirname`), but node
|
|
7210
|
+
// resolves the module format from the nearest package.json: a
|
|
7211
|
+
// consumer whose root package.json declares `"type": "module"`
|
|
7212
|
+
// would parse the bundle as ESM and crash on the first `__dirname`.
|
|
7213
|
+
// a sibling package.json pins the folder to commonjs regardless.
|
|
7214
|
+
path: (0, path_1.join)(exports.GENERATED_CATCI_FOLDER, "package.json"),
|
|
7215
|
+
content: `${JSON.stringify({ type: "commonjs" }, null, 2)}\n`,
|
|
7082
7216
|
},
|
|
7083
7217
|
];
|
|
7218
|
+
exports.makeCatciGeneratedFiles = makeCatciGeneratedFiles;
|
|
7219
|
+
/**
|
|
7220
|
+
* the catci files to materialize into the generated folder
|
|
7221
|
+
*/
|
|
7222
|
+
const getCatciGeneratedFiles = () => (0, exports.makeCatciGeneratedFiles)((0, fs_1.readFileSync)(getShippedCatciBundle(), "utf-8"));
|
|
7084
7223
|
exports.getCatciGeneratedFiles = getCatciGeneratedFiles;
|
|
7085
7224
|
//# sourceMappingURL=shippedCatci.js.map
|
|
7086
7225
|
|
|
@@ -8015,6 +8154,7 @@ exports.JobImagesPlan = exports.PROJECT_IMAGES_FOLDER = exports.GENERATED_IMAGES
|
|
|
8015
8154
|
const fs_1 = __nccwpck_require__(79896);
|
|
8016
8155
|
const path_1 = __nccwpck_require__(16928);
|
|
8017
8156
|
const ciVariables_1 = __nccwpck_require__(91215);
|
|
8157
|
+
const ghcr_1 = __nccwpck_require__(59011);
|
|
8018
8158
|
const docker_1 = __nccwpck_require__(12354);
|
|
8019
8159
|
const runner_1 = __nccwpck_require__(92146);
|
|
8020
8160
|
const gitlab_1 = __nccwpck_require__(86962);
|
|
@@ -8075,9 +8215,16 @@ exports.PROJECT_IMAGES_FOLDER = `${exports.GENERATED_IMAGES_FOLDER}/project`;
|
|
|
8075
8215
|
* Reference-driven: only images actually used by a job are built.
|
|
8076
8216
|
*/
|
|
8077
8217
|
class JobImagesPlan {
|
|
8078
|
-
constructor(pipelineType, projectImages = {}
|
|
8218
|
+
constructor(pipelineType, projectImages = {},
|
|
8219
|
+
/**
|
|
8220
|
+
* the registry image prefix to generate with, overriding the
|
|
8221
|
+
* pipeline type's default. On github this carries the lowercased
|
|
8222
|
+
* ghcr namespace (see `resolveGithubRegistryImage`).
|
|
8223
|
+
*/
|
|
8224
|
+
registryImage) {
|
|
8079
8225
|
this.pipelineType = pipelineType;
|
|
8080
8226
|
this.projectImages = projectImages;
|
|
8227
|
+
this.registryImage = registryImage;
|
|
8081
8228
|
this.used = new Map();
|
|
8082
8229
|
this.usedProject = new Map();
|
|
8083
8230
|
}
|
|
@@ -8102,11 +8249,14 @@ class JobImagesPlan {
|
|
|
8102
8249
|
}
|
|
8103
8250
|
/**
|
|
8104
8251
|
* the registry image prefix. On github, container images can't use
|
|
8105
|
-
* runtime env vars —
|
|
8252
|
+
* runtime env vars — a literal or an actions expression is required.
|
|
8106
8253
|
*/
|
|
8107
8254
|
registryImageRef() {
|
|
8255
|
+
if (this.registryImage) {
|
|
8256
|
+
return this.registryImage;
|
|
8257
|
+
}
|
|
8108
8258
|
return this.pipelineType === "github"
|
|
8109
|
-
?
|
|
8259
|
+
? ghcr_1.GHCR_REPOSITORY_EXPRESSION
|
|
8110
8260
|
: `${(0, ciVariables_1.getCiVariable)({ pipelineType: this.pipelineType }, "registryImage")}`;
|
|
8111
8261
|
}
|
|
8112
8262
|
useProject(name) {
|