@catladder/pipeline 3.5.0 → 3.7.0
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/build/artifacts/createBuildJobArtifact.js +1 -1
- package/dist/build/base/index.d.ts +2 -3
- package/dist/build/cache/getAllCacheConfigsFromConfig.js +2 -2
- package/dist/build/custom/buildJob.d.ts +2 -2
- package/dist/build/custom/index.d.ts +2 -2
- package/dist/build/custom/testJob.d.ts +2 -2
- package/dist/build/docker.d.ts +4 -4
- package/dist/build/index.d.ts +2 -2
- package/dist/build/node/buildJob.d.ts +5 -3
- package/dist/build/node/index.d.ts +4 -4
- package/dist/build/node/meteor.d.ts +2 -2
- package/dist/build/node/yarn.d.ts +1 -1
- package/dist/build/node/yarn.js +1 -1
- package/dist/build/rails/build.d.ts +2 -2
- package/dist/build/rails/index.d.ts +2 -2
- package/dist/build/sbom.d.ts +2 -2
- package/dist/constants.js +1 -1
- package/dist/context/createComponentContext.js +11 -4
- package/dist/context/getLabels.js +1 -1
- package/dist/deploy/cloudRun/createJobs/cloudRunJobs.js +2 -2
- package/dist/deploy/cloudRun/createJobs/cloudRunServices.js +28 -10
- package/dist/deploy/cloudRun/createJobs/execute/onDeploy.d.ts +2 -3
- package/dist/deploy/cloudRun/createJobs/execute/onDeploy.js +4 -9
- package/dist/deploy/cloudRun/utils/getJobOrServiceArgs.d.ts +2 -0
- package/dist/deploy/cloudRun/utils/getJobOrServiceArgs.js +12 -0
- package/dist/deploy/kubernetes/kubeValues.d.ts +2 -2
- package/dist/deploy/kubernetes/kubeValues.js +1 -1
- package/dist/deploy/sbom.js +1 -1
- package/dist/deploy/types/googleCloudRun.d.ts +20 -0
- package/dist/pipeline/createJobsForComponent.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/types/context.d.ts +6 -1
- package/examples/__snapshots__/cloud-run-llama.test.ts.snap +624 -0
- package/examples/__snapshots__/cloud-run-with-gpu.test.ts.snap +1382 -0
- package/examples/cloud-run-llama.test.ts +11 -0
- package/examples/cloud-run-llama.ts +40 -0
- package/examples/cloud-run-with-gpu.test.ts +11 -0
- package/examples/cloud-run-with-gpu.ts +30 -0
- package/package.json +1 -1
- package/src/build/artifacts/createBuildJobArtifact.ts +3 -1
- package/src/build/base/index.ts +5 -2
- package/src/build/cache/getAllCacheConfigsFromConfig.ts +7 -6
- package/src/build/custom/buildJob.ts +2 -2
- package/src/build/custom/index.ts +4 -2
- package/src/build/custom/testJob.ts +2 -2
- package/src/build/docker.ts +8 -4
- package/src/build/index.ts +5 -2
- package/src/build/node/buildJob.ts +5 -2
- package/src/build/node/index.ts +9 -4
- package/src/build/node/meteor.ts +5 -2
- package/src/build/node/yarn.ts +4 -2
- package/src/build/rails/build.ts +3 -7
- package/src/build/rails/index.ts +4 -2
- package/src/build/sbom.ts +4 -2
- package/src/context/createComponentContext.ts +22 -9
- package/src/context/getLabels.ts +4 -1
- package/src/deploy/cloudRun/createJobs/cloudRunJobs.ts +2 -2
- package/src/deploy/cloudRun/createJobs/cloudRunServices.ts +24 -3
- package/src/deploy/cloudRun/createJobs/execute/onDeploy.ts +3 -13
- package/src/deploy/cloudRun/utils/getJobOrServiceArgs.ts +18 -0
- package/src/deploy/kubernetes/kubeValues.ts +13 -4
- package/src/deploy/sbom.ts +4 -3
- package/src/deploy/types/googleCloudRun.ts +23 -0
- package/src/pipeline/createJobsForComponent.ts +10 -2
- package/src/types/config.ts +1 -1
- package/src/types/context.ts +10 -1
|
@@ -79,7 +79,7 @@ var createBuildJobArtifacts = function (context) {
|
|
|
79
79
|
exports.createBuildJobArtifacts = createBuildJobArtifacts;
|
|
80
80
|
var getArtifactsPathForComponent = function (c, additionalPaths) {
|
|
81
81
|
var _a, _b;
|
|
82
|
-
return (_b = __spreadArray(__spreadArray([], __read((_a = c.build.config.artifactsPaths) !== null && _a !== void 0 ? _a : []), false), __read(additionalPaths !== null && additionalPaths !== void 0 ? additionalPaths : []), false)) === null || _b === void 0 ? void 0 : _b.flatMap(function (artifact) {
|
|
82
|
+
return (_b = __spreadArray(__spreadArray([], __read(c.build.type !== "disabled" ? (_a = c.build.config.artifactsPaths) !== null && _a !== void 0 ? _a : [] : []), false), __read(additionalPaths !== null && additionalPaths !== void 0 ? additionalPaths : []), false)) === null || _b === void 0 ? void 0 : _b.flatMap(function (artifact) {
|
|
83
83
|
return c.build
|
|
84
84
|
// in theory, we only need "direct",
|
|
85
85
|
// but in some cases project may have packages in the workspace that create build artifacts, which aren't components
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { WorkspaceContext } from "../../types/context";
|
|
2
|
-
import { type ComponentContext } from "../../types/context";
|
|
1
|
+
import type { ComponentContextWithBuild, WorkspaceContext } from "../../types/context";
|
|
3
2
|
import type { AppBuildJobDefinition, DockerBuildJobDefinition } from "../../types/jobDefinition";
|
|
4
3
|
import type { CatladderJob } from "../../types/jobs";
|
|
5
|
-
export declare const createComponentBuildJobs: (context:
|
|
4
|
+
export declare const createComponentBuildJobs: (context: ComponentContextWithBuild, definitions: {
|
|
6
5
|
appBuild?: AppBuildJobDefinition;
|
|
7
6
|
dockerBuild: DockerBuildJobDefinition;
|
|
8
7
|
}) => CatladderJob[];
|
|
@@ -54,11 +54,11 @@ var getAllCacheConfigsFromConfig = function (context, configWithCache) {
|
|
|
54
54
|
// we would probably need to introduce a path to the right config property (build-->test or so)
|
|
55
55
|
context.components.flatMap(function (componentContext) {
|
|
56
56
|
var _a;
|
|
57
|
-
return (_a = (0, index_1.ensureArray)(componentContext.build.config.cache).map(function (c) {
|
|
57
|
+
return componentContext.build.type !== "disabled" ? (_a = (0, index_1.ensureArray)(componentContext.build.config.cache).map(function (c) {
|
|
58
58
|
return __assign(__assign({}, c), {
|
|
59
59
|
baseDir: componentContext.build.dir
|
|
60
60
|
});
|
|
61
|
-
})) !== null && _a !== void 0 ? _a : [];
|
|
61
|
+
})) !== null && _a !== void 0 ? _a : [] : [];
|
|
62
62
|
}) : []), false);
|
|
63
63
|
};
|
|
64
64
|
exports.getAllCacheConfigsFromConfig = getAllCacheConfigsFromConfig;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContextWithBuild } from "../../types/context";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
-
export declare const createCustomBuildJobs: (context:
|
|
3
|
+
export declare const createCustomBuildJobs: (context: ComponentContextWithBuild) => CatladderJob[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContextWithBuild } from "../../types";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
-
export declare const createCustomJobs: (context:
|
|
3
|
+
export declare const createCustomJobs: (context: ComponentContextWithBuild) => CatladderJob[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Artifacts } from "../../types";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentContextWithBuild } from "../../types/context";
|
|
3
3
|
import type { CatladderJob } from "../../types/jobs";
|
|
4
|
-
export declare const createCustomTestJobs: (context:
|
|
4
|
+
export declare const createCustomTestJobs: (context: ComponentContextWithBuild) => CatladderJob[];
|
|
5
5
|
export type OptionalArtifacts = {
|
|
6
6
|
artifacts: Artifacts;
|
|
7
7
|
} | undefined;
|
package/dist/build/docker.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BuildConfigDocker } from ".";
|
|
2
|
-
import type { ComponentContext, DockerBuildJobDefinition } from "../types";
|
|
2
|
+
import type { ComponentContext, ComponentContextWithBuild, DockerBuildJobDefinition } from "../types";
|
|
3
3
|
import type { CatladderJob } from "../types/jobs";
|
|
4
4
|
export declare const getDockerImageVariables: (context: ComponentContext) => {
|
|
5
5
|
DOCKER_IMAGE_TAG: string;
|
|
@@ -17,7 +17,7 @@ export declare const getDockerImageVariables: (context: ComponentContext) => {
|
|
|
17
17
|
* Weather the context requires a docker build
|
|
18
18
|
*/
|
|
19
19
|
export declare const requiresDockerBuild: (context: ComponentContext) => boolean;
|
|
20
|
-
export declare const getDockerBuildVariables: (context:
|
|
20
|
+
export declare const getDockerBuildVariables: (context: ComponentContextWithBuild) => {
|
|
21
21
|
DOCKER_IMAGE_TAG: string;
|
|
22
22
|
DOCKER_REGISTRY: string;
|
|
23
23
|
DOCKER_IMAGE: import("..").StringOrBashExpression;
|
|
@@ -58,12 +58,12 @@ export declare const getDockerBuildVariables: (context: ComponentContext) => {
|
|
|
58
58
|
};
|
|
59
59
|
export declare const DOCKER_BUILD_JOB_NAME = "\uD83D\uDD28 docker";
|
|
60
60
|
export declare const getDockerJobBaseProps: () => Pick<CatladderJob, "image" | "services" | "variables" | "runnerVariables">;
|
|
61
|
-
export declare const createDockerBuildJobBase: (context:
|
|
61
|
+
export declare const createDockerBuildJobBase: (context: ComponentContextWithBuild, {
|
|
62
62
|
script,
|
|
63
63
|
cache,
|
|
64
64
|
...def
|
|
65
65
|
}: DockerBuildJobDefinition) => CatladderJob;
|
|
66
66
|
export declare const gitlabDockerLogin: (context: ComponentContext) => string[];
|
|
67
|
-
export declare const getDockerBuildScriptWithBuiltInDockerFile: (context:
|
|
67
|
+
export declare const getDockerBuildScriptWithBuiltInDockerFile: (context: ComponentContextWithBuild, defaultType?: BuildConfigDocker["type"]) => (string | undefined)[];
|
|
68
68
|
export declare const getDockerBuildDefaultScript: (context: ComponentContext, ensureDockerFileScript?: string | null) => (string | undefined)[];
|
|
69
69
|
export declare const hasDockerfile: (context: ComponentContext) => boolean;
|
package/dist/build/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContextWithBuild, WorkspaceContext } from "../types/context";
|
|
2
2
|
import type { EnvironmentContext } from "../types/environmentContext";
|
|
3
3
|
import type { CatladderJob } from "../types/jobs";
|
|
4
4
|
import type { BuildConfig, BuildConfigStandaloneType, WorkspaceBuildConfig } from "./types";
|
|
5
5
|
export * from "./node";
|
|
6
6
|
export * from "./types";
|
|
7
7
|
export type BuildTypes = { [type in BuildConfigStandaloneType]: {
|
|
8
|
-
jobs: (context:
|
|
8
|
+
jobs: (context: ComponentContextWithBuild) => CatladderJob[];
|
|
9
9
|
defaults: (envContext: EnvironmentContext) => Partial<Extract<BuildConfig, {
|
|
10
10
|
type: type;
|
|
11
11
|
}>>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { BuildContextStandalone, WorkspaceContext } from "../../types/context";
|
|
1
|
+
import type { BuildContextStandalone, ComponentContextWithBuild, WorkspaceContext } from "../../types/context";
|
|
2
2
|
import { type ComponentContext } from "../../types/context";
|
|
3
3
|
import type { AppBuildJobDefinition, DockerBuildJobDefinition } from "../../types/jobDefinition";
|
|
4
4
|
import type { CatladderJob } from "../../types/jobs";
|
|
5
|
-
export declare const createNodeBuildJobs: (context:
|
|
5
|
+
export declare const createNodeBuildJobs: (context: ComponentContextWithBuild | WorkspaceContext) => CatladderJob[];
|
|
6
6
|
export declare const createNodeBuildJobDefinition: (context: ComponentContext<BuildContextStandalone> | WorkspaceContext) => AppBuildJobDefinition | undefined;
|
|
7
|
-
|
|
7
|
+
type NewType = ComponentContextWithBuild;
|
|
8
|
+
export declare const createNodeDockerJobDefinition: (context: NewType) => DockerBuildJobDefinition;
|
|
9
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContextWithBuild, WorkspaceContext } from "../../types/context";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
-
export declare const createNodeJobs: (context:
|
|
4
|
-
export declare const createStorybookJobs: (context:
|
|
5
|
-
export declare const createMeteorJobs: (context:
|
|
3
|
+
export declare const createNodeJobs: (context: ComponentContextWithBuild | WorkspaceContext) => CatladderJob[];
|
|
4
|
+
export declare const createStorybookJobs: (context: ComponentContextWithBuild) => CatladderJob[];
|
|
5
|
+
export declare const createMeteorJobs: (context: ComponentContextWithBuild) => CatladderJob[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContextWithBuild } from "../../types/context";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
-
export declare const createMeteorBuildJobs: (context:
|
|
3
|
+
export declare const createMeteorBuildJobs: (context: ComponentContextWithBuild) => CatladderJob[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BashExpression } from "../../bash/BashExpression";
|
|
2
|
-
import type
|
|
2
|
+
import { type Context } from "../../types";
|
|
3
3
|
export declare const ensureNodeVersion: (context: Context) => string[];
|
|
4
4
|
export declare const getYarnInstall: (context: Context, options?: {
|
|
5
5
|
noCustomPostInstall: boolean;
|
package/dist/build/node/yarn.js
CHANGED
|
@@ -52,7 +52,7 @@ var ensureNodeVersion = function (context) {
|
|
|
52
52
|
};
|
|
53
53
|
exports.ensureNodeVersion = ensureNodeVersion;
|
|
54
54
|
var getYarnInstall = function (context, options) {
|
|
55
|
-
var postInstall = context.type !== "workspace" && "postInstall" in context.build.config ? context.build.config.postInstall : null;
|
|
55
|
+
var postInstall = context.type !== "workspace" && context.build.type !== "disabled" && "postInstall" in context.build.config ? context.build.config.postInstall : null;
|
|
56
56
|
return __spreadArray(__spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), __read((0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(context)])), false), __read(postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall) ? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((0, utils_1.ensureArray)(postInstall)) : []), false);
|
|
57
57
|
};
|
|
58
58
|
exports.getYarnInstall = getYarnInstall;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ComponentContextWithBuild } from "../..";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
-
export declare const createRailsBuildJobs: (context:
|
|
3
|
+
export declare const createRailsBuildJobs: (context: ComponentContextWithBuild) => CatladderJob[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContextWithBuild } from "../../types";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
-
export declare const createRailsJobs: (context:
|
|
3
|
+
export declare const createRailsJobs: (context: ComponentContextWithBuild) => CatladderJob[];
|
package/dist/build/sbom.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContextWithBuild } from "../types/context";
|
|
2
2
|
import type { CatladderJob } from "../types/jobs";
|
|
3
3
|
export declare const SBOM_BUILD_JOB_NAME = "\uD83E\uDDFE sbom";
|
|
4
4
|
export declare const SBOM_FILE = "__sbom.json";
|
|
5
|
-
export declare const createSbomBuildJob: (context:
|
|
5
|
+
export declare const createSbomBuildJob: (context: ComponentContextWithBuild) => CatladderJob;
|
package/dist/constants.js
CHANGED
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
7
|
-
exports.PIPELINE_IMAGE_TAG = "v3-
|
|
7
|
+
exports.PIPELINE_IMAGE_TAG = "v3-7-0-83dd094e" || "latest";
|
|
8
8
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "git.panter.ch:5001/catladder/catladder";
|
|
@@ -182,15 +182,15 @@ var createComponentContext = function (ctx) {
|
|
|
182
182
|
packageManagerInfo = _b.sent();
|
|
183
183
|
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
|
|
184
184
|
componentConfigWithoutDefaults = envContext.envConfigRaw;
|
|
185
|
-
resolvedBuildType = (0, build_1.isStandaloneBuildConfig)(componentConfigWithoutDefaults.build) ? componentConfigWithoutDefaults.build.type : (_a = ctx.config.builds) === null || _a === void 0 ? void 0 : _a[componentConfigWithoutDefaults.build.from].type;
|
|
186
|
-
if (
|
|
185
|
+
resolvedBuildType = componentConfigWithoutDefaults.build === false ? false : (0, build_1.isStandaloneBuildConfig)(componentConfigWithoutDefaults.build) ? componentConfigWithoutDefaults.build.type : (_a = ctx.config.builds) === null || _a === void 0 ? void 0 : _a[componentConfigWithoutDefaults.build.from].type;
|
|
186
|
+
if (resolvedBuildType === undefined) {
|
|
187
187
|
throw new Error("build type not found, is the build config correct?");
|
|
188
188
|
}
|
|
189
189
|
defaults = componentConfigWithoutDefaults.deploy ? {
|
|
190
|
-
build: build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
|
|
190
|
+
build: resolvedBuildType && build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
|
|
191
191
|
deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext)
|
|
192
192
|
} : {
|
|
193
|
-
build: build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
|
|
193
|
+
build: resolvedBuildType && build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
|
|
194
194
|
deploy: {}
|
|
195
195
|
};
|
|
196
196
|
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
@@ -204,6 +204,13 @@ var createComponentContext = function (ctx) {
|
|
|
204
204
|
};
|
|
205
205
|
_getBuildContext = function () {
|
|
206
206
|
var _a;
|
|
207
|
+
if (build === false) {
|
|
208
|
+
return {
|
|
209
|
+
type: "disabled",
|
|
210
|
+
getComponentDirs: getComponentDirs,
|
|
211
|
+
dir: dir
|
|
212
|
+
};
|
|
213
|
+
}
|
|
207
214
|
if ((0, build_1.isStandaloneBuildConfig)(build)) {
|
|
208
215
|
return {
|
|
209
216
|
dir: dir,
|
|
@@ -34,7 +34,7 @@ var getLabels = function (context) {
|
|
|
34
34
|
"app-name": sanitize(context.fullConfig.appName),
|
|
35
35
|
"env-type": sanitize(context.environment.envType),
|
|
36
36
|
"env-name": sanitize(context.env),
|
|
37
|
-
"build-type": sanitize(context.build.buildType)
|
|
37
|
+
"build-type": context.build.type === "disabled" ? "disabled" : sanitize(context.build.buildType)
|
|
38
38
|
}, (_b = (_a = context.fullConfig.meta) === null || _a === void 0 ? void 0 : _a.labels) !== null && _b !== void 0 ? _b : {});
|
|
39
39
|
return labels;
|
|
40
40
|
};
|
|
@@ -60,7 +60,7 @@ var jobName_1 = require("../utils/jobName");
|
|
|
60
60
|
var common_1 = require("./common");
|
|
61
61
|
var constants_1 = require("./constants");
|
|
62
62
|
var volumes_1 = require("./volumes");
|
|
63
|
-
var
|
|
63
|
+
var getJobOrServiceArgs_1 = require("../utils/getJobOrServiceArgs");
|
|
64
64
|
var getDeleteJobsScripts = function (context) {
|
|
65
65
|
var commonArgs = (0, common_1.getCommonCloudRunArgs)(context);
|
|
66
66
|
var commonArgsString = (0, createArgsString_1.createArgsString)(commonArgs);
|
|
@@ -86,7 +86,7 @@ var getJobCreateScripts = function (context) {
|
|
|
86
86
|
deployArgs = __rest(_g, ["image", "project", "region"]);
|
|
87
87
|
var commonDeployArgsString = createArgsString_1.createArgsString.apply(void 0, __spreadArray([__assign(__assign({
|
|
88
88
|
command: "\"".concat(commandArray.join(","), "\""),
|
|
89
|
-
args: (0,
|
|
89
|
+
args: (0, getJobOrServiceArgs_1.getCloudRunServiceOrJobArgsArg)(job.args),
|
|
90
90
|
labels: "\"".concat((0, common_1.makeLabelString)((0, getLabels_1.getLabels)(context)), ",cloud-run-job-name=$current_job_name\""),
|
|
91
91
|
image: "\"".concat((_b = job.image) !== null && _b !== void 0 ? _b : commonImage, "\""),
|
|
92
92
|
project: project,
|
|
@@ -47,28 +47,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
47
47
|
exports.getServiceDeleteScript = exports.getServiceDeployScript = void 0;
|
|
48
48
|
var getLabels_1 = require("../../../context/getLabels");
|
|
49
49
|
var createArgsString_1 = require("../utils/createArgsString");
|
|
50
|
+
var getJobOrServiceArgs_1 = require("../utils/getJobOrServiceArgs");
|
|
50
51
|
var getServiceName_1 = require("../utils/getServiceName");
|
|
51
52
|
var common_1 = require("./common");
|
|
52
53
|
var constants_1 = require("./constants");
|
|
53
54
|
var volumes_1 = require("./volumes");
|
|
54
55
|
var getServiceDeployScript = function (context, service, nameSuffix) {
|
|
55
|
-
var _a, _b, _c, _d, _e;
|
|
56
|
+
var _a, _b, _c, _d, _e, _f;
|
|
56
57
|
var commonDeployArgs = (0, common_1.getCommonDeployArgs)(context);
|
|
57
58
|
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
58
59
|
var customConfig = service !== true ? service : undefined;
|
|
59
|
-
var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.build.config.startCommand : undefined;
|
|
60
|
+
var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.build.type !== "disabled" ? context.build.config.startCommand : undefined : undefined;
|
|
60
61
|
var commandArray = command ? Array.isArray(command) ? command : command.split(" ") : undefined;
|
|
61
62
|
var fullServiceName = serviceName.concat(nameSuffix !== null && nameSuffix !== void 0 ? nameSuffix : "");
|
|
62
63
|
var argsString = createArgsString_1.createArgsString.apply(void 0, __spreadArray([__assign(__assign({
|
|
63
64
|
// command as empty string resets it to default (uses the image's entrypoint)
|
|
64
|
-
command: commandArray ? '"' + commandArray.join(",") + '"' : '""'
|
|
65
|
+
command: commandArray ? '"' + commandArray.join(",") + '"' : '""',
|
|
66
|
+
args: (0, getJobOrServiceArgs_1.getCloudRunServiceOrJobArgsArg)(customConfig === null || customConfig === void 0 ? void 0 : customConfig.args)
|
|
65
67
|
}, commonDeployArgs), {
|
|
68
|
+
image: (_b = customConfig === null || customConfig === void 0 ? void 0 : customConfig.image) !== null && _b !== void 0 ? _b : commonDeployArgs.image,
|
|
66
69
|
labels: (0, common_1.makeLabelString)(__assign(__assign({}, (0, getLabels_1.getLabels)(context)), {
|
|
67
70
|
"cloud-run-service-name": fullServiceName
|
|
68
71
|
})),
|
|
69
72
|
"env-vars-file": constants_1.ENV_VARS_FILENAME,
|
|
70
|
-
"min-instances": (
|
|
71
|
-
"max-instances": (
|
|
73
|
+
"min-instances": (_c = customConfig === null || customConfig === void 0 ? void 0 : customConfig.minInstances) !== null && _c !== void 0 ? _c : 0,
|
|
74
|
+
"max-instances": (_d = customConfig === null || customConfig === void 0 ? void 0 : customConfig.maxInstances) !== null && _d !== void 0 ? _d : 100,
|
|
72
75
|
"cpu-throttling": (customConfig === null || customConfig === void 0 ? void 0 : customConfig.noCpuThrottling) !== true,
|
|
73
76
|
cpu: customConfig === null || customConfig === void 0 ? void 0 : customConfig.cpu,
|
|
74
77
|
memory: customConfig === null || customConfig === void 0 ? void 0 : customConfig.memory,
|
|
@@ -78,12 +81,15 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
|
|
|
78
81
|
network: customConfig === null || customConfig === void 0 ? void 0 : customConfig.network,
|
|
79
82
|
subnet: customConfig === null || customConfig === void 0 ? void 0 : customConfig.subnet,
|
|
80
83
|
"use-http2": customConfig === null || customConfig === void 0 ? void 0 : customConfig.http2,
|
|
81
|
-
"allow-unauthenticated": (
|
|
82
|
-
ingress: (
|
|
84
|
+
"allow-unauthenticated": (_e = customConfig === null || customConfig === void 0 ? void 0 : customConfig.allowUnauthenticated) !== null && _e !== void 0 ? _e : true,
|
|
85
|
+
ingress: (_f = customConfig === null || customConfig === void 0 ? void 0 : customConfig.ingress) !== null && _f !== void 0 ? _f : "all",
|
|
83
86
|
"cpu-boost": true,
|
|
84
|
-
"execution-environment": customConfig === null || customConfig === void 0 ? void 0 : customConfig.executionEnvironment
|
|
87
|
+
"execution-environment": customConfig === null || customConfig === void 0 ? void 0 : customConfig.executionEnvironment,
|
|
88
|
+
gpu: customConfig === null || customConfig === void 0 ? void 0 : customConfig.gpu,
|
|
89
|
+
"gpu-type": customConfig === null || customConfig === void 0 ? void 0 : customConfig.gpuType
|
|
85
90
|
})], __read((0, volumes_1.createVolumeConfig)(customConfig === null || customConfig === void 0 ? void 0 : customConfig.volumes, "service")), false));
|
|
86
|
-
|
|
91
|
+
var version = requiresBeta(customConfig) ? "beta" : undefined;
|
|
92
|
+
return "".concat((0, common_1.gcloudRunCmd)(version), " deploy ").concat(fullServiceName, " ").concat(argsString);
|
|
87
93
|
};
|
|
88
94
|
exports.getServiceDeployScript = getServiceDeployScript;
|
|
89
95
|
var getServiceDeleteScript = function (context, serviceSuffix) {
|
|
@@ -93,4 +99,16 @@ var getServiceDeleteScript = function (context, serviceSuffix) {
|
|
|
93
99
|
var fullServiceName = serviceSuffix ? "".concat(serviceName, "-").concat(serviceSuffix) : serviceName;
|
|
94
100
|
return ["".concat((0, common_1.gcloudRunCmd)(), " services delete ").concat(fullServiceName, " ").concat(commonArgsString)];
|
|
95
101
|
};
|
|
96
|
-
exports.getServiceDeleteScript = getServiceDeleteScript;
|
|
102
|
+
exports.getServiceDeleteScript = getServiceDeleteScript;
|
|
103
|
+
var requiresBeta = function (config) {
|
|
104
|
+
if (!config) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
if (config.gpuType) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
if (config.gpu && config.gpu > 0) {
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { ComponentContext } from "../../../../types/context";
|
|
2
|
-
import type { DeployConfigCloudRunExecuteOnDeploy
|
|
3
|
-
export declare const getOnDeployExecuteScript: (context: ComponentContext, when: DeployConfigCloudRunExecuteOnDeploy["when"]) => string[];
|
|
4
|
-
export declare const getCloudRunJobArgsArg: (args: DeployConfigCloudRunExecuteOnDeploy["args"] | DeployConfigCloudRunJob["args"]) => string | undefined;
|
|
2
|
+
import type { DeployConfigCloudRunExecuteOnDeploy } from "../../../types/googleCloudRun";
|
|
3
|
+
export declare const getOnDeployExecuteScript: (context: ComponentContext, when: DeployConfigCloudRunExecuteOnDeploy["when"]) => string[];
|
|
@@ -44,8 +44,9 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
44
44
|
Object.defineProperty(exports, "__esModule", {
|
|
45
45
|
value: true
|
|
46
46
|
});
|
|
47
|
-
exports.
|
|
47
|
+
exports.getOnDeployExecuteScript = void 0;
|
|
48
48
|
var createArgsString_1 = require("../../utils/createArgsString");
|
|
49
|
+
var getJobOrServiceArgs_1 = require("../../utils/getJobOrServiceArgs");
|
|
49
50
|
var jobName_1 = require("../../utils/jobName");
|
|
50
51
|
var cloudRunJobs_1 = require("../cloudRunJobs");
|
|
51
52
|
var common_1 = require("../common");
|
|
@@ -107,14 +108,8 @@ var getJobRunScriptForExecute = function (context, _a) {
|
|
|
107
108
|
: false;
|
|
108
109
|
var argString = (0, createArgsString_1.createArgsString)(__assign(__assign({}, commonArgs), {
|
|
109
110
|
wait: waitForCompletion === true ? true : undefined,
|
|
110
|
-
args: (0,
|
|
111
|
+
args: (0, getJobOrServiceArgs_1.getCloudRunServiceOrJobArgsArg)(config.args)
|
|
111
112
|
}));
|
|
112
113
|
var fullJobName = (0, jobName_1.getFullJobName)(context, jobName);
|
|
113
114
|
return "".concat((0, common_1.gcloudRunCmd)(), " jobs execute ").concat(fullJobName.toString(), " ").concat(argString);
|
|
114
|
-
};
|
|
115
|
-
var getCloudRunJobArgsArg = function (args) {
|
|
116
|
-
return args !== undefined ? args.length > 0 ? args === null || args === void 0 ? void 0 : args.map(function (arg) {
|
|
117
|
-
return "\"".concat(arg, "\"");
|
|
118
|
-
}).join(",") : "" : undefined;
|
|
119
|
-
};
|
|
120
|
-
exports.getCloudRunJobArgsArg = getCloudRunJobArgsArg;
|
|
115
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { DeployConfigCloudRunExecuteOnDeploy, DeployConfigCloudRunJob, DeployConfigCloudRunService } from "../../types";
|
|
2
|
+
export declare const getCloudRunServiceOrJobArgsArg: (args: DeployConfigCloudRunExecuteOnDeploy["args"] | DeployConfigCloudRunJob["args"] | DeployConfigCloudRunService["args"]) => string | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getCloudRunServiceOrJobArgsArg = void 0;
|
|
7
|
+
var getCloudRunServiceOrJobArgsArg = function (args) {
|
|
8
|
+
return args !== undefined ? args.length > 0 ? args === null || args === void 0 ? void 0 : args.map(function (arg) {
|
|
9
|
+
return "\"".concat(arg, "\"");
|
|
10
|
+
}).join(",") : "" : undefined;
|
|
11
|
+
};
|
|
12
|
+
exports.getCloudRunServiceOrJobArgsArg = getCloudRunServiceOrJobArgsArg;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ComponentContext } from "../../types/context";
|
|
2
|
-
export declare const createKubeValues: (context: ComponentContext) => never[] | ({
|
|
1
|
+
import type { BuildContextComponent, ComponentContext } from "../../types/context";
|
|
2
|
+
export declare const createKubeValues: (context: ComponentContext<BuildContextComponent>) => never[] | ({
|
|
3
3
|
env: {
|
|
4
4
|
secret: Record<string, import("../..").VariableValue>;
|
|
5
5
|
public: Record<string, import("../..").VariableValue>;
|
|
@@ -62,7 +62,7 @@ var createAppConfig = function (context, application) {
|
|
|
62
62
|
rest = __rest(_a, ["healthRoute", "command"]);
|
|
63
63
|
return (0, utils_1.mergeWithMergingArrays)({
|
|
64
64
|
host: context.environment.envVars.HOSTNAME,
|
|
65
|
-
command: command !== null && command !== void 0 ? command : context.build.config.startCommand,
|
|
65
|
+
command: command !== null && command !== void 0 ? command : context.build.type !== "disabled" ? context.build.config.startCommand : undefined,
|
|
66
66
|
livenessProbe: {
|
|
67
67
|
httpGet: {
|
|
68
68
|
path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
|
package/dist/deploy/sbom.js
CHANGED
|
@@ -8,7 +8,7 @@ var BashExpression_1 = require("../bash/BashExpression");
|
|
|
8
8
|
var sbom_1 = require("../build/sbom");
|
|
9
9
|
var context_1 = require("../types/context");
|
|
10
10
|
var sbomDeactivated = function (context) {
|
|
11
|
-
return (0, context_1.componentContextIsStandaloneBuild)(context) && context.build.config.type === "custom" && context.build.config.sbom === false;
|
|
11
|
+
return context.build.type === "disabled" || (0, context_1.componentContextIsStandaloneBuild)(context) && context.build.config.type === "custom" && context.build.config.sbom === false;
|
|
12
12
|
};
|
|
13
13
|
exports.sbomDeactivated = sbomDeactivated;
|
|
14
14
|
var getDependencyTrackUploadScript = function (context) {
|
|
@@ -116,6 +116,26 @@ export type DeployConfigCloudRunService = {
|
|
|
116
116
|
*
|
|
117
117
|
*/
|
|
118
118
|
http2?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Number of GPUs to use. Defaults to 0
|
|
121
|
+
*
|
|
122
|
+
* This is a preview feature and not all regions support it.
|
|
123
|
+
*/
|
|
124
|
+
gpu?: number;
|
|
125
|
+
/**
|
|
126
|
+
* gpu type to use. Refer to https://cloud.google.com/run/docs/configuring/services/gpu#gcloud for defaults
|
|
127
|
+
*/
|
|
128
|
+
gpuType?: string;
|
|
129
|
+
/**
|
|
130
|
+
* the image to use. Defaults to the image from the build.
|
|
131
|
+
*
|
|
132
|
+
* If you specify an image, you usually want to disable the build by setting build: false
|
|
133
|
+
*/
|
|
134
|
+
image?: string;
|
|
135
|
+
/**
|
|
136
|
+
* args to pass to the command
|
|
137
|
+
*/
|
|
138
|
+
args?: string[];
|
|
119
139
|
} & DeployConfigCloudRunWithVolumes & DeployConfigCloudRunNetworkConfig;
|
|
120
140
|
export type DeployConfigCloudRunNetworkConfig = {
|
|
121
141
|
network?: string;
|
|
@@ -73,7 +73,7 @@ var getCustomJobs = function (context) {
|
|
|
73
73
|
return injectDefaultVarsInCustomJobs(context, rawJobs);
|
|
74
74
|
};
|
|
75
75
|
var createJobsForComponentContext = function (context) {
|
|
76
|
-
var buildJobs = build_1.BUILD_TYPES[context.build.buildType].jobs(context);
|
|
76
|
+
var buildJobs = context.build.type !== "disabled" ? build_1.BUILD_TYPES[context.build.buildType].jobs(context) : [];
|
|
77
77
|
var deployJobs = context.componentConfig.deploy !== false ? deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context) : [];
|
|
78
78
|
var customJobs = getCustomJobs(context);
|
|
79
79
|
return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
|