@catladder/cli 0.0.0-next-71c49b28 → 0.0.0-next-5dc1f907
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 +75 -12
- package/dist/bundles/cli/index.js +847 -51
- package/dist/cli/src/apps/cli/commands/project/doctor/DoctorReport.d.ts +22 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/DoctorReport.js +75 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/DoctorReport.js.map +1 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/GcloudProjectInspector.d.ts +15 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/GcloudProjectInspector.js +59 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/GcloudProjectInspector.js.map +1 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/checkCloudRun.d.ts +13 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/checkCloudRun.js +120 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/checkCloudRun.js.map +1 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/checkGithub.d.ts +10 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/checkGithub.js +100 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/checkGithub.js.map +1 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/checkGitlab.d.ts +13 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/checkGitlab.js +79 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/checkGitlab.js.map +1 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/checkStore.d.ts +8 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/checkStore.js +44 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/checkStore.js.map +1 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/index.d.ts +14 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/index.js +48 -0
- package/dist/cli/src/apps/cli/commands/project/doctor/index.js.map +1 -0
- package/dist/cli/src/apps/cli/commands/project/setup/setupAccessTokens.js +4 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.d.ts +21 -0
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js +31 -11
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
- package/dist/cli/src/commands/index.d.ts +1 -0
- package/dist/cli/src/commands/index.js +8 -1
- package/dist/cli/src/commands/index.js.map +1 -1
- package/dist/cli/src/commands/project/commandDoctor.d.ts +8 -0
- package/dist/cli/src/commands/project/commandDoctor.js +25 -0
- package/dist/cli/src/commands/project/commandDoctor.js.map +1 -0
- package/dist/cli/src/gcloud/artifactsRegistry.d.ts +1 -0
- package/dist/cli/src/gcloud/artifactsRegistry.js +3 -2
- package/dist/cli/src/gcloud/artifactsRegistry.js.map +1 -1
- package/dist/cli/src/gcloud/serviceAccountNames.d.ts +28 -0
- package/dist/cli/src/gcloud/serviceAccountNames.js +51 -0
- package/dist/cli/src/gcloud/serviceAccountNames.js.map +1 -0
- package/dist/cli/src/gcloud/serviceAccounts.js +6 -27
- package/dist/cli/src/gcloud/serviceAccounts.js.map +1 -1
- package/dist/cli/src/utils/concurrency.d.ts +7 -0
- package/dist/cli/src/utils/concurrency.js +27 -0
- package/dist/cli/src/utils/concurrency.js.map +1 -0
- package/dist/cli/src/utils/github.d.ts +10 -0
- package/dist/cli/src/utils/github.js +26 -1
- package/dist/cli/src/utils/github.js.map +1 -1
- package/dist/cli/src/utils/gitlab.d.ts +6 -0
- package/dist/cli/src/utils/gitlab.js +19 -1
- package/dist/cli/src/utils/gitlab.js.map +1 -1
- package/dist/pipeline/src/backends/github/createGithubJobs.js +24 -2
- package/dist/pipeline/src/backends/github/createGithubJobs.js.map +1 -1
- package/dist/pipeline/src/backends/gitlab/createGitlabJobs.js +8 -7
- package/dist/pipeline/src/backends/gitlab/createGitlabJobs.js.map +1 -1
- package/dist/pipeline/src/build/cache/createJobCache.js +8 -0
- package/dist/pipeline/src/build/cache/createJobCache.js.map +1 -1
- package/dist/pipeline/src/build/node/cache.js +15 -1
- package/dist/pipeline/src/build/node/cache.js.map +1 -1
- package/dist/pipeline/src/build/types.d.ts +19 -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 +6 -0
- 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/doctor/DoctorReport.ts +72 -0
- package/src/apps/cli/commands/project/doctor/GcloudProjectInspector.ts +77 -0
- package/src/apps/cli/commands/project/doctor/checkCloudRun.ts +148 -0
- package/src/apps/cli/commands/project/doctor/checkGithub.ts +156 -0
- package/src/apps/cli/commands/project/doctor/checkGitlab.ts +133 -0
- package/src/apps/cli/commands/project/doctor/checkStore.ts +43 -0
- package/src/apps/cli/commands/project/doctor/index.ts +59 -0
- package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +9 -2
- package/src/apps/cli/commands/project/setup/setupCloudRun.ts +42 -21
- package/src/commands/index.ts +1 -0
- package/src/commands/project/commandDoctor.ts +21 -0
- package/src/gcloud/__tests__/serviceAccountNames.test.ts +63 -0
- package/src/gcloud/artifactsRegistry.ts +3 -1
- package/src/gcloud/serviceAccountNames.ts +65 -0
- package/src/gcloud/serviceAccounts.ts +6 -38
- package/src/utils/concurrency.ts +25 -0
- package/src/utils/github.ts +48 -0
- package/src/utils/gitlab.ts +24 -0
- package/tsconfig.json +2 -1
|
@@ -737,7 +737,7 @@ var __importDefault = this && this.__importDefault || function (mod) {
|
|
|
737
737
|
Object.defineProperty(exports, "__esModule", ({
|
|
738
738
|
value: true
|
|
739
739
|
}));
|
|
740
|
-
exports.upsertAllVariables = exports.clearBackups = exports.getVariableValueByRawName = exports.getAllVariables = exports.getProjectInfo = exports.doGitlabRequest = exports.getGitlabToken = exports.setupGitlabToken = exports.hasGitlabToken = void 0;
|
|
740
|
+
exports.upsertAllVariables = exports.clearBackups = exports.getVariableValueByRawName = exports.getAllVariables = exports.getProjectInfo = exports.doGitlabRequestAllPages = exports.doGitlabRequest = exports.getGitlabToken = exports.setupGitlabToken = exports.hasGitlabToken = void 0;
|
|
741
741
|
const pipeline_1 = __nccwpck_require__(60241);
|
|
742
742
|
const lodash_es_1 = __nccwpck_require__(64284);
|
|
743
743
|
const memoizee_1 = __importDefault(__nccwpck_require__(57009));
|
|
@@ -808,6 +808,24 @@ const doGitlabRequest = async (io, path, data = undefined, method = "GET") => {
|
|
|
808
808
|
throw new Error(`Could not send request to gitlab api ${path}: ${result.status} "${result.statusText}".\nResponse: ${JSON.stringify(await result.json(), null, 2)}`);
|
|
809
809
|
};
|
|
810
810
|
exports.doGitlabRequest = doGitlabRequest;
|
|
811
|
+
/**
|
|
812
|
+
* GET a list endpoint across ALL pages (gitlab returns 20 items per
|
|
813
|
+
* page by default — long-lived projects easily exceed that, e.g.
|
|
814
|
+
* rotated access tokens accumulate one entry per rotation)
|
|
815
|
+
*/
|
|
816
|
+
const doGitlabRequestAllPages = async (io, path) => {
|
|
817
|
+
const PER_PAGE = 100;
|
|
818
|
+
const separator = path.includes("?") ? "&" : "?";
|
|
819
|
+
const all = [];
|
|
820
|
+
for (let page = 1;; page++) {
|
|
821
|
+
const items = await (0, exports.doGitlabRequest)(io, `${path}${separator}per_page=${PER_PAGE}&page=${page}`);
|
|
822
|
+
if (!(items === null || items === void 0 ? void 0 : items.length)) break;
|
|
823
|
+
all.push(...items);
|
|
824
|
+
if (items.length < PER_PAGE) break;
|
|
825
|
+
}
|
|
826
|
+
return all;
|
|
827
|
+
};
|
|
828
|
+
exports.doGitlabRequestAllPages = doGitlabRequestAllPages;
|
|
811
829
|
const getProjectInfo = async io => {
|
|
812
830
|
const {
|
|
813
831
|
gitRemotePath
|
|
@@ -1890,13 +1908,25 @@ const resolveGithubNeeds = (context, job, allJobs, extraNeeds = []) => {
|
|
|
1890
1908
|
return [...new Map(resolved.map(n => [n.id, n])).values()].sort((a, b) => a.id.localeCompare(b.id));
|
|
1891
1909
|
};
|
|
1892
1910
|
exports.resolveGithubNeeds = resolveGithubNeeds;
|
|
1911
|
+
/** step id of a referenceable cache restore step (see `cacheId`) */
|
|
1912
|
+
const cacheStepId = cacheId => `cache-${cacheId.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
|
|
1893
1913
|
const createCacheSteps = (context, job) => {
|
|
1894
1914
|
var _a, _b;
|
|
1895
1915
|
if (!((_a = job.caches) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1896
1916
|
return [];
|
|
1897
1917
|
}
|
|
1898
|
-
const lowered = (_b = (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, job.caches)) !== null && _b !== void 0 ? _b : [];
|
|
1899
|
-
|
|
1918
|
+
const lowered = (0, utils_1.ensureArray)((_b = (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, job.caches)) !== null && _b !== void 0 ? _b : []);
|
|
1919
|
+
// caches marked redundantOnExactHitOf skip their (expensive) restore
|
|
1920
|
+
// when the referenced sibling cache hit its exact key — e.g. the yarn
|
|
1921
|
+
// zip cache is never read when node_modules restored for the same
|
|
1922
|
+
// lockfile. The referenced cache's step must come first (its
|
|
1923
|
+
// `cache-hit` output drives the `if`), so providers are emitted
|
|
1924
|
+
// before dependents; the reorder is github-only and does not affect
|
|
1925
|
+
// the gitlab cache list.
|
|
1926
|
+
const referencedIds = new Set(lowered.map(cache => cache.redundantOnExactHitOf).filter(id => !!id));
|
|
1927
|
+
const providedIds = new Set(lowered.map(cache => cache.cacheId).filter(id => !!id));
|
|
1928
|
+
const ordered = [...lowered.filter(cache => !cache.redundantOnExactHitOf), ...lowered.filter(cache => cache.redundantOnExactHitOf)];
|
|
1929
|
+
return ordered.map(cache => {
|
|
1900
1930
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1901
1931
|
const paths = (0, utils_1.ensureArray)((_a = cache.paths) !== null && _a !== void 0 ? _a : []);
|
|
1902
1932
|
const key = cache.key;
|
|
@@ -1921,8 +1951,18 @@ const createCacheSteps = (context, job) => {
|
|
|
1921
1951
|
restoreKeyPrefix: `${(_e = key.prefix) !== null && _e !== void 0 ? _e : "files"}-`,
|
|
1922
1952
|
label: (_f = key.prefix) !== null && _f !== void 0 ? _f : ((_g = key.files) !== null && _g !== void 0 ? _g : []).join(",")
|
|
1923
1953
|
};
|
|
1954
|
+
// the sibling-hit condition only applies when the referenced cache
|
|
1955
|
+
// is actually part of this job — otherwise restore unconditionally
|
|
1956
|
+
const skipCondition = cache.redundantOnExactHitOf && providedIds.has(cache.redundantOnExactHitOf) ? `\${{ steps.${cacheStepId(cache.redundantOnExactHitOf)}.outputs.cache-hit != 'true' }}` : undefined;
|
|
1924
1957
|
return {
|
|
1925
1958
|
name: `Cache ${label}`,
|
|
1959
|
+
// referenced caches carry an id so dependents can read cache-hit
|
|
1960
|
+
...(cache.cacheId && referencedIds.has(cache.cacheId) ? {
|
|
1961
|
+
id: cacheStepId(cache.cacheId)
|
|
1962
|
+
} : {}),
|
|
1963
|
+
...(skipCondition ? {
|
|
1964
|
+
if: skipCondition
|
|
1965
|
+
} : {}),
|
|
1926
1966
|
// pull-only caches are restored but never saved
|
|
1927
1967
|
uses: cache.policy === "pull" ? "actions/cache/restore@v4" : "actions/cache@v4",
|
|
1928
1968
|
with: {
|
|
@@ -2697,15 +2737,16 @@ const makeGitlabJob = (context, job, allJobs, images, baseRules) => {
|
|
|
2697
2737
|
const when = jobWhen !== null && jobWhen !== void 0 ? jobWhen : gate ? gate === "manual" ? "manual" : "on_success" : undefined;
|
|
2698
2738
|
const allow_failure = jobAllowFailure !== null && jobAllowFailure !== void 0 ? jobAllowFailure : gate ? gate === "manual" : undefined;
|
|
2699
2739
|
// the neutral `caches` declarations resolve to gitlab cache configs;
|
|
2700
|
-
// an explicitly set gitlab `cache` takes precedence.
|
|
2701
|
-
//
|
|
2702
|
-
|
|
2740
|
+
// an explicitly set gitlab `cache` takes precedence. keyFiles /
|
|
2741
|
+
// cacheId / redundantOnExactHitOf are github-only hints (content
|
|
2742
|
+
// keys, conditional restore) and must not leak into the gitlab yaml
|
|
2743
|
+
const stripGithubCacheHints = ({
|
|
2703
2744
|
keyFiles: _keyFiles,
|
|
2745
|
+
cacheId: _cacheId,
|
|
2746
|
+
redundantOnExactHitOf: _redundantOnExactHitOf,
|
|
2704
2747
|
...cacheRest
|
|
2705
|
-
}) => cacheRest
|
|
2706
|
-
|
|
2707
|
-
...cacheRest
|
|
2708
|
-
}) => cacheRest)(resolved);
|
|
2748
|
+
}) => cacheRest;
|
|
2749
|
+
const stripKeyFiles = resolved => Array.isArray(resolved) ? resolved.map(stripGithubCacheHints) : stripGithubCacheHints(resolved);
|
|
2709
2750
|
const resolvedCaches = caches && context.type !== "agent" ? (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, caches) : undefined;
|
|
2710
2751
|
const cache = jobCache !== null && jobCache !== void 0 ? jobCache : resolvedCaches && stripKeyFiles(resolvedCaches);
|
|
2711
2752
|
const stage = envMode === "stagePerEnv" && context.type !== "agent" ? `${job.stage} ${context.env}` : job.stage;
|
|
@@ -3999,6 +4040,8 @@ const createJobCacheFromCacheConfigs = (context, caches) => {
|
|
|
3999
4040
|
pathMode,
|
|
4000
4041
|
buildDir,
|
|
4001
4042
|
keyFiles,
|
|
4043
|
+
cacheId,
|
|
4044
|
+
redundantOnExactHitOf,
|
|
4002
4045
|
...rest
|
|
4003
4046
|
}) => {
|
|
4004
4047
|
var _a;
|
|
@@ -4015,6 +4058,12 @@ const createJobCacheFromCacheConfigs = (context, caches) => {
|
|
|
4015
4058
|
...((keyFiles === null || keyFiles === void 0 ? void 0 : keyFiles.length) ? {
|
|
4016
4059
|
keyFiles: keyFiles.map(f => pathMode === "absolute" ? f : (0, path_1.join)(baseDir, f))
|
|
4017
4060
|
} : {}),
|
|
4061
|
+
...(cacheId ? {
|
|
4062
|
+
cacheId
|
|
4063
|
+
} : {}),
|
|
4064
|
+
...(redundantOnExactHitOf ? {
|
|
4065
|
+
redundantOnExactHitOf
|
|
4066
|
+
} : {}),
|
|
4018
4067
|
...rest
|
|
4019
4068
|
};
|
|
4020
4069
|
});
|
|
@@ -4558,6 +4607,12 @@ exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void
|
|
|
4558
4607
|
const lodash_es_1 = __nccwpck_require__(64284);
|
|
4559
4608
|
const path_1 = __nccwpck_require__(16928);
|
|
4560
4609
|
const slugify_1 = __importDefault(__nccwpck_require__(54206));
|
|
4610
|
+
/**
|
|
4611
|
+
* stable reference between the two node caches: the yarn (zip) cache
|
|
4612
|
+
* declares itself redundant when the node_modules cache scored an
|
|
4613
|
+
* exact-lockfile hit (github skips the ~0.6GB download on warm runs)
|
|
4614
|
+
*/
|
|
4615
|
+
const NODE_MODULES_CACHE_ID = "node-modules";
|
|
4561
4616
|
const getYarnCache = async (context, policy = "pull-push") => {
|
|
4562
4617
|
const packageManagerInfo = await context.packageManagerInfo;
|
|
4563
4618
|
const componentIsInWorkspace = context.type === "component" && "componentIsInWorkspace" in packageManagerInfo && packageManagerInfo.componentIsInWorkspace;
|
|
@@ -4569,7 +4624,12 @@ const getYarnCache = async (context, policy = "pull-push") => {
|
|
|
4569
4624
|
paths: [".yarn"],
|
|
4570
4625
|
// content-key for immutable-cache backends (github); the lockfile
|
|
4571
4626
|
// decides whether the cached content could have changed
|
|
4572
|
-
keyFiles: ["yarn.lock"]
|
|
4627
|
+
keyFiles: ["yarn.lock"],
|
|
4628
|
+
// the .yarn zips (~hundreds of MB) are only read when yarn has to
|
|
4629
|
+
// (re)install packages. When the node_modules cache hit for the
|
|
4630
|
+
// same lockfile, install verifies via install-state.gz and never
|
|
4631
|
+
// opens a zip — so github skips downloading this cache entirely
|
|
4632
|
+
redundantOnExactHitOf: NODE_MODULES_CACHE_ID
|
|
4573
4633
|
}];
|
|
4574
4634
|
};
|
|
4575
4635
|
exports.getYarnCache = getYarnCache;
|
|
@@ -4593,6 +4653,9 @@ const getNodeModulesCache = async (context, policy = "pull-push") => {
|
|
|
4593
4653
|
// decides whether the cached content could have changed (absolute
|
|
4594
4654
|
// pathMode: resolve the standalone component's lockfile explicitly)
|
|
4595
4655
|
keyFiles: [componentIsInWorkspace ? "yarn.lock" : (0, path_1.join)(context.build.dir, "yarn.lock")],
|
|
4656
|
+
// referenced by the yarn cache: an exact hit here makes the yarn
|
|
4657
|
+
// zips unnecessary (see redundantOnExactHitOf on getYarnCache)
|
|
4658
|
+
cacheId: NODE_MODULES_CACHE_ID,
|
|
4596
4659
|
policy,
|
|
4597
4660
|
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")] : [])])]
|
|
4598
4661
|
}];
|
|
@@ -5280,7 +5343,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
5280
5343
|
value: true
|
|
5281
5344
|
}));
|
|
5282
5345
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
5283
|
-
exports.PIPELINE_IMAGE_TAG = "next-
|
|
5346
|
+
exports.PIPELINE_IMAGE_TAG = "next-5dc1f907" || 0;
|
|
5284
5347
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
5285
5348
|
|
|
5286
5349
|
/***/ }),
|