@catladder/pipeline 1.153.1 → 1.154.1
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.d.ts +3 -0
- package/dist/build/artifacts/createBuildJobArtifact.js +97 -0
- package/dist/build/base/createAppBuildJob.d.ts +3 -3
- package/dist/build/base/createAppBuildJob.js +9 -15
- package/dist/build/base/index.d.ts +6 -2
- package/dist/build/base/index.js +14 -5
- package/dist/build/base/writeDotEnv.js +2 -1
- package/dist/build/custom/__tests__/testJob.test.js +1 -1
- package/dist/build/custom/buildJob.js +3 -10
- package/dist/build/docker.js +3 -3
- package/dist/build/index.d.ts +13 -6
- package/dist/build/index.js +29 -7
- package/dist/build/node/buildJob.d.ts +7 -2
- package/dist/build/node/buildJob.js +40 -33
- package/dist/build/node/cache.d.ts +2 -2
- package/dist/build/node/cache.js +8 -4
- package/dist/build/node/index.d.ts +2 -2
- package/dist/build/node/meteor.js +3 -6
- package/dist/build/node/testJob.d.ts +3 -2
- package/dist/build/node/testJob.js +9 -4
- package/dist/build/node/yarn.js +1 -1
- package/dist/build/rails/build.d.ts +1 -1
- package/dist/build/rails/build.js +7 -2
- package/dist/build/rails/test.d.ts +1 -1
- package/dist/build/rails/test.js +5 -0
- package/dist/build/sbom.js +3 -2
- package/dist/build/types.d.ts +48 -4
- package/dist/build/types.js +7 -1
- package/dist/bundles/catladder-gitlab/index.js +2 -2
- package/dist/constants.js +1 -1
- package/dist/context/createAllComponentsContext.d.ts +12 -0
- package/dist/context/createAllComponentsContext.js +159 -0
- package/dist/context/createComponentContext.d.ts +1 -5
- package/dist/context/createComponentContext.js +82 -20
- package/dist/context/createWorkspaceContext.d.ts +16 -0
- package/dist/context/createWorkspaceContext.js +173 -0
- package/dist/context/getBuildInfoVariables.d.ts +1 -1
- package/dist/context/getEnvironmentContext.d.ts +1 -1
- package/dist/context/getEnvironmentVariables.d.ts +2 -2
- package/dist/context/getEnvironmentVariables.js +5 -4
- package/dist/context/getLabels.js +4 -4
- package/dist/deploy/base/deploy.d.ts +1 -1
- package/dist/deploy/base/deploy.js +18 -5
- package/dist/deploy/cloudRun/artifactsRegistry.js +2 -2
- package/dist/deploy/cloudRun/createJobs/common.d.ts +4 -4
- package/dist/deploy/cloudRun/index.d.ts +2 -2
- package/dist/deploy/custom/index.d.ts +2 -2
- package/dist/deploy/dockerTag/index.d.ts +2 -2
- package/dist/deploy/index.d.ts +7 -7
- package/dist/deploy/kubernetes/additionalSecretKeys.d.ts +3 -1
- package/dist/deploy/kubernetes/cloudSql/index.js +1 -1
- package/dist/deploy/kubernetes/deployJob.js +2 -2
- package/dist/deploy/kubernetes/index.d.ts +2 -2
- package/dist/deploy/sbom.d.ts +1 -1
- package/dist/deploy/sbom.js +4 -3
- package/dist/deploy/types/index.d.ts +3 -3
- package/dist/pipeline/createAllJobs.d.ts +12 -10
- package/dist/pipeline/createAllJobs.js +94 -51
- package/dist/pipeline/createJobsForComponent.js +2 -3
- package/dist/pipeline/createJobsForWorkspace.d.ts +3 -0
- package/dist/pipeline/createJobsForWorkspace.js +12 -0
- package/dist/pipeline/createMainPipeline.js +26 -6
- package/dist/pipeline/gitlab/createGitlabJobs.d.ts +3 -16
- package/dist/pipeline/gitlab/createGitlabJobs.js +191 -73
- package/dist/pipeline/packageManager.d.ts +3 -2
- package/dist/pipeline/packageManager.js +43 -15
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +5 -4
- package/dist/types/context.d.ts +77 -12
- package/dist/types/context.js +10 -1
- package/dist/types/environmentContext.d.ts +5 -6
- package/dist/types/jobs.d.ts +5 -0
- package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-meteor-with-worker.ts.snap +8 -0
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-no-service.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-non-public.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-post-stop-job.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-service-gen2.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-service-increase-timout.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-service-with-volumes.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-storybook.ts.snap +4 -8
- package/examples/__snapshots__/cloud-run-with-ngnix.ts.snap +4 -8
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +16 -16
- package/examples/__snapshots__/cloud-run-with-sql.ts.snap +589 -1097
- package/examples/__snapshots__/cloud-run-with-worker.ts.snap +8 -8
- package/examples/__snapshots__/custom-build-job-with-tests.ts.snap +4 -0
- package/examples/__snapshots__/custom-build-job.ts.snap +4 -0
- package/examples/__snapshots__/custom-deploy.ts.snap +8 -8
- package/examples/__snapshots__/custom-envs.ts.snap +18 -12
- package/examples/__snapshots__/custom-sbom-java.ts.snap +4 -0
- package/examples/__snapshots__/kubernetes-application-customization.ts.snap +8 -8
- package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.ts.snap +8 -8
- package/examples/__snapshots__/kubernetes-with-cloud-sql.ts.snap +8 -8
- package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +16 -16
- package/examples/__snapshots__/kubernetes-with-mongodb.ts.snap +8 -8
- package/examples/__snapshots__/local-dot-env.ts.snap +8 -8
- package/examples/__snapshots__/meteor-kubernetes.ts.snap +8 -0
- package/examples/__snapshots__/multiline-var.ts.snap +16 -16
- package/examples/__snapshots__/native-app.ts.snap +24 -16
- package/examples/__snapshots__/node-build-with-custom-image.ts.snap +8 -8
- package/examples/__snapshots__/node-build-with-docker-additions.ts.snap +8 -8
- package/examples/__snapshots__/wait-for-other-deploy.ts.snap +16 -16
- package/examples/cloud-run-with-sql.ts +9 -2
- package/package.json +1 -1
- package/src/build/artifacts/createBuildJobArtifact.ts +61 -0
- package/src/build/base/createAppBuildJob.ts +26 -22
- package/src/build/base/index.ts +31 -4
- package/src/build/base/writeDotEnv.ts +6 -2
- package/src/build/custom/__tests__/testJob.test.ts +4 -4
- package/src/build/custom/buildJob.ts +2 -13
- package/src/build/docker.ts +6 -7
- package/src/build/index.ts +39 -7
- package/src/build/node/buildJob.ts +68 -56
- package/src/build/node/cache.ts +17 -8
- package/src/build/node/index.ts +4 -2
- package/src/build/node/meteor.ts +3 -9
- package/src/build/node/testJob.ts +21 -7
- package/src/build/node/yarn.ts +2 -2
- package/src/build/rails/build.ts +14 -4
- package/src/build/rails/test.ts +9 -1
- package/src/build/sbom.ts +7 -2
- package/src/build/types.ts +68 -4
- package/src/context/createAllComponentsContext.ts +31 -0
- package/src/context/createComponentContext.ts +59 -20
- package/src/context/createWorkspaceContext.ts +56 -0
- package/src/context/getBuildInfoVariables.ts +2 -1
- package/src/context/getEnvironmentContext.ts +2 -2
- package/src/context/getEnvironmentVariables.ts +12 -6
- package/src/context/getLabels.ts +2 -2
- package/src/deploy/base/deploy.ts +33 -7
- package/src/deploy/cloudRun/artifactsRegistry.ts +2 -3
- package/src/deploy/cloudRun/createJobs/common.ts +4 -4
- package/src/deploy/cloudRun/index.ts +68 -67
- package/src/deploy/custom/index.ts +2 -2
- package/src/deploy/dockerTag/index.ts +8 -7
- package/src/deploy/index.ts +11 -9
- package/src/deploy/kubernetes/additionalSecretKeys.ts +3 -1
- package/src/deploy/kubernetes/cloudSql/index.ts +1 -1
- package/src/deploy/kubernetes/deployJob.ts +2 -2
- package/src/deploy/kubernetes/index.ts +42 -41
- package/src/deploy/sbom.ts +9 -4
- package/src/pipeline/createAllJobs.ts +56 -55
- package/src/pipeline/createChildPipeline.ts +1 -0
- package/src/pipeline/createJobsForComponent.ts +5 -4
- package/src/pipeline/createJobsForWorkspace.ts +12 -0
- package/src/pipeline/createMainPipeline.ts +38 -23
- package/src/pipeline/gitlab/createGitlabJobs.ts +283 -119
- package/src/pipeline/packageManager.ts +25 -9
- package/src/types/config.ts +4 -1
- package/src/types/context.ts +105 -11
- package/src/types/environmentContext.ts +6 -7
- package/src/types/jobs.ts +3 -1
|
@@ -71,14 +71,14 @@ var getArtifactsRegistryImageName = function (context, lecacyReviewImageName) {
|
|
|
71
71
|
throw new Error("lecacyReviewImageName is only allowed for review app");
|
|
72
72
|
}
|
|
73
73
|
var dockerUrl = (0, exports.getArtifactsRegistryDockerUrl)(context);
|
|
74
|
-
var gcloudImagePath = __spreadArray([dockerUrl, context.env, context.
|
|
74
|
+
var gcloudImagePath = __spreadArray([dockerUrl, context.env, context.name], __read(context.environment.reviewSlug && !lecacyReviewImageName ? [context.environment.reviewSlug] : []), false);
|
|
75
75
|
return (0, BashExpression_1.joinBashExpressions)(gcloudImagePath, "/");
|
|
76
76
|
};
|
|
77
77
|
exports.getArtifactsRegistryImageName = getArtifactsRegistryImageName;
|
|
78
78
|
var getArtifactsRegistryBuildCacheImage = function (context) {
|
|
79
79
|
var dockerUrl = (0, exports.getArtifactsRegistryDockerUrl)(context);
|
|
80
80
|
// does not include env, so that after merge, you might get more cache hits (review-->dev)
|
|
81
|
-
var gcloudImagePath = [dockerUrl, "caches", context.
|
|
81
|
+
var gcloudImagePath = [dockerUrl, "caches", context.name];
|
|
82
82
|
return gcloudImagePath.join("/");
|
|
83
83
|
};
|
|
84
84
|
exports.getArtifactsRegistryBuildCacheImage = getArtifactsRegistryBuildCacheImage;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "../../../types/context";
|
|
2
2
|
import type { DeployConfigCloudRun } from "../../types/googleCloudRun";
|
|
3
3
|
export declare const gcloudCmd: (version?: "beta") => string;
|
|
4
4
|
export declare const gcloudRunCmd: (version?: "beta") => string;
|
|
5
5
|
export declare const gcloudSchedulerCmd: (version?: "beta") => string;
|
|
6
6
|
export declare const setGoogleProjectNumberScript: (deployConfig: DeployConfigCloudRun) => string[];
|
|
7
7
|
export declare const makeLabelString: (obj: Record<string, unknown>) => string;
|
|
8
|
-
export declare const getCloudRunDeployConfig: (context:
|
|
9
|
-
export declare function getCommonCloudRunArgs(context:
|
|
8
|
+
export declare const getCloudRunDeployConfig: (context: ComponentContext) => DeployConfigCloudRun;
|
|
9
|
+
export declare function getCommonCloudRunArgs(context: ComponentContext): {
|
|
10
10
|
project: string;
|
|
11
11
|
region: import("../../types").Gcloudregion;
|
|
12
12
|
};
|
|
13
|
-
export declare function getCommonDeployArgs(context:
|
|
13
|
+
export declare function getCommonDeployArgs(context: ComponentContext): {
|
|
14
14
|
"set-cloudsql-instances": string | undefined;
|
|
15
15
|
project: string;
|
|
16
16
|
region: import("../../types").Gcloudregion;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DeployTypeDefinition } from "..";
|
|
1
|
+
import type { DeployConfigCloudRun, DeployTypeDefinition } from "..";
|
|
2
2
|
export declare const GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
|
|
3
3
|
export declare const GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
|
|
4
|
-
export declare const GCLOUD_RUN_DEPLOY_TYPE: DeployTypeDefinition<
|
|
4
|
+
export declare const GCLOUD_RUN_DEPLOY_TYPE: DeployTypeDefinition<DeployConfigCloudRun>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DeployTypeDefinition } from "..";
|
|
2
|
-
export declare const CUSTOM_DEPLOY_TYPE: DeployTypeDefinition<
|
|
1
|
+
import type { DeployConfigCustom, DeployTypeDefinition } from "..";
|
|
2
|
+
export declare const CUSTOM_DEPLOY_TYPE: DeployTypeDefinition<DeployConfigCustom>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DeployTypeDefinition } from "..";
|
|
2
|
-
export declare const DOCKER_TAG_DEPLOY_TYPE: DeployTypeDefinition<
|
|
1
|
+
import type { DeployConfigDockerTag, DeployTypeDefinition } from "..";
|
|
2
|
+
export declare const DOCKER_TAG_DEPLOY_TYPE: DeployTypeDefinition<DeployConfigDockerTag>;
|
package/dist/deploy/index.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type { SecretEnvVar } from "..";
|
|
1
|
+
import type { BuildConfig, SecretEnvVar } from "..";
|
|
2
2
|
import type { BashExpression } from "../bash/BashExpression";
|
|
3
3
|
import type { ComponentContext } from "../types/context";
|
|
4
4
|
import type { EnvironmentContext } from "../types/environmentContext";
|
|
5
5
|
import type { CatladderJob } from "../types/jobs";
|
|
6
6
|
import type { PartialDeep } from "../types/utils";
|
|
7
|
-
import type { DeployConfigGeneric, DeployConfigType } from "./types";
|
|
7
|
+
import type { DeployConfig, DeployConfigGeneric, DeployConfigType } from "./types";
|
|
8
8
|
export * from "./cloudRun";
|
|
9
9
|
export * from "./kubernetes";
|
|
10
10
|
export * from "./types";
|
|
11
11
|
export * from "./utils";
|
|
12
|
-
export type DeployTypeDefinition<
|
|
12
|
+
export type DeployTypeDefinition<D extends DeployConfig> = {
|
|
13
13
|
jobs: (context: ComponentContext) => CatladderJob[];
|
|
14
|
-
defaults: (envContext: EnvironmentContext<
|
|
15
|
-
additionalSecretKeys: (envContext: EnvironmentContext<
|
|
16
|
-
getAdditionalEnvVars: (envContext: EnvironmentContext<
|
|
14
|
+
defaults: (envContext: EnvironmentContext<BuildConfig, D>) => PartialDeep<D>;
|
|
15
|
+
additionalSecretKeys: (envContext: EnvironmentContext<BuildConfig, D>) => SecretEnvVar[];
|
|
16
|
+
getAdditionalEnvVars: (envContext: EnvironmentContext<BuildConfig, D>) => Record<string, string | BashExpression | undefined | null>;
|
|
17
17
|
};
|
|
18
|
-
export type DeployTypes = { [T in DeployConfigType]: DeployTypeDefinition<T
|
|
18
|
+
export type DeployTypes = { [T in DeployConfigType]: DeployTypeDefinition<DeployConfigGeneric<T>> };
|
|
19
19
|
export declare const DEPLOY_TYPES: DeployTypes;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { BuildConfig } from "../../build";
|
|
1
2
|
import type { EnvironmentContext } from "../../types/environmentContext";
|
|
3
|
+
import type { DeployConfigKubernetes } from "../types";
|
|
2
4
|
export declare const additionalKubernetesSecretKeys: ({
|
|
3
5
|
deployConfigRaw
|
|
4
|
-
}: EnvironmentContext<
|
|
6
|
+
}: EnvironmentContext<BuildConfig, DeployConfigKubernetes>) => {
|
|
5
7
|
key: string;
|
|
6
8
|
}[];
|
|
@@ -45,7 +45,7 @@ var createKubernetesCloudsqlBaseValues = function (context) {
|
|
|
45
45
|
dbUser: (_g = config.dbUser) !== null && _g !== void 0 ? _g : "postgres",
|
|
46
46
|
instanceConnectionName: config.instanceConnectionName,
|
|
47
47
|
proxyCredentials: proxyCredentials,
|
|
48
|
-
fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.
|
|
48
|
+
fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.name)
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
} else {
|
|
@@ -74,10 +74,10 @@ var createKubernetesDeployJobs = function (context) {
|
|
|
74
74
|
variables: __assign(__assign({}, context.environment.envVars), {
|
|
75
75
|
RELEASE_NAME: context.environment.fullName,
|
|
76
76
|
HELM_EXPERIMENTAL_OCI: "1",
|
|
77
|
-
KUBE_DOCKER_IMAGE_PULL_SECRET: "gitlab-registry-".concat(context.
|
|
77
|
+
KUBE_DOCKER_IMAGE_PULL_SECRET: "gitlab-registry-".concat(context.name),
|
|
78
78
|
HELM_GITLAB_CHART_NAME: (_b = deployConfig.chartName) !== null && _b !== void 0 ? _b : "/helm-charts/the-panter-chart",
|
|
79
79
|
HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_c = deployConfig.additionalHelmArgs) !== null && _c !== void 0 ? _c : []), false).join(" "),
|
|
80
|
-
COMPONENT_NAME: context.
|
|
80
|
+
COMPONENT_NAME: context.name,
|
|
81
81
|
/** @deprecated */
|
|
82
82
|
BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID
|
|
83
83
|
})
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { DeployTypeDefinition } from "..";
|
|
1
|
+
import type { DeployConfigKubernetes, DeployTypeDefinition } from "..";
|
|
2
2
|
export * from "./cloudSql";
|
|
3
|
-
export declare const KUBERNETES_DEPLOY_TYPE: DeployTypeDefinition<
|
|
3
|
+
export declare const KUBERNETES_DEPLOY_TYPE: DeployTypeDefinition<DeployConfigKubernetes>;
|
package/dist/deploy/sbom.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ComponentContext } from "../types/context";
|
|
2
2
|
export declare const sbomDeactivated: (context: ComponentContext) => boolean;
|
|
3
3
|
export declare const getDependencyTrackUploadScript: (context: ComponentContext) => string[];
|
|
4
4
|
export declare const getDependencyTrackDeleteScript: (context: ComponentContext) => string[];
|
package/dist/deploy/sbom.js
CHANGED
|
@@ -5,15 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getDependencyTrackDeleteScript = exports.getDependencyTrackUploadScript = exports.sbomDeactivated = void 0;
|
|
7
7
|
var sbom_1 = require("../build/sbom");
|
|
8
|
+
var context_1 = require("../types/context");
|
|
8
9
|
var sbomDeactivated = function (context) {
|
|
9
|
-
return context.build.config.type === "custom" && context.build.config.sbom === false;
|
|
10
|
+
return (0, context_1.componentContextIsStandaloneBuild)(context) && context.build.config.type === "custom" && context.build.config.sbom === false;
|
|
10
11
|
};
|
|
11
12
|
exports.sbomDeactivated = sbomDeactivated;
|
|
12
13
|
var getDependencyTrackUploadScript = function (context) {
|
|
13
|
-
return (0, exports.sbomDeactivated)(context) ? [] : ["echo 'Uploading SBOM to Dependency Track'", "/dtrackuploader https://dep.panter.swiss/ \"$DT_KEY_PROD\" upload \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.
|
|
14
|
+
return (0, exports.sbomDeactivated)(context) ? [] : ["echo 'Uploading SBOM to Dependency Track'", "/dtrackuploader https://dep.panter.swiss/ \"$DT_KEY_PROD\" upload \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.name, "\" \"").concat(context.environment.url, "\" \"").concat(sbom_1.SBOM_FILE, "\" vex.json || true")];
|
|
14
15
|
};
|
|
15
16
|
exports.getDependencyTrackUploadScript = getDependencyTrackUploadScript;
|
|
16
17
|
var getDependencyTrackDeleteScript = function (context) {
|
|
17
|
-
return (0, exports.sbomDeactivated)(context) ? [] : ["echo 'Disabling component in Dependency Track'", "/dtrackuploader https://dep.panter.swiss/ \"$DT_KEY_PROD\" disable \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.
|
|
18
|
+
return (0, exports.sbomDeactivated)(context) ? [] : ["echo 'Disabling component in Dependency Track'", "/dtrackuploader https://dep.panter.swiss/ \"$DT_KEY_PROD\" disable \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.name, "\" \"").concat(context.environment.url, "\" || true")];
|
|
18
19
|
};
|
|
19
20
|
exports.getDependencyTrackDeleteScript = getDependencyTrackDeleteScript;
|
|
@@ -11,12 +11,12 @@ export type DeployConfigType = DeployConfig["type"];
|
|
|
11
11
|
export type DeployConfigGeneric<T extends DeployConfigType> = Extract<DeployConfig, {
|
|
12
12
|
type: T;
|
|
13
13
|
}>;
|
|
14
|
-
export declare const isOfDeployType: <T extends ("
|
|
14
|
+
export declare const isOfDeployType: <T extends ("custom" | "dockerTag" | "google-cloudrun" | "kubernetes")[]>(t: DeployConfig | false | null | undefined, ...types: T) => t is Extract<DeployConfigCustom, {
|
|
15
15
|
type: T[number];
|
|
16
|
-
}> | Extract<
|
|
16
|
+
}> | Extract<DeployConfigDockerTag, {
|
|
17
17
|
type: T[number];
|
|
18
18
|
}> | Extract<DeployConfigCloudRun, {
|
|
19
19
|
type: T[number];
|
|
20
|
-
}> | Extract<
|
|
20
|
+
}> | Extract<DeployConfigKubernetes, {
|
|
21
21
|
type: T[number];
|
|
22
22
|
}>;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CreateAllComponentsContextProps } from "../context/createAllComponentsContext";
|
|
2
|
+
import type { ComponentContext, WorkspaceContext } from "../types";
|
|
2
3
|
import type { CatladderJob } from "../types/jobs";
|
|
3
|
-
export type AllCatladderJobs =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
export type AllCatladderJobs = {
|
|
5
|
+
workspaces: Array<{
|
|
6
|
+
context: WorkspaceContext;
|
|
7
|
+
jobs: Array<CatladderJob>;
|
|
8
|
+
}>;
|
|
9
|
+
components: Array<{
|
|
10
|
+
context: ComponentContext;
|
|
11
|
+
jobs: Array<CatladderJob>;
|
|
12
|
+
}>;
|
|
11
13
|
};
|
|
12
14
|
export declare const createAllJobs: ({
|
|
13
15
|
config,
|
|
14
16
|
trigger,
|
|
15
17
|
pipelineType
|
|
16
|
-
}:
|
|
18
|
+
}: CreateAllComponentsContextProps) => Promise<AllCatladderJobs>;
|
|
@@ -115,77 +115,120 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
|
+
var __read = this && this.__read || function (o, n) {
|
|
119
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
120
|
+
if (!m) return o;
|
|
121
|
+
var i = m.call(o),
|
|
122
|
+
r,
|
|
123
|
+
ar = [],
|
|
124
|
+
e;
|
|
125
|
+
try {
|
|
126
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
127
|
+
} catch (error) {
|
|
128
|
+
e = {
|
|
129
|
+
error: error
|
|
130
|
+
};
|
|
131
|
+
} finally {
|
|
132
|
+
try {
|
|
133
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
134
|
+
} finally {
|
|
135
|
+
if (e) throw e.error;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return ar;
|
|
139
|
+
};
|
|
140
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
141
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
142
|
+
if (ar || !(i in from)) {
|
|
143
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
144
|
+
ar[i] = from[i];
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
148
|
+
};
|
|
118
149
|
Object.defineProperty(exports, "__esModule", {
|
|
119
150
|
value: true
|
|
120
151
|
});
|
|
121
152
|
exports.createAllJobs = void 0;
|
|
122
|
-
var
|
|
123
|
-
var
|
|
153
|
+
var createAllComponentsContext_1 = require("../context/createAllComponentsContext");
|
|
154
|
+
var createWorkspaceContext_1 = require("../context/createWorkspaceContext");
|
|
155
|
+
var types_1 = require("../types");
|
|
124
156
|
var createJobsForComponent_1 = require("./createJobsForComponent");
|
|
125
|
-
var
|
|
126
|
-
return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
127
|
-
var config = _b.config,
|
|
128
|
-
trigger = _b.trigger,
|
|
129
|
-
pipelineType = _b.pipelineType;
|
|
130
|
-
return __generator(this, function (_c) {
|
|
131
|
-
switch (_c.label) {
|
|
132
|
-
case 0:
|
|
133
|
-
return [4 /*yield*/, Promise.all(Object.keys(config.components).flatMap(function (componentName) {
|
|
134
|
-
var envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
|
|
135
|
-
return envs.map(function (env) {
|
|
136
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
137
|
-
var context;
|
|
138
|
-
return __generator(this, function (_a) {
|
|
139
|
-
switch (_a.label) {
|
|
140
|
-
case 0:
|
|
141
|
-
return [4 /*yield*/, (0, context_1.createComponentContext)({
|
|
142
|
-
config: config,
|
|
143
|
-
componentName: componentName,
|
|
144
|
-
env: env,
|
|
145
|
-
trigger: trigger,
|
|
146
|
-
pipelineType: pipelineType
|
|
147
|
-
})];
|
|
148
|
-
case 1:
|
|
149
|
-
context = _a.sent();
|
|
150
|
-
return [2 /*return*/, {
|
|
151
|
-
env: env,
|
|
152
|
-
componentName: componentName,
|
|
153
|
-
context: context
|
|
154
|
-
}];
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
}))];
|
|
160
|
-
case 1:
|
|
161
|
-
return [2 /*return*/, _c.sent()];
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
};
|
|
157
|
+
var createJobsForWorkspace_1 = require("./createJobsForWorkspace");
|
|
166
158
|
var createAllJobs = function (_a) {
|
|
167
159
|
return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
168
|
-
var
|
|
160
|
+
var allComponentsContext;
|
|
161
|
+
var _c;
|
|
162
|
+
var _d;
|
|
169
163
|
var config = _b.config,
|
|
170
164
|
trigger = _b.trigger,
|
|
171
165
|
pipelineType = _b.pipelineType;
|
|
172
|
-
return __generator(this, function (
|
|
173
|
-
switch (
|
|
166
|
+
return __generator(this, function (_e) {
|
|
167
|
+
switch (_e.label) {
|
|
174
168
|
case 0:
|
|
175
|
-
return [4 /*yield*/,
|
|
169
|
+
return [4 /*yield*/, (0, createAllComponentsContext_1.createAllComponentsContext)({
|
|
176
170
|
config: config,
|
|
177
171
|
trigger: trigger,
|
|
178
172
|
pipelineType: pipelineType
|
|
179
173
|
})];
|
|
180
174
|
case 1:
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
175
|
+
allComponentsContext = _e.sent();
|
|
176
|
+
_c = {};
|
|
177
|
+
return [4 /*yield*/, Promise.all(Object.keys((_d = config.builds) !== null && _d !== void 0 ? _d : {}).map(function (workspaceName) {
|
|
178
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
179
|
+
var componentsInAllEnvs, allEnvs;
|
|
180
|
+
return __generator(this, function (_a) {
|
|
181
|
+
switch (_a.label) {
|
|
182
|
+
case 0:
|
|
183
|
+
componentsInAllEnvs = allComponentsContext.filter(function (context) {
|
|
184
|
+
return (0, types_1.componentContextHasWorkspaceBuild)(context) && context.build.workspaceName === workspaceName;
|
|
185
|
+
});
|
|
186
|
+
allEnvs = __spreadArray([], __read(new Set(componentsInAllEnvs.map(function (_a) {
|
|
187
|
+
var env = _a.env;
|
|
188
|
+
return env;
|
|
189
|
+
}))), false);
|
|
190
|
+
return [4 /*yield*/, Promise.all(allEnvs.map(function (env) {
|
|
191
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
192
|
+
var workspaceContext;
|
|
193
|
+
return __generator(this, function (_a) {
|
|
194
|
+
switch (_a.label) {
|
|
195
|
+
case 0:
|
|
196
|
+
return [4 /*yield*/, (0, createWorkspaceContext_1.createWorkspaceContext)({
|
|
197
|
+
components: componentsInAllEnvs.filter(function (_a) {
|
|
198
|
+
var componentEnv = _a.env;
|
|
199
|
+
return componentEnv === env;
|
|
200
|
+
}),
|
|
201
|
+
workspaceName: workspaceName,
|
|
202
|
+
config: config,
|
|
203
|
+
trigger: trigger,
|
|
204
|
+
pipelineType: pipelineType,
|
|
205
|
+
env: env
|
|
206
|
+
})];
|
|
207
|
+
case 1:
|
|
208
|
+
workspaceContext = _a.sent();
|
|
209
|
+
return [2 /*return*/, {
|
|
210
|
+
context: workspaceContext,
|
|
211
|
+
jobs: (0, createJobsForWorkspace_1.createJobsForWorkspace)(workspaceContext)
|
|
212
|
+
}];
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
}))];
|
|
217
|
+
case 1:
|
|
218
|
+
return [2 /*return*/, _a.sent()];
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
})).then(function (f) {
|
|
223
|
+
return f.flat();
|
|
224
|
+
})];
|
|
225
|
+
case 2:
|
|
226
|
+
return [2 /*return*/, (_c.workspaces = _e.sent(), _c.components = allComponentsContext.map(function (context) {
|
|
184
227
|
return {
|
|
185
228
|
context: context,
|
|
186
229
|
jobs: (0, createJobsForComponent_1.createJobsForComponentContext)(context)
|
|
187
230
|
};
|
|
188
|
-
})];
|
|
231
|
+
}), _c)];
|
|
189
232
|
}
|
|
190
233
|
});
|
|
191
234
|
});
|
|
@@ -73,9 +73,8 @@ var getCustomJobs = function (context) {
|
|
|
73
73
|
return injectDefaultVarsInCustomJobs(context, rawJobs);
|
|
74
74
|
};
|
|
75
75
|
var createJobsForComponentContext = function (context) {
|
|
76
|
-
var
|
|
77
|
-
var
|
|
78
|
-
var deployJobs = ((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config) ? deploy_1.DEPLOY_TYPES[(_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.type].jobs(context) : [];
|
|
76
|
+
var buildJobs = build_1.BUILD_TYPES[context.build.buildType].jobs(context);
|
|
77
|
+
var deployJobs = context.componentConfig.deploy !== false ? deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context) : [];
|
|
79
78
|
var customJobs = getCustomJobs(context);
|
|
80
79
|
return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
|
|
81
80
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createJobsForWorkspace = void 0;
|
|
7
|
+
var build_1 = require("../build");
|
|
8
|
+
var createJobsForWorkspace = function (context) {
|
|
9
|
+
var buildJobs = build_1.WORKSPACE_BUILD_TYPES[context.build.buildType].jobs(context);
|
|
10
|
+
return buildJobs;
|
|
11
|
+
};
|
|
12
|
+
exports.createJobsForWorkspace = createJobsForWorkspace;
|
|
@@ -169,7 +169,7 @@ var createGitlabPipeline_1 = require("./gitlab/createGitlabPipeline");
|
|
|
169
169
|
var gitlabReleaseJobs_1 = require("./gitlab/gitlabReleaseJobs");
|
|
170
170
|
var createMainPipeline = function (pipelineType, config) {
|
|
171
171
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
172
|
-
var stages, allJobsPerTrigger, allJobs;
|
|
172
|
+
var stages, allJobsPerTrigger, allWorkspaceJobs, allComponentJobs, allJobs;
|
|
173
173
|
return __generator(this, function (_a) {
|
|
174
174
|
switch (_a.label) {
|
|
175
175
|
case 0:
|
|
@@ -194,22 +194,42 @@ var createMainPipeline = function (pipelineType, config) {
|
|
|
194
194
|
}
|
|
195
195
|
});
|
|
196
196
|
});
|
|
197
|
-
}))
|
|
197
|
+
})).then(function (j) {
|
|
198
|
+
return j.flat();
|
|
199
|
+
})];
|
|
198
200
|
case 1:
|
|
199
201
|
allJobsPerTrigger = _a.sent();
|
|
200
|
-
|
|
202
|
+
allWorkspaceJobs = allJobsPerTrigger.filter(function (j) {
|
|
203
|
+
return j.context.type === "workspace";
|
|
204
|
+
}) // sort by componentName in the same order as they appear in the config
|
|
205
|
+
// this is purely for better readability in git diffs when you add new components
|
|
206
|
+
.sort(function (a, b) {
|
|
207
|
+
var _a;
|
|
208
|
+
var workspaceNames = Object.keys((_a = config.builds) !== null && _a !== void 0 ? _a : {});
|
|
209
|
+
var aIndex = workspaceNames.findIndex(function (c) {
|
|
210
|
+
return c === a.context.name;
|
|
211
|
+
});
|
|
212
|
+
var bIndex = workspaceNames.findIndex(function (c) {
|
|
213
|
+
return c === b.context.name;
|
|
214
|
+
});
|
|
215
|
+
return aIndex - bIndex;
|
|
216
|
+
});
|
|
217
|
+
allComponentJobs = allJobsPerTrigger.filter(function (j) {
|
|
218
|
+
return j.context.type === "component";
|
|
219
|
+
})
|
|
201
220
|
// sort by componentName in the same order as they appear in the config
|
|
202
221
|
// this is purely for better readability in git diffs when you add new components
|
|
203
222
|
.sort(function (a, b) {
|
|
204
223
|
var componentNames = Object.keys(config.components);
|
|
205
224
|
var aIndex = componentNames.findIndex(function (c) {
|
|
206
|
-
return c === a.context.
|
|
225
|
+
return c === a.context.name;
|
|
207
226
|
});
|
|
208
227
|
var bIndex = componentNames.findIndex(function (c) {
|
|
209
|
-
return c === b.context.
|
|
228
|
+
return c === b.context.name;
|
|
210
229
|
});
|
|
211
230
|
return aIndex - bIndex;
|
|
212
|
-
})
|
|
231
|
+
});
|
|
232
|
+
allJobs = __spreadArray(__spreadArray([], __read(allWorkspaceJobs), false), __read(allComponentJobs), false).reduce(function (acc, _a) {
|
|
213
233
|
var _b, _c;
|
|
214
234
|
var gitlabJob = _a.gitlabJob,
|
|
215
235
|
name = _a.name;
|
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Context, GitlabJobDef, GitlabRule } from "../../types";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
3
|
import type { AllCatladderJobs } from "../createAllJobs";
|
|
4
4
|
export type AllGitlabJobs = {
|
|
5
5
|
name: string;
|
|
6
6
|
gitlabJob: GitlabJobDef;
|
|
7
|
-
context:
|
|
7
|
+
context: Context;
|
|
8
8
|
}[];
|
|
9
9
|
export declare const GITLAB_ENVIRONMENT_URL_VARIABLE = "CL_GITLAB_ENVIRONMENT_URL";
|
|
10
|
-
export declare const makeGitlabJob: (context:
|
|
11
|
-
environment,
|
|
12
|
-
envMode,
|
|
13
|
-
needsStages,
|
|
14
|
-
needsOtherComponent,
|
|
15
|
-
name,
|
|
16
|
-
needs,
|
|
17
|
-
jobTags,
|
|
18
|
-
script,
|
|
19
|
-
variables,
|
|
20
|
-
runnerVariables,
|
|
21
|
-
when,
|
|
22
|
-
...job
|
|
23
|
-
}: CatladderJob<string>, allJobs: AllCatladderJobs, baseRules?: GitlabRule[]) => [fullName: string, job: GitlabJobDef];
|
|
10
|
+
export declare const makeGitlabJob: (context: Context, job: CatladderJob<string>, allJobs: AllCatladderJobs, baseRules?: GitlabRule[]) => [fullName: string, job: GitlabJobDef];
|
|
24
11
|
export declare const createGitlabJobs: (allJobs: AllCatladderJobs, baseRules?: GitlabRule[]) => Promise<AllGitlabJobs>;
|