@catladder/cli 0.0.0-next-8b9ad5ca → 0.0.0-next-1cd29c1f
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 +19666 -1581
- package/dist/bundles/cli/index.js +18360 -195
- package/dist/cli/src/apps/cli/commands/project/commandConfigSecrets.js +22 -4
- package/dist/cli/src/apps/cli/commands/project/commandConfigSecrets.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js +16 -14
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
- package/dist/cli/src/commands/project/commandSecretsSyncGithub.d.ts +11 -2
- package/dist/cli/src/commands/project/commandSecretsSyncGithub.js +37 -14
- package/dist/cli/src/commands/project/commandSecretsSyncGithub.js.map +1 -1
- package/dist/cli/src/gcloud/getProjectNumber.d.ts +5 -0
- package/dist/cli/src/gcloud/getProjectNumber.js +20 -0
- package/dist/cli/src/gcloud/getProjectNumber.js.map +1 -0
- package/dist/cli/src/store/updateCatladderStore.d.ts +10 -0
- package/dist/cli/src/store/updateCatladderStore.js +32 -0
- package/dist/cli/src/store/updateCatladderStore.js.map +1 -0
- package/dist/cli/src/utils/github.d.ts +6 -1
- package/dist/cli/src/utils/github.js +16 -9
- package/dist/cli/src/utils/github.js.map +1 -1
- package/dist/pipeline/src/backends/github/GithubBackend.d.ts +4 -1
- package/dist/pipeline/src/backends/github/GithubBackend.js +70 -12
- package/dist/pipeline/src/backends/github/GithubBackend.js.map +1 -1
- package/dist/pipeline/src/backends/github/ciVariables.js +3 -1
- package/dist/pipeline/src/backends/github/ciVariables.js.map +1 -1
- package/dist/pipeline/src/backends/github/createGithubJobs.d.ts +13 -3
- package/dist/pipeline/src/backends/github/createGithubJobs.js +80 -14
- package/dist/pipeline/src/backends/github/createGithubJobs.js.map +1 -1
- package/dist/pipeline/src/backends/github/githubReleaseJobs.d.ts +2 -1
- package/dist/pipeline/src/backends/github/githubReleaseJobs.js +46 -33
- package/dist/pipeline/src/backends/github/githubReleaseJobs.js.map +1 -1
- package/dist/pipeline/src/backends/github/index.d.ts +2 -1
- package/dist/pipeline/src/backends/github/index.js +2 -1
- package/dist/pipeline/src/backends/github/index.js.map +1 -1
- package/dist/pipeline/src/backends/github/scriptFiles.d.ts +25 -0
- package/dist/pipeline/src/backends/github/scriptFiles.js +50 -0
- package/dist/pipeline/src/backends/github/scriptFiles.js.map +1 -0
- package/dist/pipeline/src/backends/gitlab/GitlabBackend.d.ts +1 -0
- package/dist/pipeline/src/backends/gitlab/GitlabBackend.js +18 -8
- package/dist/pipeline/src/backends/gitlab/GitlabBackend.js.map +1 -1
- package/dist/pipeline/src/backends/gitlab/ciVariables.js +2 -1
- package/dist/pipeline/src/backends/gitlab/ciVariables.js.map +1 -1
- package/dist/pipeline/src/backends/gitlab/createGitlabJobs.d.ts +3 -2
- package/dist/pipeline/src/backends/gitlab/createGitlabJobs.js +84 -10
- package/dist/pipeline/src/backends/gitlab/createGitlabJobs.js.map +1 -1
- package/dist/pipeline/src/backends/gitlab/createGitlabPipeline.js +1 -1
- package/dist/pipeline/src/backends/gitlab/createGitlabPipeline.js.map +1 -1
- package/dist/pipeline/src/backends/gitlab/gitlabReleaseJobs.js +2 -2
- package/dist/pipeline/src/backends/gitlab/gitlabReleaseJobs.js.map +1 -1
- package/dist/pipeline/src/backends/types.d.ts +2 -1
- package/dist/pipeline/src/bash/ciVariables.d.ts +1 -1
- package/dist/pipeline/src/bash/ciVariables.js.map +1 -1
- package/dist/pipeline/src/build/node/yarn.js +4 -1
- package/dist/pipeline/src/build/node/yarn.js.map +1 -1
- package/dist/pipeline/src/build/types.d.ts +1 -1
- package/dist/pipeline/src/config/readConfig.js +15 -4
- package/dist/pipeline/src/config/readConfig.js.map +1 -1
- package/dist/pipeline/src/constants.js +1 -1
- package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +8 -0
- package/dist/pipeline/src/context/getEnvironmentVariables.js +3 -3
- package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
- package/dist/pipeline/src/context/transformJobOnlyVars.js +2 -2
- package/dist/pipeline/src/context/transformJobOnlyVars.js.map +1 -1
- package/dist/pipeline/src/context/utils/envVars.d.ts +7 -0
- package/dist/pipeline/src/context/utils/envVars.js +22 -1
- package/dist/pipeline/src/context/utils/envVars.js.map +1 -1
- package/dist/pipeline/src/customImages/hash.d.ts +15 -0
- package/dist/pipeline/src/customImages/hash.js +71 -0
- package/dist/pipeline/src/customImages/hash.js.map +1 -0
- package/dist/pipeline/src/customImages/jobImagesPlan.d.ts +59 -0
- package/dist/pipeline/src/customImages/jobImagesPlan.js +172 -0
- package/dist/pipeline/src/customImages/jobImagesPlan.js.map +1 -0
- package/dist/pipeline/src/customImages/shippedImages.d.ts +28 -0
- package/dist/pipeline/src/customImages/shippedImages.js +60 -0
- package/dist/pipeline/src/customImages/shippedImages.js.map +1 -0
- package/dist/pipeline/src/deploy/cloudRun/createJobs/common.d.ts +6 -3
- package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js +11 -3
- package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/execute/schedules.js +2 -2
- package/dist/pipeline/src/deploy/cloudRun/createJobs/execute/schedules.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/index.d.ts +0 -1
- package/dist/pipeline/src/deploy/cloudRun/index.js +11 -13
- package/dist/pipeline/src/deploy/cloudRun/index.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/utils/database.js +4 -1
- package/dist/pipeline/src/deploy/cloudRun/utils/database.js.map +1 -1
- package/dist/pipeline/src/index.d.ts +1 -0
- package/dist/pipeline/src/index.js +1 -0
- package/dist/pipeline/src/index.js.map +1 -1
- package/dist/pipeline/src/pipeline/generatePipelineFiles.js +16 -1
- package/dist/pipeline/src/pipeline/generatePipelineFiles.js.map +1 -1
- package/dist/pipeline/src/runner/index.d.ts +20 -1
- package/dist/pipeline/src/runner/index.js +16 -3
- package/dist/pipeline/src/runner/index.js.map +1 -1
- package/dist/pipeline/src/store/index.d.ts +36 -0
- package/dist/pipeline/src/store/index.js +64 -0
- package/dist/pipeline/src/store/index.js.map +1 -0
- package/dist/pipeline/src/types/config.d.ts +36 -2
- package/dist/pipeline/src/types/config.js.map +1 -1
- package/dist/pipeline/src/types/github-types.d.ts +5 -0
- package/dist/pipeline/src/types/jobs.d.ts +10 -2
- package/dist/pipeline/src/types/jobs.js.map +1 -1
- package/dist/pipeline/src/utils/gitlab.d.ts +5 -0
- package/dist/pipeline/src/utils/gitlab.js +6 -0
- package/dist/pipeline/src/utils/gitlab.js.map +1 -1
- package/dist/pipeline/src/utils/writeFiles.d.ts +6 -0
- package/dist/pipeline/src/utils/writeFiles.js +8 -0
- package/dist/pipeline/src/utils/writeFiles.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +25 -5
- package/src/apps/cli/commands/project/setup/setupCloudRun.ts +13 -21
- package/src/commands/project/commandSecretsSyncGithub.ts +34 -11
- package/src/gcloud/getProjectNumber.ts +20 -0
- package/src/store/updateCatladderStore.ts +33 -0
- package/src/utils/github.ts +24 -7
- package/dist/cli/src/gcloud/cloudRun/getCloudRunDomainSuffix.d.ts +0 -2
- package/dist/cli/src/gcloud/cloudRun/getCloudRunDomainSuffix.js +0 -29
- package/dist/cli/src/gcloud/cloudRun/getCloudRunDomainSuffix.js.map +0 -1
- package/src/gcloud/cloudRun/getCloudRunDomainSuffix.ts +0 -35
|
@@ -13,7 +13,7 @@ const envVars_1 = require("./utils/envVars");
|
|
|
13
13
|
* @returns
|
|
14
14
|
*/
|
|
15
15
|
const transformJobOnlyVars = async (env, componentName, vars) => {
|
|
16
|
-
var _a
|
|
16
|
+
var _a;
|
|
17
17
|
if (!vars) {
|
|
18
18
|
return {
|
|
19
19
|
envVars: {},
|
|
@@ -21,7 +21,7 @@ const transformJobOnlyVars = async (env, componentName, vars) => {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
const publicVars = (0, envVars_1.stringifyValues)((_a = vars === null || vars === void 0 ? void 0 : vars.public) !== null && _a !== void 0 ? _a : {});
|
|
24
|
-
const secretEnvVarKeys = (0, envVars_1.
|
|
24
|
+
const secretEnvVarKeys = (0, envVars_1.normalizeSecretVarsConfig)(vars === null || vars === void 0 ? void 0 : vars.secret);
|
|
25
25
|
const deployJobOnlySecretEnvVars = (vars === null || vars === void 0 ? void 0 : vars.secret) ? (0, envVars_1.makeSecretEnvVarMapping)(env, componentName, secretEnvVarKeys) : {};
|
|
26
26
|
const envVars = {
|
|
27
27
|
...deployJobOnlySecretEnvVars,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformJobOnlyVars.js","sourceRoot":"","sources":["../../../../../pipeline/src/context/transformJobOnlyVars.ts"],"names":[],"mappings":";;;AAEA,6CAIyB;AAEzB;;;;;;GAMG;AACI,MAAM,oBAAoB,GAAG,KAAK,EACvC,GAAW,EACX,aAAqB,EACrB,IAAoB,EAInB,EAAE;;IACH,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO;YACL,OAAO,EAAE,EAAE;YACX,gBAAgB,EAAE,EAAE;SACrB,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,IAAA,yBAAe,EAAC,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,mCAAI,EAAE,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,IAAA,
|
|
1
|
+
{"version":3,"file":"transformJobOnlyVars.js","sourceRoot":"","sources":["../../../../../pipeline/src/context/transformJobOnlyVars.ts"],"names":[],"mappings":";;;AAEA,6CAIyB;AAEzB;;;;;;GAMG;AACI,MAAM,oBAAoB,GAAG,KAAK,EACvC,GAAW,EACX,aAAqB,EACrB,IAAoB,EAInB,EAAE;;IACH,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO;YACL,OAAO,EAAE,EAAE;YACX,gBAAgB,EAAE,EAAE;SACrB,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,IAAA,yBAAe,EAAC,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,mCAAI,EAAE,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,IAAA,mCAAyB,EAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAC,CAAC;IACjE,MAAM,0BAA0B,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM;QAC7C,CAAC,CAAC,IAAA,iCAAuB,EAAC,GAAG,EAAE,aAAa,EAAE,gBAAgB,CAAC;QAC/D,CAAC,CAAC,EAAE,CAAC;IAEP,MAAM,OAAO,GAAG;QACd,GAAG,0BAA0B;QAC7B,GAAG,UAAU;KACd,CAAC;IACF,OAAO;QACL,OAAO;QACP,gBAAgB;KACjB,CAAC;AACJ,CAAC,CAAC;AA7BW,QAAA,oBAAoB,wBA6B/B"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import type { SecretEnvVar } from "../getEnvironmentVariables";
|
|
2
|
+
import type { EnvVars } from "../../types/config";
|
|
2
3
|
export declare const stringifyValues: (obj: Record<string, unknown>) => {
|
|
3
4
|
[k: string]: string;
|
|
4
5
|
};
|
|
5
6
|
export declare const stringListToSecreteEnvVarList: (keys: string[]) => SecretEnvVar[];
|
|
7
|
+
/**
|
|
8
|
+
* normalizes both config forms of vault-stored env vars: the deprecated
|
|
9
|
+
* plain string[] (all keys secret) and the record form carrying a kind
|
|
10
|
+
* (or config object) per key
|
|
11
|
+
*/
|
|
12
|
+
export declare const normalizeSecretVarsConfig: (secret: EnvVars["secret"]) => SecretEnvVar[];
|
|
6
13
|
export declare const makeSecretEnvVarMapping: (env: string, componentName: string, secretEnvVars: SecretEnvVar[]) => {
|
|
7
14
|
[k: string]: import("../../bash/BashExpression").BashExpression;
|
|
8
15
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.makeSecretEnvVarMapping = exports.stringListToSecreteEnvVarList = exports.stringifyValues = void 0;
|
|
6
|
+
exports.makeSecretEnvVarMapping = exports.normalizeSecretVarsConfig = exports.stringListToSecreteEnvVarList = exports.stringifyValues = void 0;
|
|
7
7
|
const lodash_es_1 = require("lodash-es");
|
|
8
8
|
const getEnvironmentVariables_1 = require("../getEnvironmentVariables");
|
|
9
9
|
const BashExpression_1 = require("../../bash/BashExpression");
|
|
@@ -13,6 +13,27 @@ const stringListToSecreteEnvVarList = keys => keys.map(key => ({
|
|
|
13
13
|
key
|
|
14
14
|
}));
|
|
15
15
|
exports.stringListToSecreteEnvVarList = stringListToSecreteEnvVarList;
|
|
16
|
+
/**
|
|
17
|
+
* normalizes both config forms of vault-stored env vars: the deprecated
|
|
18
|
+
* plain string[] (all keys secret) and the record form carrying a kind
|
|
19
|
+
* (or config object) per key
|
|
20
|
+
*/
|
|
21
|
+
const normalizeSecretVarsConfig = secret => {
|
|
22
|
+
if (!secret) {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
if (Array.isArray(secret)) {
|
|
26
|
+
return (0, exports.stringListToSecreteEnvVarList)(secret);
|
|
27
|
+
}
|
|
28
|
+
return Object.entries(secret).map(([key, config]) => typeof config === "string" ? {
|
|
29
|
+
key,
|
|
30
|
+
kind: config
|
|
31
|
+
} : {
|
|
32
|
+
key,
|
|
33
|
+
...config
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
exports.normalizeSecretVarsConfig = normalizeSecretVarsConfig;
|
|
16
37
|
const makeSecretEnvVarMapping = (env, componentName, secretEnvVars) => {
|
|
17
38
|
return Object.fromEntries(secretEnvVars.map(({
|
|
18
39
|
key
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envVars.js","sourceRoot":"","sources":["../../../../../../pipeline/src/context/utils/envVars.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AAErC,wEAA8D;AAC9D,8DAA4D;
|
|
1
|
+
{"version":3,"file":"envVars.js","sourceRoot":"","sources":["../../../../../../pipeline/src/context/utils/envVars.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AAErC,wEAA8D;AAC9D,8DAA4D;AAGrD,MAAM,eAAe,GAAG,CAAC,GAA4B,EAAE,EAAE,CAC9D,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;IACxC,GAAG;IACH,IAAA,oBAAQ,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE;CACrD,CAAC,CACH,CAAC;AANS,QAAA,eAAe,mBAMxB;AAEG,MAAM,6BAA6B,GAAG,CAAC,IAAc,EAAkB,EAAE,CAC9E,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AADlB,QAAA,6BAA6B,iCACX;AAE/B;;;;GAIG;AACI,MAAM,yBAAyB,GAAG,CACvC,MAAyB,EACT,EAAE;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAA,qCAA6B,EAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CAClD,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,CACxE,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,yBAAyB,6BAYpC;AACK,MAAM,uBAAuB,GAAG,CACrC,GAAW,EACX,aAAqB,EACrB,aAA6B,EAC7B,EAAE;IACF,OAAO,MAAM,CAAC,WAAW,CACvB,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;QAC7B,GAAG;QACH,IAAA,gCAAe,EAAC,IAAA,0CAAgB,EAAC,GAAG,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC;KAC3D,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,uBAAuB,2BAWlC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* input for content-hashing an image definition. `extraDirs` covers
|
|
3
|
+
* image definitions that include other image dirs (dockerfile INCLUDE).
|
|
4
|
+
*/
|
|
5
|
+
export type ImageHashConfig = {
|
|
6
|
+
dir: string;
|
|
7
|
+
extraDirs?: string[];
|
|
8
|
+
hashExtraPaths?: string[];
|
|
9
|
+
buildArgs?: Record<string, string>;
|
|
10
|
+
};
|
|
11
|
+
export type CustomImageHashResult = {
|
|
12
|
+
hash: string;
|
|
13
|
+
watchedPaths: string[];
|
|
14
|
+
};
|
|
15
|
+
export declare function computeCustomImageHash(config: ImageHashConfig): CustomImageHashResult;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.computeCustomImageHash = void 0;
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const IGNORED_FILES = new Set([".DS_Store", "Thumbs.db"]);
|
|
11
|
+
const isIgnoredFile = path => {
|
|
12
|
+
var _a;
|
|
13
|
+
return IGNORED_FILES.has((_a = path.split("/").pop()) !== null && _a !== void 0 ? _a : "");
|
|
14
|
+
};
|
|
15
|
+
function listFilesRecursive(dir) {
|
|
16
|
+
const resolved = (0, path_1.resolve)(dir);
|
|
17
|
+
const entries = (0, fs_1.readdirSync)(resolved, {
|
|
18
|
+
recursive: true,
|
|
19
|
+
encoding: "utf-8"
|
|
20
|
+
});
|
|
21
|
+
return entries.filter(entry => {
|
|
22
|
+
if (isIgnoredFile(entry)) {
|
|
23
|
+
// OS junk files exist locally but not in CI checkouts — they
|
|
24
|
+
// must never influence the content hash
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
const fullPath = (0, path_1.join)(resolved, entry);
|
|
28
|
+
return (0, fs_1.statSync)(fullPath).isFile();
|
|
29
|
+
}).sort();
|
|
30
|
+
}
|
|
31
|
+
function computeCustomImageHash(config) {
|
|
32
|
+
var _a;
|
|
33
|
+
const hash = (0, crypto_1.createHash)("sha256");
|
|
34
|
+
const watchedPaths = [];
|
|
35
|
+
// Hash all files in the dir (includes the Dockerfile and any context files)
|
|
36
|
+
const dirFiles = listFilesRecursive(config.dir);
|
|
37
|
+
for (const file of dirFiles) {
|
|
38
|
+
const fullPath = (0, path_1.join)((0, path_1.resolve)(config.dir), file);
|
|
39
|
+
hash.update(file); // include relative path for disambiguation
|
|
40
|
+
hash.update((0, fs_1.readFileSync)(fullPath));
|
|
41
|
+
}
|
|
42
|
+
watchedPaths.push(`${config.dir}/**/*`);
|
|
43
|
+
// extra dirs (e.g. included base image definitions)
|
|
44
|
+
for (const extraDir of (_a = config.extraDirs) !== null && _a !== void 0 ? _a : []) {
|
|
45
|
+
for (const file of listFilesRecursive(extraDir)) {
|
|
46
|
+
hash.update(file);
|
|
47
|
+
hash.update((0, fs_1.readFileSync)((0, path_1.join)((0, path_1.resolve)(extraDir), file)));
|
|
48
|
+
}
|
|
49
|
+
watchedPaths.push(`${extraDir}/**/*`);
|
|
50
|
+
}
|
|
51
|
+
// Hash extra paths (for files outside the dir)
|
|
52
|
+
if (config.hashExtraPaths) {
|
|
53
|
+
// Extra paths are literal file paths (not globs) for simplicity
|
|
54
|
+
const extraFiles = [...config.hashExtraPaths].sort();
|
|
55
|
+
for (const file of extraFiles) {
|
|
56
|
+
hash.update(file);
|
|
57
|
+
hash.update((0, fs_1.readFileSync)(file));
|
|
58
|
+
}
|
|
59
|
+
watchedPaths.push(...config.hashExtraPaths);
|
|
60
|
+
}
|
|
61
|
+
// Hash build args (sorted keys for determinism)
|
|
62
|
+
if (config.buildArgs) {
|
|
63
|
+
const sorted = Object.entries(config.buildArgs).sort(([a], [b]) => a.localeCompare(b));
|
|
64
|
+
hash.update(JSON.stringify(sorted));
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
hash: hash.digest("hex").slice(0, 12),
|
|
68
|
+
watchedPaths
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
exports.computeCustomImageHash = computeCustomImageHash;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../../../../pipeline/src/customImages/hash.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AACpC,2BAAyD;AACzD,+BAAqC;AAiBrC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AAC1D,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,EAAE,WACrC,OAAA,aAAa,CAAC,GAAG,CAAC,MAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,mCAAI,EAAE,CAAC,CAAA,EAAA,CAAC;AAEjD,SAAS,kBAAkB,CAAC,GAAW;IACrC,MAAM,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KACb,CAAC;AACJ,CAAC;AAhDD,wDAgDC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { CatladderImageRef } from "../runner";
|
|
2
|
+
import type { Config, GitlabJobImage, PipelineType } from "../types";
|
|
3
|
+
import type { CatladderJob, CatladderJobNeed } from "../types/jobs";
|
|
4
|
+
export declare const GENERATED_IMAGES_FOLDER = ".catladder-generated/images";
|
|
5
|
+
export type JobImagesMode = "central" | "repo";
|
|
6
|
+
export declare const getJobImagesMode: (config: Config, pipelineType: PipelineType) => JobImagesMode;
|
|
7
|
+
export type ResolvedJobImage = {
|
|
8
|
+
/** the concrete image url */
|
|
9
|
+
image: string;
|
|
10
|
+
/** the dependency on the image build job (repo mode only) */
|
|
11
|
+
need?: CatladderJobNeed;
|
|
12
|
+
/** whether the image lives in the repository's own registry */
|
|
13
|
+
fromRepoRegistry?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type GeneratedImageFile = {
|
|
16
|
+
path: string;
|
|
17
|
+
content: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* plans the catladder job images of one backend run: resolves image
|
|
21
|
+
* references, and (in repo mode) collects the image build jobs and the
|
|
22
|
+
* image definitions to materialize into the generated files.
|
|
23
|
+
*
|
|
24
|
+
* Reference-driven: only images actually used by a job are built.
|
|
25
|
+
*/
|
|
26
|
+
export declare class JobImagesPlan {
|
|
27
|
+
readonly mode: JobImagesMode;
|
|
28
|
+
private readonly pipelineType;
|
|
29
|
+
private used;
|
|
30
|
+
constructor(mode: JobImagesMode, pipelineType: PipelineType);
|
|
31
|
+
/**
|
|
32
|
+
* resolves a job image (marker or concrete) to a concrete image url
|
|
33
|
+
* plus the build job dependency in repo mode
|
|
34
|
+
*/
|
|
35
|
+
resolve(image: CatladderJob["image"]): {
|
|
36
|
+
image: GitlabJobImage | undefined;
|
|
37
|
+
need?: CatladderJobNeed;
|
|
38
|
+
fromRepoRegistry?: boolean;
|
|
39
|
+
};
|
|
40
|
+
resolveRef(ref: CatladderImageRef): ResolvedJobImage;
|
|
41
|
+
/**
|
|
42
|
+
* the registry image prefix. On github, container images can't use
|
|
43
|
+
* runtime env vars — the expression form is required.
|
|
44
|
+
*/
|
|
45
|
+
private registryImageRef;
|
|
46
|
+
private use;
|
|
47
|
+
/**
|
|
48
|
+
* the image build jobs for all used images (repo mode; empty in
|
|
49
|
+
* central mode)
|
|
50
|
+
*/
|
|
51
|
+
getEnsureJobs(): CatladderJob[];
|
|
52
|
+
private createEnsureJob;
|
|
53
|
+
/**
|
|
54
|
+
* the image definitions of all used images, materialized into the
|
|
55
|
+
* generated files (so pipelines build from committed, reviewable
|
|
56
|
+
* files and gitlab's rules:changes can watch them)
|
|
57
|
+
*/
|
|
58
|
+
getGeneratedFiles(): GeneratedImageFile[];
|
|
59
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.JobImagesPlan = exports.getJobImagesMode = exports.GENERATED_IMAGES_FOLDER = void 0;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const ciVariables_1 = require("../bash/ciVariables");
|
|
10
|
+
const docker_1 = require("../build/docker");
|
|
11
|
+
const constants_1 = require("../constants");
|
|
12
|
+
const runner_1 = require("../runner");
|
|
13
|
+
const gitlab_1 = require("../utils/gitlab");
|
|
14
|
+
const hash_1 = require("./hash");
|
|
15
|
+
const shippedImages_1 = require("./shippedImages");
|
|
16
|
+
exports.GENERATED_IMAGES_FOLDER = ".catladder-generated/images";
|
|
17
|
+
/**
|
|
18
|
+
* the official docker cli image used to build the job images — NOT a
|
|
19
|
+
* catladder image, so building images never depends on one (bootstrap)
|
|
20
|
+
*/
|
|
21
|
+
const BUILDER_IMAGE = "docker.io/docker:29.5.1";
|
|
22
|
+
const getJobImagesMode = (config, pipelineType) => {
|
|
23
|
+
var _a;
|
|
24
|
+
// the central registry is not reachable from github runners
|
|
25
|
+
if (pipelineType === "github" && config.jobImages === "central") {
|
|
26
|
+
throw new Error(`jobImages: "central" is not supported on github: catladder's central registry (${constants_1.DOCKER_REGISTRY}) is unreachable from github runners. Use "repo" (the default) instead.`);
|
|
27
|
+
}
|
|
28
|
+
return (_a = config.jobImages) !== null && _a !== void 0 ? _a : pipelineType === "github" ? "repo" : "central";
|
|
29
|
+
};
|
|
30
|
+
exports.getJobImagesMode = getJobImagesMode;
|
|
31
|
+
const ensureJobName = name => `🐳 job image ${name}`;
|
|
32
|
+
/**
|
|
33
|
+
* plans the catladder job images of one backend run: resolves image
|
|
34
|
+
* references, and (in repo mode) collects the image build jobs and the
|
|
35
|
+
* image definitions to materialize into the generated files.
|
|
36
|
+
*
|
|
37
|
+
* Reference-driven: only images actually used by a job are built.
|
|
38
|
+
*/
|
|
39
|
+
class JobImagesPlan {
|
|
40
|
+
constructor(mode, pipelineType) {
|
|
41
|
+
this.mode = mode;
|
|
42
|
+
this.pipelineType = pipelineType;
|
|
43
|
+
this.used = new Map();
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* resolves a job image (marker or concrete) to a concrete image url
|
|
47
|
+
* plus the build job dependency in repo mode
|
|
48
|
+
*/
|
|
49
|
+
resolve(image) {
|
|
50
|
+
if (!(0, runner_1.isCatladderImageRef)(image)) {
|
|
51
|
+
return {
|
|
52
|
+
image
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return this.resolveRef(image);
|
|
56
|
+
}
|
|
57
|
+
resolveRef(ref) {
|
|
58
|
+
const name = ref.catladderImage;
|
|
59
|
+
if (this.mode === "central" || shippedImages_1.CENTRAL_ONLY_IMAGES.has(name)) {
|
|
60
|
+
return {
|
|
61
|
+
image: (0, runner_1.getCentralRunnerImageUrl)(name)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const {
|
|
65
|
+
hash
|
|
66
|
+
} = this.use(name);
|
|
67
|
+
return {
|
|
68
|
+
image: `${this.registryImageRef()}/catladder/${name}:${hash}`,
|
|
69
|
+
fromRepoRegistry: true,
|
|
70
|
+
need: {
|
|
71
|
+
job: ensureJobName(name),
|
|
72
|
+
artifacts: false,
|
|
73
|
+
optional: true,
|
|
74
|
+
global: true
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* the registry image prefix. On github, container images can't use
|
|
80
|
+
* runtime env vars — the expression form is required.
|
|
81
|
+
*/
|
|
82
|
+
registryImageRef() {
|
|
83
|
+
return this.pipelineType === "github" ? "ghcr.io/${{ github.repository }}" : `${(0, ciVariables_1.getCiVariable)({
|
|
84
|
+
pipelineType: this.pipelineType
|
|
85
|
+
}, "registryImage")}`;
|
|
86
|
+
}
|
|
87
|
+
use(name) {
|
|
88
|
+
var _a;
|
|
89
|
+
const existing = this.used.get(name);
|
|
90
|
+
if (existing) {
|
|
91
|
+
return existing;
|
|
92
|
+
}
|
|
93
|
+
const dependencies = (_a = shippedImages_1.RUNNER_IMAGE_DEPENDENCIES[name]) !== null && _a !== void 0 ? _a : [];
|
|
94
|
+
// dependencies are materialized (and hashed) as part of this image,
|
|
95
|
+
// but also usable standalone
|
|
96
|
+
dependencies.forEach(dependency => this.use(dependency));
|
|
97
|
+
const {
|
|
98
|
+
hash
|
|
99
|
+
} = (0, hash_1.computeCustomImageHash)({
|
|
100
|
+
dir: (0, shippedImages_1.getShippedImageDir)(name),
|
|
101
|
+
extraDirs: dependencies.map(dependency => (0, shippedImages_1.getShippedImageDir)(dependency))
|
|
102
|
+
});
|
|
103
|
+
const entry = {
|
|
104
|
+
hash
|
|
105
|
+
};
|
|
106
|
+
this.used.set(name, entry);
|
|
107
|
+
return entry;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* the image build jobs for all used images (repo mode; empty in
|
|
111
|
+
* central mode)
|
|
112
|
+
*/
|
|
113
|
+
getEnsureJobs() {
|
|
114
|
+
return [...this.used.entries()].map(([name, {
|
|
115
|
+
hash
|
|
116
|
+
}]) => this.createEnsureJob(name, hash));
|
|
117
|
+
}
|
|
118
|
+
createEnsureJob(name, hash) {
|
|
119
|
+
var _a;
|
|
120
|
+
const ctx = {
|
|
121
|
+
pipelineType: this.pipelineType
|
|
122
|
+
};
|
|
123
|
+
const registryUser = (0, ciVariables_1.getCiVariable)(ctx, "registryUser");
|
|
124
|
+
const jobToken = (0, ciVariables_1.getCiVariable)(ctx, "jobToken");
|
|
125
|
+
const registry = (0, ciVariables_1.getCiVariable)(ctx, "registry");
|
|
126
|
+
const imageRef = `${this.registryImageRef()}/catladder/${name}:${hash}`;
|
|
127
|
+
const watchedDirs = [name, ...((_a = shippedImages_1.RUNNER_IMAGE_DEPENDENCIES[name]) !== null && _a !== void 0 ? _a : [])];
|
|
128
|
+
const {
|
|
129
|
+
services,
|
|
130
|
+
runnerVariables
|
|
131
|
+
} = (0, docker_1.getDockerJobBaseProps)();
|
|
132
|
+
return {
|
|
133
|
+
name: ensureJobName(name),
|
|
134
|
+
stage: "setup",
|
|
135
|
+
image: BUILDER_IMAGE,
|
|
136
|
+
services,
|
|
137
|
+
runnerVariables,
|
|
138
|
+
needs: [],
|
|
139
|
+
// gitlab: only run when the image definition changed; github has
|
|
140
|
+
// no equivalent and always runs (the existence check is fast)
|
|
141
|
+
rules: [{
|
|
142
|
+
changes: watchedDirs.map(dir => `${exports.GENERATED_IMAGES_FOLDER}/${dir}/**/*`)
|
|
143
|
+
}],
|
|
144
|
+
variables: {},
|
|
145
|
+
script: [...(0, gitlab_1.collapseableSection)("docker-login", "Docker Login")([`docker login --username ${registryUser} --password ${jobToken} ${registry}`]), ...(0, gitlab_1.collapseableSection)("check-image", "Checking if image exists")([`if docker manifest inspect ${imageRef} > /dev/null 2>&1; then`, ` echo "Image ${imageRef} already exists, skipping build"`, ` exit 0`, `fi`]), ...(0, gitlab_1.collapseableSection)("docker-build", "Building image")([`DOCKER_BUILDKIT=1 docker build -t ${imageRef} -f ${exports.GENERATED_IMAGES_FOLDER}/${name}/Dockerfile ${shippedImages_1.RUNNER_IMAGE_BUILD_CONTEXT[name] === "root" ? exports.GENERATED_IMAGES_FOLDER : `${exports.GENERATED_IMAGES_FOLDER}/${name}`}`]), ...(0, gitlab_1.collapseableSection)("docker-push", "Pushing image")([`docker push ${imageRef}`])]
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* the image definitions of all used images, materialized into the
|
|
150
|
+
* generated files (so pipelines build from committed, reviewable
|
|
151
|
+
* files and gitlab's rules:changes can watch them)
|
|
152
|
+
*/
|
|
153
|
+
getGeneratedFiles() {
|
|
154
|
+
return [...this.used.keys()].flatMap(name => {
|
|
155
|
+
const dir = (0, shippedImages_1.getShippedImageDir)(name);
|
|
156
|
+
return listFilesRecursive(dir).map(file => ({
|
|
157
|
+
path: (0, path_1.join)(exports.GENERATED_IMAGES_FOLDER, name, file),
|
|
158
|
+
content: (0, fs_1.readFileSync)((0, path_1.join)(dir, file), "utf-8")
|
|
159
|
+
}));
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.JobImagesPlan = JobImagesPlan;
|
|
164
|
+
const IGNORED_FILES = new Set([".DS_Store", "Thumbs.db"]);
|
|
165
|
+
const listFilesRecursive = dir => (0, fs_1.readdirSync)(dir, {
|
|
166
|
+
recursive: true,
|
|
167
|
+
encoding: "utf-8"
|
|
168
|
+
}).filter(entry => {
|
|
169
|
+
var _a;
|
|
170
|
+
// OS junk files exist locally but not in CI checkouts
|
|
171
|
+
return !IGNORED_FILES.has((_a = entry.split("/").pop()) !== null && _a !== void 0 ? _a : "") && (0, fs_1.statSync)((0, path_1.join)(dir, entry)).isFile();
|
|
172
|
+
}).sort();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobImagesPlan.js","sourceRoot":"","sources":["../../../../../pipeline/src/customImages/jobImagesPlan.ts"],"names":[],"mappings":";;;AA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E,EAAE,CAAC,CAAC;gBAC5C,IAAI,EAAE,IAAA,WAAI,EAAC,+BAAuB,EAAE,IAAI,EAAE,IAAI,CAAC;gBAC/C,OAAO,EAAE,IAAA,iBAAY,EAAC,IAAA,WAAI,EAAC,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC;aAChD,CAAC,CAAC,CAAC;QACN,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA7JD,sCA6JC;AAED,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AAE1D,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAY,EAAE,CACnD,IAAA,gBAAW,EAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;KACrD,MAAM,CACL,CAAC,KAAK,EAAE,EAAE;;IACR,sDAAsD;IACtD,OAAA,CAAC,aAAa,CAAC,GAAG,CAAC,MAAA,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,mCAAI,EAAE,CAAC;QAChD,IAAA,aAAQ,EAAC,IAAA,WAAI,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAA;CAAA,CACtC;KACA,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { RunnerImageName } from "../runner";
|
|
2
|
+
/**
|
|
3
|
+
* images whose Dockerfile INCLUDEs another image's Dockerfile
|
|
4
|
+
* (dockerfile-x/dockerfile-plus, resolved against the images root as
|
|
5
|
+
* build context)
|
|
6
|
+
*/
|
|
7
|
+
export declare const RUNNER_IMAGE_DEPENDENCIES: Partial<Record<RunnerImageName, RunnerImageName[]>>;
|
|
8
|
+
/**
|
|
9
|
+
* the docker build context of each image, mirroring the central image
|
|
10
|
+
* builds: the jobs family builds from the images root (their
|
|
11
|
+
* Dockerfiles INCLUDE sibling images), the others from their own dir
|
|
12
|
+
* (their COPY paths are relative to it)
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* images that cannot be built from the shipped definitions and always
|
|
16
|
+
* come from the central registry: semantic-release bakes catladder's
|
|
17
|
+
* own cli sources into the image (repo-root build context).
|
|
18
|
+
* TODO: make the semantic-release image self-contained.
|
|
19
|
+
*/
|
|
20
|
+
export declare const CENTRAL_ONLY_IMAGES: ReadonlySet<RunnerImageName>;
|
|
21
|
+
export declare const RUNNER_IMAGE_BUILD_CONTEXT: Record<RunnerImageName, "root" | "self">;
|
|
22
|
+
/**
|
|
23
|
+
* the directory containing the image definitions shipped with the
|
|
24
|
+
* package (copied into dist at build time; the repository layout is
|
|
25
|
+
* the fallback for development and tests)
|
|
26
|
+
*/
|
|
27
|
+
export declare const getShippedImagesDir: () => string;
|
|
28
|
+
export declare const getShippedImageDir: (name: RunnerImageName) => string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getShippedImageDir = exports.getShippedImagesDir = exports.RUNNER_IMAGE_BUILD_CONTEXT = exports.CENTRAL_ONLY_IMAGES = exports.RUNNER_IMAGE_DEPENDENCIES = void 0;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
/**
|
|
10
|
+
* images whose Dockerfile INCLUDEs another image's Dockerfile
|
|
11
|
+
* (dockerfile-x/dockerfile-plus, resolved against the images root as
|
|
12
|
+
* build context)
|
|
13
|
+
*/
|
|
14
|
+
exports.RUNNER_IMAGE_DEPENDENCIES = {
|
|
15
|
+
"jobs-meteor": ["jobs-default"],
|
|
16
|
+
"jobs-testing-chrome": ["jobs-default"]
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* the docker build context of each image, mirroring the central image
|
|
20
|
+
* builds: the jobs family builds from the images root (their
|
|
21
|
+
* Dockerfiles INCLUDE sibling images), the others from their own dir
|
|
22
|
+
* (their COPY paths are relative to it)
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* images that cannot be built from the shipped definitions and always
|
|
26
|
+
* come from the central registry: semantic-release bakes catladder's
|
|
27
|
+
* own cli sources into the image (repo-root build context).
|
|
28
|
+
* TODO: make the semantic-release image self-contained.
|
|
29
|
+
*/
|
|
30
|
+
exports.CENTRAL_ONLY_IMAGES = new Set(["semantic-release"]);
|
|
31
|
+
exports.RUNNER_IMAGE_BUILD_CONTEXT = {
|
|
32
|
+
"jobs-default": "root",
|
|
33
|
+
"jobs-meteor": "root",
|
|
34
|
+
"jobs-testing-chrome": "root",
|
|
35
|
+
kubernetes: "self",
|
|
36
|
+
"docker-build": "self",
|
|
37
|
+
gcloud: "self",
|
|
38
|
+
"semantic-release": "self",
|
|
39
|
+
"agent-claude": "self"
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* the directory containing the image definitions shipped with the
|
|
43
|
+
* package (copied into dist at build time; the repository layout is
|
|
44
|
+
* the fallback for development and tests)
|
|
45
|
+
*/
|
|
46
|
+
const getShippedImagesDir = () => {
|
|
47
|
+
const candidates = [
|
|
48
|
+
// built package: dist/customImages -> dist/runner-images
|
|
49
|
+
(0, path_1.join)(__dirname, "..", "runner-images"),
|
|
50
|
+
// repository: pipeline/src/customImages -> <root>/runner-images
|
|
51
|
+
(0, path_1.join)(__dirname, "..", "..", "..", "runner-images")];
|
|
52
|
+
const found = candidates.find(candidate => (0, fs_1.existsSync)(candidate));
|
|
53
|
+
if (!found) {
|
|
54
|
+
throw new Error("shipped job image definitions not found");
|
|
55
|
+
}
|
|
56
|
+
return found;
|
|
57
|
+
};
|
|
58
|
+
exports.getShippedImagesDir = getShippedImagesDir;
|
|
59
|
+
const getShippedImageDir = name => (0, path_1.join)((0, exports.getShippedImagesDir)(), name);
|
|
60
|
+
exports.getShippedImageDir = getShippedImageDir;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shippedImages.js","sourceRoot":"","sources":["../../../../../pipeline/src/customImages/shippedImages.ts"],"names":[],"mappings":";;;AAAA,2BAAgC;AAChC,+BAA4B;AAG5B;;;;GAIG;AACU,QAAA,yBAAyB,GAElC;IACF,aAAa,EAAE,CAAC,cAAc,CAAC;IAC/B,qBAAqB,EAAE,CAAC,cAAc,CAAC;CACxC,CAAC;AAEF;;;;;GAKG;AACH;;;;;GAKG;AACU,QAAA,mBAAmB,GAAiC,IAAI,GAAG,CAAC;IACvE,kBAAkB;CACnB,CAAC,CAAC;AAEU,QAAA,0BAA0B,GAGnC;IACF,cAAc,EAAE,MAAM;IACtB,aAAa,EAAE,MAAM;IACrB,qBAAqB,EAAE,MAAM;IAC7B,UAAU,EAAE,MAAM;IAClB,cAAc,EAAE,MAAM;IACtB,MAAM,EAAE,MAAM;IACd,kBAAkB,EAAE,MAAM;IAC1B,cAAc,EAAE,MAAM;CACvB,CAAC;AAEF;;;;GAIG;AACI,MAAM,mBAAmB,GAAG,GAAW,EAAE;IAC9C,MAAM,UAAU,GAAG;QACjB,yDAAyD;QACzD,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,eAAe,CAAC;QACtC,gEAAgE;QAChE,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,CAAC;KACnD,CAAC;IACF,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAA,eAAU,EAAC,SAAS,CAAC,CAAC,CAAC;IACpE,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAZW,QAAA,mBAAmB,uBAY9B;AAEK,MAAM,kBAAkB,GAAG,CAAC,IAAqB,EAAU,EAAE,CAClE,IAAA,WAAI,EAAC,IAAA,2BAAmB,GAAE,EAAE,IAAI,CAAC,CAAC;AADvB,QAAA,kBAAkB,sBACK"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { ComponentContext } from "../../../types/context";
|
|
2
|
-
import type { DeployConfigCloudRun } from "../../types/googleCloudRun";
|
|
3
2
|
export declare const gcloudCmd: (version?: "beta") => string;
|
|
4
3
|
export declare const gcloudRunCmd: (version?: "beta") => string;
|
|
5
4
|
export declare const gcloudSchedulerCmd: (version?: "beta") => string;
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* the default compute service account of the gcloud project — used by
|
|
7
|
+
* cloud scheduler to authenticate its calls
|
|
8
|
+
*/
|
|
9
|
+
export declare const getComputeServiceAccountEmail: (context: ComponentContext) => string;
|
|
7
10
|
export declare const makeLabelString: (obj: Record<string, unknown>) => string;
|
|
8
|
-
export declare const getCloudRunDeployConfig: (context: ComponentContext) => DeployConfigCloudRun;
|
|
11
|
+
export declare const getCloudRunDeployConfig: (context: ComponentContext) => import("../../types").DeployConfigCloudRun;
|
|
9
12
|
export declare function getCommonCloudRunArgs(context: ComponentContext): {
|
|
10
13
|
project: string;
|
|
11
14
|
region: import("../../types").Gcloudregion;
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getCommonDeployArgs = exports.getCommonCloudRunArgs = exports.getCloudRunDeployConfig = exports.makeLabelString = exports.
|
|
6
|
+
exports.getCommonDeployArgs = exports.getCommonCloudRunArgs = exports.getCloudRunDeployConfig = exports.makeLabelString = exports.getComputeServiceAccountEmail = exports.gcloudSchedulerCmd = exports.gcloudRunCmd = exports.gcloudCmd = void 0;
|
|
7
|
+
const store_1 = require("../../../store");
|
|
7
8
|
const types_1 = require("../../types");
|
|
8
9
|
const artifactsRegistry_1 = require("../artifactsRegistry");
|
|
9
10
|
const gcloudCmd = version => {
|
|
@@ -18,8 +19,15 @@ const gcloudSchedulerCmd = version => {
|
|
|
18
19
|
return `${(0, exports.gcloudCmd)(version)} scheduler`;
|
|
19
20
|
};
|
|
20
21
|
exports.gcloudSchedulerCmd = gcloudSchedulerCmd;
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* the default compute service account of the gcloud project — used by
|
|
24
|
+
* cloud scheduler to authenticate its calls
|
|
25
|
+
*/
|
|
26
|
+
const getComputeServiceAccountEmail = context => {
|
|
27
|
+
const deployConfig = (0, exports.getCloudRunDeployConfig)(context);
|
|
28
|
+
return `${(0, store_1.getGcloudProjectNumber)(context.fullConfig, deployConfig.projectId)}-compute@developer.gserviceaccount.com`;
|
|
29
|
+
};
|
|
30
|
+
exports.getComputeServiceAccountEmail = getComputeServiceAccountEmail;
|
|
23
31
|
const makeLabelString = obj => Object.entries(obj).map(([key, value]) => `${key}=${value}`).join(",");
|
|
24
32
|
exports.makeLabelString = makeLabelString;
|
|
25
33
|
const getCloudRunDeployConfig = context => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../../../pipeline/src/deploy/cloudRun/createJobs/common.ts"],"names":[],"mappings":";;;AAEA,uCAA6C;
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../../../pipeline/src/deploy/cloudRun/createJobs/common.ts"],"names":[],"mappings":";;;AAEA,0CAAwD;AACxD,uCAA6C;AAC7C,4DAAiE;AAE1D,MAAM,SAAS,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC5C,OAAO,OAAO,CAAC,CAAC,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;AAClD,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB;AACK,MAAM,YAAY,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC/C,OAAO,GAAG,IAAA,iBAAS,EAAC,OAAO,CAAC,MAAM,CAAC;AACrC,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEv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C5B,CAAC;AACJ,CAAC;AAND,sDAMC;AAED,SAAgB,mBAAmB,CAAC,OAAyB;IAC3D,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,YAAY,GAAG,IAAA,+BAAuB,EAAC,OAAO,CAAC,CAAC;IACtD,OAAO;QACL,KAAK,EAAE,IAAA,6CAAyB,EAAC,OAAO,CAAC;QACzC,GAAG,UAAU;QACb,wBAAwB,EAAE,YAAY,CAAC,QAAQ;YAC7C,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,sBAAsB;YAC9C,CAAC,CAAC,SAAS;KACd,CAAC;AACJ,CAAC;AAVD,kDAUC"}
|
|
@@ -77,7 +77,7 @@ const getSchedulerArgs = (scheduler, context) => {
|
|
|
77
77
|
}),
|
|
78
78
|
"message-body": body ? '"' + (0, bash_1.bashEscape)(JSON.stringify(body)) + '"' : undefined,
|
|
79
79
|
"http-method": "POST",
|
|
80
|
-
"oauth-service-account-email": `"$
|
|
80
|
+
"oauth-service-account-email": `"${(0, common_1.getComputeServiceAccountEmail)(context)}"`
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
if (scheduler.type === "http") {
|
|
@@ -85,7 +85,7 @@ const getSchedulerArgs = (scheduler, context) => {
|
|
|
85
85
|
uri: scheduler.url,
|
|
86
86
|
"message-body": scheduler.body,
|
|
87
87
|
"http-method": scheduler.method,
|
|
88
|
-
"oidc-service-account-email": `"$
|
|
88
|
+
"oidc-service-account-email": `"${(0, common_1.getComputeServiceAccountEmail)(context)}"`
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
throw new Error(`Unknown scheduler type: ${scheduler.type}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedules.js","sourceRoot":"","sources":["../../../../../../../../pipeline/src/deploy/cloudRun/createJobs/execute/schedules.ts"],"names":[],"mappings":";;;AAAA,2CAA8C;AAM9C,6CAA2C;AAK3C,2EAA4E;AAC5E,mEAAgE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H,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -22,7 +22,7 @@ function getCloudRunDeployScripts(context) {
|
|
|
22
22
|
var _a, _b;
|
|
23
23
|
const deployConfig = (0, common_1.getCloudRunDeployConfig)(context);
|
|
24
24
|
const allEnvVars = (0, lodash_es_1.omit)(context.environment.envVars, __1.GCLOUD_DEPLOY_CREDENTIALS_KEY);
|
|
25
|
-
return [...(0, gitlab_1.collapseableSection)("prepare", "Prepare...")([...(0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)
|
|
25
|
+
return [...(0, gitlab_1.collapseableSection)("prepare", "Prepare...")([...(0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)]), ...(0, gitlab_1.collapseableSection)("writeenvvars", "Write env vars to file")((0, bashYaml_1.writeBashYamlToFileScript)(allEnvVars, constants_1.ENV_VARS_FILENAME)), ...(0, gitlab_1.collapseableSection)("deploy", "Deploy to cloud run")([...(deployConfig.cloudSql ? (0, database_1.getDatabaseCreateScript)(context, deployConfig) // we create the db, so that we can also delete it afterwards
|
|
26
26
|
: []), ...(0, schedules_1.getCreateScheduleScript)(context), ...(0, cloudRunJobs_1.getJobCreateScripts)(context), ...(0, onDeploy_1.getOnDeployExecuteScript)(context, "preDeploy"), ...(deployConfig.service !== false ? [(0, cloudRunServices_1.getServiceDeployScript)(context, deployConfig.service)] : []), ...Object.entries((_a = deployConfig.additionalServices) !== null && _a !== void 0 ? _a : {}).filter(([_, service]) => service !== false && service !== null).map(([name, service]) => (0, cloudRunServices_1.getServiceDeployScript)(context, service, "-" + name)), ...Object.entries((_b = deployConfig.workerPools) !== null && _b !== void 0 ? _b : {}).filter(([_, workerPool]) => workerPool !== false && workerPool !== null).map(([name, workerPool]) => (0, cloudRunWorkerPools_1.getWorkerPoolDeployScript)(context, workerPool, name)), ...(0, onDeploy_1.getOnDeployExecuteScript)(context, "postDeploy")]), ...(0, gitlab_1.collapseableSection)("cleanup", "Cleanup")((0, cleanup_1.getRemoveOldRevisionsAndImagesCommand)(context, "postDeploy"))];
|
|
27
27
|
}
|
|
28
28
|
exports.getCloudRunDeployScripts = getCloudRunDeployScripts;
|