@catladder/pipeline 0.0.0-main-414c8270 → 0.0.0-main-0acdca98
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/base/createBuildJob.js +1 -1
- package/dist/build/custom/testJob.js +2 -2
- package/dist/build/node/testJob.js +2 -2
- package/dist/build/rails/build.js +11 -1
- package/dist/build/rails/test.js +1 -1
- package/dist/build/types.d.ts +8 -1
- package/dist/bundles/catladder-gitlab/index.js +292 -54
- package/dist/constants.js +1 -1
- package/dist/context/getEnvironment.js +18 -12
- package/dist/context/getEnvironmentVariables.d.ts +2 -7
- package/dist/context/getEnvironmentVariables.js +27 -31
- package/dist/context/transformJobOnlyVars.d.ts +10 -0
- package/dist/context/transformJobOnlyVars.js +160 -0
- package/dist/context/utils/envVars.d.ts +8 -0
- package/dist/context/utils/envVars.js +52 -0
- package/dist/deploy/base.js +3 -3
- package/dist/deploy/types/base.d.ts +8 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/context.d.ts +16 -6
- package/examples/__snapshots__/custom-deploy.ts.snap +8 -0
- package/examples/custom-deploy.ts +3 -0
- package/package.json +1 -1
- package/src/build/base/createBuildJob.ts +1 -0
- package/src/build/custom/testJob.ts +1 -0
- package/src/build/node/testJob.ts +1 -0
- package/src/build/rails/build.ts +4 -1
- package/src/build/rails/test.ts +4 -1
- package/src/build/types.ts +9 -1
- package/src/context/getEnvironment.ts +9 -7
- package/src/context/getEnvironmentVariables.ts +36 -24
- package/src/context/transformJobOnlyVars.ts +42 -0
- package/src/context/utils/envVars.ts +26 -0
- package/src/deploy/base.ts +3 -0
- package/src/deploy/types/base.ts +10 -0
- package/src/types/context.ts +18 -6
|
@@ -70,7 +70,7 @@ var createBuildJob = function (context, _a) {
|
|
|
70
70
|
image: (0, __1.getRunnerImage)("jobs-default"),
|
|
71
71
|
needs: [],
|
|
72
72
|
cache: [],
|
|
73
|
-
variables: __assign(__assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), (_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
73
|
+
variables: __assign(__assign(__assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), (_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
74
74
|
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.componentConfig.dir)], false), __read((_c = (0, utils_1.ensureArray)(script)) !== null && _c !== void 0 ? _c : []), false),
|
|
75
75
|
artifacts: {
|
|
76
76
|
paths: [(0, path_1.join)(context.componentConfig.dir, "__build_info.json")],
|
|
@@ -63,9 +63,9 @@ var createCustomTestJobs = function (context) {
|
|
|
63
63
|
throw new Error("deploy config is not custom");
|
|
64
64
|
}
|
|
65
65
|
var base = {
|
|
66
|
-
variables: __assign(__assign({
|
|
66
|
+
variables: __assign(__assign(__assign({
|
|
67
67
|
APP_PATH: context.componentConfig.dir
|
|
68
|
-
}, RUNNER_CUSTOM_TEST_VARIABLES), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
68
|
+
}, RUNNER_CUSTOM_TEST_VARIABLES), context.environment.jobOnlyVars.build.envVars), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
69
69
|
services: buildConfig.jobServices,
|
|
70
70
|
cache: buildConfig.jobCache,
|
|
71
71
|
stage: "test",
|
|
@@ -56,9 +56,9 @@ var createNodeTestJobs = function (context) {
|
|
|
56
56
|
}
|
|
57
57
|
var buildConfig = context.componentConfig.build;
|
|
58
58
|
var base = {
|
|
59
|
-
variables: __assign(__assign({
|
|
59
|
+
variables: __assign(__assign(__assign({
|
|
60
60
|
APP_PATH: context.componentConfig.dir
|
|
61
|
-
}, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
61
|
+
}, constants_1.NODE_RUNNER_BUILD_VARIABLES), context.environment.jobOnlyVars.build.envVars), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
62
62
|
stage: "test",
|
|
63
63
|
needs: [],
|
|
64
64
|
envMode: "none"
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __assign = this && this.__assign || function () {
|
|
4
|
+
__assign = Object.assign || function (t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
3
13
|
var __read = this && this.__read || function (o, n) {
|
|
4
14
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
5
15
|
if (!m) return o;
|
|
@@ -41,7 +51,7 @@ var createRailsBuildJobs = function (context) {
|
|
|
41
51
|
return "--env '".concat(k).concat(v ? "=".concat(v) : "", "'");
|
|
42
52
|
}).join(" ");
|
|
43
53
|
return [(0, docker_1.createDockerBuildJobBase)(context, {
|
|
44
|
-
variables: context.componentConfig.build.extraVars,
|
|
54
|
+
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.componentConfig.build.extraVars),
|
|
45
55
|
// custom script
|
|
46
56
|
script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"), "chmod +x /usr/local/bin/pack",
|
|
47
57
|
// replace private git ssh gem sources with https to make bundler with credentials via env var work
|
package/dist/build/rails/test.js
CHANGED
|
@@ -52,7 +52,7 @@ var createRailsTestJobs = function (context) {
|
|
|
52
52
|
}
|
|
53
53
|
var buildConfig = context.componentConfig.build;
|
|
54
54
|
var base = {
|
|
55
|
-
variables: (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {},
|
|
55
|
+
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
56
56
|
stage: "test",
|
|
57
57
|
needs: [],
|
|
58
58
|
envMode: "none"
|
package/dist/build/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GitlabJobImage, GitlabJobService } from "../types";
|
|
1
|
+
import type { EnvVars, GitlabJobImage, GitlabJobService } from "../types";
|
|
2
2
|
import type { CatladderJob } from "../types/jobs";
|
|
3
3
|
export declare type BuildConfigArtifactsReports = {
|
|
4
4
|
/**
|
|
@@ -14,8 +14,15 @@ export declare type BuildConfigBase = {
|
|
|
14
14
|
* command to run on the image to start the app (e.g. yarn start)
|
|
15
15
|
*/
|
|
16
16
|
startCommand?: string;
|
|
17
|
+
/**
|
|
18
|
+
* vars that only exist in the build jobs.
|
|
19
|
+
* Can curently not reference other variables from other components
|
|
20
|
+
*/
|
|
21
|
+
jobVars?: EnvVars;
|
|
17
22
|
/**
|
|
18
23
|
* additional env vars for the buid jobs
|
|
24
|
+
*
|
|
25
|
+
* @deprecated use jobVars
|
|
19
26
|
*/
|
|
20
27
|
extraVars?: Record<string, string>;
|
|
21
28
|
/**
|
|
@@ -26969,7 +26969,7 @@ var createBuildJob = function (context, _a) {
|
|
|
26969
26969
|
image: (0, __1.getRunnerImage)("jobs-default"),
|
|
26970
26970
|
needs: [],
|
|
26971
26971
|
cache: [],
|
|
26972
|
-
variables: __assign(__assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), (_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
26972
|
+
variables: __assign(__assign(__assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), (_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
26973
26973
|
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.componentConfig.dir)], false), __read((_c = (0, utils_1.ensureArray)(script)) !== null && _c !== void 0 ? _c : []), false),
|
|
26974
26974
|
artifacts: {
|
|
26975
26975
|
paths: [(0, path_1.join)(context.componentConfig.dir, "__build_info.json")],
|
|
@@ -27208,9 +27208,9 @@ var createCustomTestJobs = function (context) {
|
|
|
27208
27208
|
throw new Error("deploy config is not custom");
|
|
27209
27209
|
}
|
|
27210
27210
|
var base = {
|
|
27211
|
-
variables: __assign(__assign({
|
|
27211
|
+
variables: __assign(__assign(__assign({
|
|
27212
27212
|
APP_PATH: context.componentConfig.dir
|
|
27213
|
-
}, RUNNER_CUSTOM_TEST_VARIABLES), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
27213
|
+
}, RUNNER_CUSTOM_TEST_VARIABLES), context.environment.jobOnlyVars.build.envVars), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
27214
27214
|
services: buildConfig.jobServices,
|
|
27215
27215
|
cache: buildConfig.jobCache,
|
|
27216
27216
|
stage: "test",
|
|
@@ -27901,9 +27901,9 @@ var createNodeTestJobs = function (context) {
|
|
|
27901
27901
|
}
|
|
27902
27902
|
var buildConfig = context.componentConfig.build;
|
|
27903
27903
|
var base = {
|
|
27904
|
-
variables: __assign(__assign({
|
|
27904
|
+
variables: __assign(__assign(__assign({
|
|
27905
27905
|
APP_PATH: context.componentConfig.dir
|
|
27906
|
-
}, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
27906
|
+
}, constants_1.NODE_RUNNER_BUILD_VARIABLES), context.environment.jobOnlyVars.build.envVars), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
27907
27907
|
stage: "test",
|
|
27908
27908
|
needs: [],
|
|
27909
27909
|
envMode: "none"
|
|
@@ -28020,6 +28020,16 @@ exports.getDockerAppCopyAndBuildScript = getDockerAppCopyAndBuildScript;
|
|
|
28020
28020
|
"use strict";
|
|
28021
28021
|
|
|
28022
28022
|
|
|
28023
|
+
var __assign = this && this.__assign || function () {
|
|
28024
|
+
__assign = Object.assign || function (t) {
|
|
28025
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
28026
|
+
s = arguments[i];
|
|
28027
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
28028
|
+
}
|
|
28029
|
+
return t;
|
|
28030
|
+
};
|
|
28031
|
+
return __assign.apply(this, arguments);
|
|
28032
|
+
};
|
|
28023
28033
|
var __read = this && this.__read || function (o, n) {
|
|
28024
28034
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
28025
28035
|
if (!m) return o;
|
|
@@ -28061,7 +28071,7 @@ var createRailsBuildJobs = function (context) {
|
|
|
28061
28071
|
return "--env '".concat(k).concat(v ? "=".concat(v) : "", "'");
|
|
28062
28072
|
}).join(" ");
|
|
28063
28073
|
return [(0, docker_1.createDockerBuildJobBase)(context, {
|
|
28064
|
-
variables: context.componentConfig.build.extraVars,
|
|
28074
|
+
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.componentConfig.build.extraVars),
|
|
28065
28075
|
// custom script
|
|
28066
28076
|
script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"), "chmod +x /usr/local/bin/pack",
|
|
28067
28077
|
// replace private git ssh gem sources with https to make bundler with credentials via env var work
|
|
@@ -28178,7 +28188,7 @@ var createRailsTestJobs = function (context) {
|
|
|
28178
28188
|
}
|
|
28179
28189
|
var buildConfig = context.componentConfig.build;
|
|
28180
28190
|
var base = {
|
|
28181
|
-
variables: (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {},
|
|
28191
|
+
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
28182
28192
|
stage: "test",
|
|
28183
28193
|
needs: [],
|
|
28184
28194
|
envMode: "none"
|
|
@@ -28476,7 +28486,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
28476
28486
|
|
|
28477
28487
|
exports.__esModule = true;
|
|
28478
28488
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
28479
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
28489
|
+
exports.PIPELINE_IMAGE_TAG = "main-0acdca98" || 0;
|
|
28480
28490
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
28481
28491
|
|
|
28482
28492
|
/***/ }),
|
|
@@ -28532,6 +28542,16 @@ exports.getEnvType = getEnvType;
|
|
|
28532
28542
|
"use strict";
|
|
28533
28543
|
|
|
28534
28544
|
|
|
28545
|
+
var __assign = this && this.__assign || function () {
|
|
28546
|
+
__assign = Object.assign || function (t) {
|
|
28547
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
28548
|
+
s = arguments[i];
|
|
28549
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
28550
|
+
}
|
|
28551
|
+
return t;
|
|
28552
|
+
};
|
|
28553
|
+
return __assign.apply(this, arguments);
|
|
28554
|
+
};
|
|
28535
28555
|
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
28536
28556
|
function adopt(value) {
|
|
28537
28557
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -28653,30 +28673,26 @@ var getEnvironmentContext_1 = __nccwpck_require__(3817);
|
|
|
28653
28673
|
var getEnvironmentVariables_1 = __nccwpck_require__(2292);
|
|
28654
28674
|
var getEnvironment = function (config, componentName, env, commitInfo) {
|
|
28655
28675
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
28656
|
-
var
|
|
28657
|
-
return __generator(this, function (
|
|
28658
|
-
switch (
|
|
28676
|
+
var variables, envContext, envType;
|
|
28677
|
+
return __generator(this, function (_a) {
|
|
28678
|
+
switch (_a.label) {
|
|
28659
28679
|
case 0:
|
|
28660
28680
|
return [4 /*yield*/, (0, getEnvironmentVariables_1.getEnvironmentVariables)(config, componentName, env, commitInfo)];
|
|
28661
28681
|
case 1:
|
|
28662
|
-
|
|
28682
|
+
variables = _a.sent();
|
|
28663
28683
|
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
|
|
28664
28684
|
envType = envContext.envType;
|
|
28665
|
-
return [2 /*return*/, {
|
|
28685
|
+
return [2 /*return*/, __assign({
|
|
28666
28686
|
envType: envType,
|
|
28667
|
-
host: host,
|
|
28668
|
-
url: url,
|
|
28669
28687
|
gitlabEnvironment: {
|
|
28670
28688
|
name: envContext.gitlabEnvironmentName,
|
|
28671
|
-
url: url
|
|
28689
|
+
url: variables.url
|
|
28672
28690
|
},
|
|
28673
28691
|
fullName: envContext.fullName,
|
|
28674
28692
|
slugPrefix: envContext.environmentSlugPrefix,
|
|
28675
28693
|
slug: envContext.environmentSlug,
|
|
28676
|
-
shortName: env
|
|
28677
|
-
|
|
28678
|
-
secretEnvVarKeys: secretEnvVarKeys
|
|
28679
|
-
}];
|
|
28694
|
+
shortName: env
|
|
28695
|
+
}, variables)];
|
|
28680
28696
|
}
|
|
28681
28697
|
});
|
|
28682
28698
|
});
|
|
@@ -28893,19 +28909,22 @@ var lodash_1 = __nccwpck_require__(3255);
|
|
|
28893
28909
|
var deploy_1 = __nccwpck_require__(1264);
|
|
28894
28910
|
var getEnvironmentContext_1 = __nccwpck_require__(3817);
|
|
28895
28911
|
var resolveReferences_1 = __nccwpck_require__(540);
|
|
28912
|
+
var envVars_1 = __nccwpck_require__(4590);
|
|
28913
|
+
var transformJobOnlyVars_1 = __nccwpck_require__(8231);
|
|
28896
28914
|
var getEnvironmentVariables = function (config, componentName, env, commitInfo, alreadyVisited // to prevent endless loop
|
|
28897
28915
|
) {
|
|
28898
28916
|
if (alreadyVisited === void 0) {
|
|
28899
28917
|
alreadyVisited = {};
|
|
28900
28918
|
}
|
|
28901
28919
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
28902
|
-
var environmentContext, envConfigRaw, deployConfigRaw, envType, basePredefinedVariables, predefinedVariables, host, url, devLocalConfig, port, additionalEnvVars, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents,
|
|
28903
|
-
var _a, _b
|
|
28904
|
-
|
|
28905
|
-
|
|
28920
|
+
var environmentContext, envConfigRaw, deployConfigRaw, buildConfigRaw, envType, basePredefinedVariables, predefinedVariables, host, url, devLocalConfig, port, additionalEnvVars, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegacyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
|
|
28921
|
+
var _a, _b;
|
|
28922
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
28923
|
+
return __generator(this, function (_m) {
|
|
28924
|
+
switch (_m.label) {
|
|
28906
28925
|
case 0:
|
|
28907
28926
|
environmentContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
|
|
28908
|
-
envConfigRaw = environmentContext.envConfigRaw, deployConfigRaw = environmentContext.deployConfigRaw, envType = environmentContext.envType;
|
|
28927
|
+
envConfigRaw = environmentContext.envConfigRaw, deployConfigRaw = environmentContext.deployConfigRaw, buildConfigRaw = environmentContext.buildConfigRaw, envType = environmentContext.envType;
|
|
28909
28928
|
basePredefinedVariables = {
|
|
28910
28929
|
ENV_SHORT: env,
|
|
28911
28930
|
APP_DIR: envConfigRaw.dir,
|
|
@@ -28916,7 +28935,7 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
|
|
|
28916
28935
|
};
|
|
28917
28936
|
if (envType === "local") {
|
|
28918
28937
|
devLocalConfig = envConfigRaw;
|
|
28919
|
-
port = (
|
|
28938
|
+
port = (_c = devLocalConfig.port) !== null && _c !== void 0 ? _c : 3000;
|
|
28920
28939
|
host = "localhost:" + port;
|
|
28921
28940
|
url = "http://" + host;
|
|
28922
28941
|
predefinedVariables = {
|
|
@@ -28926,7 +28945,7 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
|
|
|
28926
28945
|
};
|
|
28927
28946
|
} else {
|
|
28928
28947
|
additionalEnvVars = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].getAdditionalEnvVars(environmentContext) : {};
|
|
28929
|
-
host = (
|
|
28948
|
+
host = (_e = (_d = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _d !== void 0 ? _d : additionalEnvVars.HOST_CANONICAL) !== null && _e !== void 0 ? _e : "unknown-host.example.com";
|
|
28930
28949
|
url = "https://".concat(host);
|
|
28931
28950
|
predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), config.components[componentName].build.type === "rails" ? {} : {
|
|
28932
28951
|
HOST: host
|
|
@@ -28934,25 +28953,13 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
|
|
|
28934
28953
|
ROOT_URL: url
|
|
28935
28954
|
}), additionalEnvVars);
|
|
28936
28955
|
}
|
|
28937
|
-
publicEnvVarsRaw = (
|
|
28956
|
+
publicEnvVarsRaw = (_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.public) !== null && _g !== void 0 ? _g : {};
|
|
28938
28957
|
additionalSecretKeys = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].additionalSecretKeys(environmentContext) : [];
|
|
28939
|
-
secretEnvVarKeys = __spreadArray(__spreadArray([], __read(((
|
|
28940
|
-
|
|
28941
|
-
|
|
28942
|
-
|
|
28943
|
-
|
|
28944
|
-
secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (_a) {
|
|
28945
|
-
var key = _a.key;
|
|
28946
|
-
return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
|
|
28947
|
-
}));
|
|
28948
|
-
legacyFromComponents = (_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.fromComponents) !== null && _j !== void 0 ? _j : {};
|
|
28949
|
-
publicEnvVarsRawWithLegasyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
|
|
28950
|
-
publicEnvVarsRawSanitized = Object.fromEntries(Object.entries(publicEnvVarsRawWithLegasyFromComponents).map(function (_a) {
|
|
28951
|
-
var _b = __read(_a, 2),
|
|
28952
|
-
key = _b[0],
|
|
28953
|
-
value = _b[1];
|
|
28954
|
-
return [key, (0, lodash_1.isObject)(value) ? JSON.stringify(value) : "".concat(value)];
|
|
28955
|
-
}));
|
|
28958
|
+
secretEnvVarKeys = __spreadArray(__spreadArray([], __read((0, envVars_1.stringListToSecreteEnvVarList)((_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.secret) !== null && _j !== void 0 ? _j : [])), false), __read(additionalSecretKeys), false);
|
|
28959
|
+
secretEnvVars = (0, envVars_1.makeSecretEnvVarMapping)(env, componentName, secretEnvVarKeys);
|
|
28960
|
+
legacyFromComponents = (_l = (_k = envConfigRaw.vars) === null || _k === void 0 ? void 0 : _k.fromComponents) !== null && _l !== void 0 ? _l : {};
|
|
28961
|
+
publicEnvVarsRawWithLegacyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
|
|
28962
|
+
publicEnvVarsRawSanitized = (0, envVars_1.stringifyValues)(publicEnvVarsRawWithLegacyFromComponents);
|
|
28956
28963
|
envVarsRaw = addIndexVar(__assign(__assign(__assign({}, predefinedVariables), secretEnvVars), publicEnvVarsRawSanitized));
|
|
28957
28964
|
return [4 /*yield*/, (0, resolveReferences_1.resolveReferences)(envVarsRaw, function (otherComponentName, alreadyVisited) {
|
|
28958
28965
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -28969,13 +28976,18 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
|
|
|
28969
28976
|
});
|
|
28970
28977
|
}, alreadyVisited)];
|
|
28971
28978
|
case 1:
|
|
28972
|
-
envVars =
|
|
28973
|
-
|
|
28979
|
+
envVars = _m.sent();
|
|
28980
|
+
_a = {
|
|
28974
28981
|
envVars: envVars,
|
|
28975
|
-
secretEnvVarKeys: secretEnvVarKeys
|
|
28976
|
-
|
|
28977
|
-
|
|
28978
|
-
|
|
28982
|
+
secretEnvVarKeys: secretEnvVarKeys
|
|
28983
|
+
};
|
|
28984
|
+
_b = {};
|
|
28985
|
+
return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, buildConfigRaw && buildConfigRaw.jobVars || null)];
|
|
28986
|
+
case 2:
|
|
28987
|
+
_b.build = _m.sent();
|
|
28988
|
+
return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, deployConfigRaw && deployConfigRaw.jobVars || null)];
|
|
28989
|
+
case 3:
|
|
28990
|
+
return [2 /*return*/, (_a.jobOnlyVars = (_b.deploy = _m.sent(), _b), _a.host = host, _a.url = url, _a)];
|
|
28979
28991
|
}
|
|
28980
28992
|
});
|
|
28981
28993
|
});
|
|
@@ -29487,6 +29499,232 @@ exports.translateLegacyFromComponents = translateLegacyFromComponents;
|
|
|
29487
29499
|
|
|
29488
29500
|
/***/ }),
|
|
29489
29501
|
|
|
29502
|
+
/***/ 8231:
|
|
29503
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
29504
|
+
|
|
29505
|
+
"use strict";
|
|
29506
|
+
|
|
29507
|
+
|
|
29508
|
+
var __assign = this && this.__assign || function () {
|
|
29509
|
+
__assign = Object.assign || function (t) {
|
|
29510
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
29511
|
+
s = arguments[i];
|
|
29512
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
29513
|
+
}
|
|
29514
|
+
return t;
|
|
29515
|
+
};
|
|
29516
|
+
return __assign.apply(this, arguments);
|
|
29517
|
+
};
|
|
29518
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
29519
|
+
function adopt(value) {
|
|
29520
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
29521
|
+
resolve(value);
|
|
29522
|
+
});
|
|
29523
|
+
}
|
|
29524
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
29525
|
+
function fulfilled(value) {
|
|
29526
|
+
try {
|
|
29527
|
+
step(generator.next(value));
|
|
29528
|
+
} catch (e) {
|
|
29529
|
+
reject(e);
|
|
29530
|
+
}
|
|
29531
|
+
}
|
|
29532
|
+
function rejected(value) {
|
|
29533
|
+
try {
|
|
29534
|
+
step(generator["throw"](value));
|
|
29535
|
+
} catch (e) {
|
|
29536
|
+
reject(e);
|
|
29537
|
+
}
|
|
29538
|
+
}
|
|
29539
|
+
function step(result) {
|
|
29540
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
29541
|
+
}
|
|
29542
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
29543
|
+
});
|
|
29544
|
+
};
|
|
29545
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
29546
|
+
var _ = {
|
|
29547
|
+
label: 0,
|
|
29548
|
+
sent: function () {
|
|
29549
|
+
if (t[0] & 1) throw t[1];
|
|
29550
|
+
return t[1];
|
|
29551
|
+
},
|
|
29552
|
+
trys: [],
|
|
29553
|
+
ops: []
|
|
29554
|
+
},
|
|
29555
|
+
f,
|
|
29556
|
+
y,
|
|
29557
|
+
t,
|
|
29558
|
+
g;
|
|
29559
|
+
return g = {
|
|
29560
|
+
next: verb(0),
|
|
29561
|
+
"throw": verb(1),
|
|
29562
|
+
"return": verb(2)
|
|
29563
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
29564
|
+
return this;
|
|
29565
|
+
}), g;
|
|
29566
|
+
function verb(n) {
|
|
29567
|
+
return function (v) {
|
|
29568
|
+
return step([n, v]);
|
|
29569
|
+
};
|
|
29570
|
+
}
|
|
29571
|
+
function step(op) {
|
|
29572
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
29573
|
+
while (_) try {
|
|
29574
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29575
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
29576
|
+
switch (op[0]) {
|
|
29577
|
+
case 0:
|
|
29578
|
+
case 1:
|
|
29579
|
+
t = op;
|
|
29580
|
+
break;
|
|
29581
|
+
case 4:
|
|
29582
|
+
_.label++;
|
|
29583
|
+
return {
|
|
29584
|
+
value: op[1],
|
|
29585
|
+
done: false
|
|
29586
|
+
};
|
|
29587
|
+
case 5:
|
|
29588
|
+
_.label++;
|
|
29589
|
+
y = op[1];
|
|
29590
|
+
op = [0];
|
|
29591
|
+
continue;
|
|
29592
|
+
case 7:
|
|
29593
|
+
op = _.ops.pop();
|
|
29594
|
+
_.trys.pop();
|
|
29595
|
+
continue;
|
|
29596
|
+
default:
|
|
29597
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
29598
|
+
_ = 0;
|
|
29599
|
+
continue;
|
|
29600
|
+
}
|
|
29601
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
29602
|
+
_.label = op[1];
|
|
29603
|
+
break;
|
|
29604
|
+
}
|
|
29605
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
29606
|
+
_.label = t[1];
|
|
29607
|
+
t = op;
|
|
29608
|
+
break;
|
|
29609
|
+
}
|
|
29610
|
+
if (t && _.label < t[2]) {
|
|
29611
|
+
_.label = t[2];
|
|
29612
|
+
_.ops.push(op);
|
|
29613
|
+
break;
|
|
29614
|
+
}
|
|
29615
|
+
if (t[2]) _.ops.pop();
|
|
29616
|
+
_.trys.pop();
|
|
29617
|
+
continue;
|
|
29618
|
+
}
|
|
29619
|
+
op = body.call(thisArg, _);
|
|
29620
|
+
} catch (e) {
|
|
29621
|
+
op = [6, e];
|
|
29622
|
+
y = 0;
|
|
29623
|
+
} finally {
|
|
29624
|
+
f = t = 0;
|
|
29625
|
+
}
|
|
29626
|
+
if (op[0] & 5) throw op[1];
|
|
29627
|
+
return {
|
|
29628
|
+
value: op[0] ? op[1] : void 0,
|
|
29629
|
+
done: true
|
|
29630
|
+
};
|
|
29631
|
+
}
|
|
29632
|
+
};
|
|
29633
|
+
exports.__esModule = true;
|
|
29634
|
+
exports.transformJobOnlyVars = void 0;
|
|
29635
|
+
var envVars_1 = __nccwpck_require__(4590);
|
|
29636
|
+
/**
|
|
29637
|
+
* transform EnvVars for environment.
|
|
29638
|
+
*
|
|
29639
|
+
* currently does not resolve references and is only used for additional job-only-vars
|
|
29640
|
+
* @param vars
|
|
29641
|
+
* @returns
|
|
29642
|
+
*/
|
|
29643
|
+
var transformJobOnlyVars = function (env, componentName, vars) {
|
|
29644
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
29645
|
+
var publicVars, secretEnvVarKeys, deployJobOnlySecretEnvVars, envVars;
|
|
29646
|
+
var _a, _b;
|
|
29647
|
+
return __generator(this, function (_c) {
|
|
29648
|
+
if (!vars) {
|
|
29649
|
+
return [2 /*return*/, {
|
|
29650
|
+
envVars: {},
|
|
29651
|
+
secretEnvVarKeys: []
|
|
29652
|
+
}];
|
|
29653
|
+
}
|
|
29654
|
+
publicVars = (0, envVars_1.stringifyValues)((_a = vars === null || vars === void 0 ? void 0 : vars.public) !== null && _a !== void 0 ? _a : {});
|
|
29655
|
+
secretEnvVarKeys = (0, envVars_1.stringListToSecreteEnvVarList)((_b = vars === null || vars === void 0 ? void 0 : vars.secret) !== null && _b !== void 0 ? _b : []);
|
|
29656
|
+
deployJobOnlySecretEnvVars = (vars === null || vars === void 0 ? void 0 : vars.secret) ? (0, envVars_1.makeSecretEnvVarMapping)(env, componentName, secretEnvVarKeys) : {};
|
|
29657
|
+
envVars = __assign(__assign({}, deployJobOnlySecretEnvVars), publicVars);
|
|
29658
|
+
return [2 /*return*/, {
|
|
29659
|
+
envVars: envVars,
|
|
29660
|
+
secretEnvVarKeys: secretEnvVarKeys
|
|
29661
|
+
}];
|
|
29662
|
+
});
|
|
29663
|
+
});
|
|
29664
|
+
};
|
|
29665
|
+
exports.transformJobOnlyVars = transformJobOnlyVars;
|
|
29666
|
+
|
|
29667
|
+
/***/ }),
|
|
29668
|
+
|
|
29669
|
+
/***/ 4590:
|
|
29670
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
29671
|
+
|
|
29672
|
+
"use strict";
|
|
29673
|
+
|
|
29674
|
+
|
|
29675
|
+
var __read = this && this.__read || function (o, n) {
|
|
29676
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
29677
|
+
if (!m) return o;
|
|
29678
|
+
var i = m.call(o),
|
|
29679
|
+
r,
|
|
29680
|
+
ar = [],
|
|
29681
|
+
e;
|
|
29682
|
+
try {
|
|
29683
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
29684
|
+
} catch (error) {
|
|
29685
|
+
e = {
|
|
29686
|
+
error: error
|
|
29687
|
+
};
|
|
29688
|
+
} finally {
|
|
29689
|
+
try {
|
|
29690
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
29691
|
+
} finally {
|
|
29692
|
+
if (e) throw e.error;
|
|
29693
|
+
}
|
|
29694
|
+
}
|
|
29695
|
+
return ar;
|
|
29696
|
+
};
|
|
29697
|
+
exports.__esModule = true;
|
|
29698
|
+
exports.makeSecretEnvVarMapping = exports.stringListToSecreteEnvVarList = exports.stringifyValues = void 0;
|
|
29699
|
+
var lodash_1 = __nccwpck_require__(3255);
|
|
29700
|
+
var getEnvironmentVariables_1 = __nccwpck_require__(2292);
|
|
29701
|
+
var stringifyValues = function (obj) {
|
|
29702
|
+
return Object.fromEntries(Object.entries(obj).map(function (_a) {
|
|
29703
|
+
var _b = __read(_a, 2),
|
|
29704
|
+
key = _b[0],
|
|
29705
|
+
value = _b[1];
|
|
29706
|
+
return [key, (0, lodash_1.isObject)(value) ? JSON.stringify(value) : "".concat(value)];
|
|
29707
|
+
}));
|
|
29708
|
+
};
|
|
29709
|
+
exports.stringifyValues = stringifyValues;
|
|
29710
|
+
var stringListToSecreteEnvVarList = function (keys) {
|
|
29711
|
+
return keys.map(function (key) {
|
|
29712
|
+
return {
|
|
29713
|
+
key: key
|
|
29714
|
+
};
|
|
29715
|
+
});
|
|
29716
|
+
};
|
|
29717
|
+
exports.stringListToSecreteEnvVarList = stringListToSecreteEnvVarList;
|
|
29718
|
+
var makeSecretEnvVarMapping = function (env, componentName, secretEnvVars) {
|
|
29719
|
+
return Object.fromEntries(secretEnvVars.map(function (_a) {
|
|
29720
|
+
var key = _a.key;
|
|
29721
|
+
return [key, "$".concat((0, getEnvironmentVariables_1.getSecretVarName)(env, componentName, key))];
|
|
29722
|
+
}));
|
|
29723
|
+
};
|
|
29724
|
+
exports.makeSecretEnvVarMapping = makeSecretEnvVarMapping;
|
|
29725
|
+
|
|
29726
|
+
/***/ }),
|
|
29727
|
+
|
|
29490
29728
|
/***/ 7328:
|
|
29491
29729
|
/***/ ((__unused_webpack_module, exports) => {
|
|
29492
29730
|
|
|
@@ -29568,7 +29806,7 @@ var getBaseDeploymentJob = function (context) {
|
|
|
29568
29806
|
}],
|
|
29569
29807
|
allow_failure: whenDeploy === "manual" ? true : false,
|
|
29570
29808
|
stage: "deploy",
|
|
29571
|
-
variables: __assign(__assign(__assign(__assign({}, DEPLOY_RUNNER_VARIABLES), context.environment.envVars), hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {}), context.componentConfig.deploy ? (_d = context.componentConfig.deploy.extraVars) !== null && _d !== void 0 ? _d : {} : {}),
|
|
29809
|
+
variables: __assign(__assign(__assign(__assign(__assign({}, DEPLOY_RUNNER_VARIABLES), context.environment.envVars), hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {}), context.environment.jobOnlyVars.deploy.envVars), context.componentConfig.deploy ? (_d = context.componentConfig.deploy.extraVars) !== null && _d !== void 0 ? _d : {} : {}),
|
|
29572
29810
|
environment: __assign(__assign({}, context.environment.gitlabEnvironment), isStoppable ? {
|
|
29573
29811
|
on_stop: exports.STOP_JOB_NAME,
|
|
29574
29812
|
auto_stop_in: autoStop
|
|
@@ -29590,7 +29828,7 @@ var getBaseDeploymentStopJob = function (context) {
|
|
|
29590
29828
|
when: "manual",
|
|
29591
29829
|
allow_failure: true
|
|
29592
29830
|
}],
|
|
29593
|
-
variables: __assign(__assign({}, DEPLOY_RUNNER_VARIABLES), {
|
|
29831
|
+
variables: __assign(__assign(__assign({}, DEPLOY_RUNNER_VARIABLES), context.environment.jobOnlyVars.deploy.envVars), {
|
|
29594
29832
|
GIT_STRATEGY: "none"
|
|
29595
29833
|
}),
|
|
29596
29834
|
stage: "stop",
|
|
@@ -29609,7 +29847,7 @@ var getBaseRollbackJob = function (context) {
|
|
|
29609
29847
|
when: "manual",
|
|
29610
29848
|
allow_failure: true
|
|
29611
29849
|
}],
|
|
29612
|
-
variables: __assign(__assign({}, DEPLOY_RUNNER_VARIABLES), {
|
|
29850
|
+
variables: __assign(__assign(__assign({}, DEPLOY_RUNNER_VARIABLES), context.environment.jobOnlyVars.deploy.envVars), {
|
|
29613
29851
|
GIT_STRATEGY: "none"
|
|
29614
29852
|
}),
|
|
29615
29853
|
stage: "rollback",
|
package/dist/constants.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
5
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
5
|
+
exports.PIPELINE_IMAGE_TAG = "main-0acdca98" || "";
|
|
6
6
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "";
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __assign = this && this.__assign || function () {
|
|
4
|
+
__assign = Object.assign || function (t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
3
13
|
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
4
14
|
function adopt(value) {
|
|
5
15
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -121,30 +131,26 @@ var getEnvironmentContext_1 = require("./getEnvironmentContext");
|
|
|
121
131
|
var getEnvironmentVariables_1 = require("./getEnvironmentVariables");
|
|
122
132
|
var getEnvironment = function (config, componentName, env, commitInfo) {
|
|
123
133
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
124
|
-
var
|
|
125
|
-
return __generator(this, function (
|
|
126
|
-
switch (
|
|
134
|
+
var variables, envContext, envType;
|
|
135
|
+
return __generator(this, function (_a) {
|
|
136
|
+
switch (_a.label) {
|
|
127
137
|
case 0:
|
|
128
138
|
return [4 /*yield*/, (0, getEnvironmentVariables_1.getEnvironmentVariables)(config, componentName, env, commitInfo)];
|
|
129
139
|
case 1:
|
|
130
|
-
|
|
140
|
+
variables = _a.sent();
|
|
131
141
|
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
|
|
132
142
|
envType = envContext.envType;
|
|
133
|
-
return [2 /*return*/, {
|
|
143
|
+
return [2 /*return*/, __assign({
|
|
134
144
|
envType: envType,
|
|
135
|
-
host: host,
|
|
136
|
-
url: url,
|
|
137
145
|
gitlabEnvironment: {
|
|
138
146
|
name: envContext.gitlabEnvironmentName,
|
|
139
|
-
url: url
|
|
147
|
+
url: variables.url
|
|
140
148
|
},
|
|
141
149
|
fullName: envContext.fullName,
|
|
142
150
|
slugPrefix: envContext.environmentSlugPrefix,
|
|
143
151
|
slug: envContext.environmentSlug,
|
|
144
|
-
shortName: env
|
|
145
|
-
|
|
146
|
-
secretEnvVarKeys: secretEnvVarKeys
|
|
147
|
-
}];
|
|
152
|
+
shortName: env
|
|
153
|
+
}, variables)];
|
|
148
154
|
}
|
|
149
155
|
});
|
|
150
156
|
});
|