@catladder/cli 0.0.0-main-0009a81d → 0.0.0-main-a4e913e3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/catenv/index.js +350 -104
- package/dist/bundles/cli/index.js +350 -104
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -350753,17 +350753,312 @@ exports.readConfigSync = readConfigSync;
|
|
|
350753
350753
|
|
|
350754
350754
|
exports.__esModule = true;
|
|
350755
350755
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
350756
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
350756
|
+
exports.PIPELINE_IMAGE_TAG = "main-a4e913e3" || 0;
|
|
350757
350757
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
350758
350758
|
|
|
350759
350759
|
/***/ }),
|
|
350760
350760
|
|
|
350761
|
+
/***/ 25706:
|
|
350762
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
350763
|
+
|
|
350764
|
+
"use strict";
|
|
350765
|
+
|
|
350766
|
+
|
|
350767
|
+
exports.__esModule = true;
|
|
350768
|
+
exports.getEnvConfig = void 0;
|
|
350769
|
+
|
|
350770
|
+
var utils_1 = __nccwpck_require__(37461);
|
|
350771
|
+
|
|
350772
|
+
var getEnvConfig = function (config, componentName, env) {
|
|
350773
|
+
var _a, _b;
|
|
350774
|
+
|
|
350775
|
+
var defaultConfig = config.components[componentName];
|
|
350776
|
+
|
|
350777
|
+
if (!defaultConfig) {
|
|
350778
|
+
throw new Error("unknown component " + componentName);
|
|
350779
|
+
}
|
|
350780
|
+
|
|
350781
|
+
var envCustomizations = (_b = (_a = defaultConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
|
|
350782
|
+
|
|
350783
|
+
if (envCustomizations === false) {
|
|
350784
|
+
throw new Error("env is disabled: " + env);
|
|
350785
|
+
}
|
|
350786
|
+
|
|
350787
|
+
return (0, utils_1.mergeWithMergingArrays)(defaultConfig, envCustomizations);
|
|
350788
|
+
};
|
|
350789
|
+
|
|
350790
|
+
exports.getEnvConfig = getEnvConfig;
|
|
350791
|
+
|
|
350792
|
+
/***/ }),
|
|
350793
|
+
|
|
350794
|
+
/***/ 94811:
|
|
350795
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
350796
|
+
|
|
350797
|
+
"use strict";
|
|
350798
|
+
|
|
350799
|
+
|
|
350800
|
+
exports.__esModule = true;
|
|
350801
|
+
exports.getEnvType = void 0;
|
|
350802
|
+
|
|
350803
|
+
var types_1 = __nccwpck_require__(71753);
|
|
350804
|
+
|
|
350805
|
+
var getEnvType = function (env, envConfig) {
|
|
350806
|
+
if (envConfig.type) return envConfig.type;
|
|
350807
|
+
|
|
350808
|
+
if ((0, types_1.isKnowEnvType)(env)) {
|
|
350809
|
+
return env;
|
|
350810
|
+
}
|
|
350811
|
+
|
|
350812
|
+
throw new Error("unknown env type: " + env);
|
|
350813
|
+
};
|
|
350814
|
+
|
|
350815
|
+
exports.getEnvType = getEnvType;
|
|
350816
|
+
|
|
350817
|
+
/***/ }),
|
|
350818
|
+
|
|
350761
350819
|
/***/ 60740:
|
|
350762
350820
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
350763
350821
|
|
|
350764
350822
|
"use strict";
|
|
350765
350823
|
|
|
350766
350824
|
|
|
350825
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
350826
|
+
function adopt(value) {
|
|
350827
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
350828
|
+
resolve(value);
|
|
350829
|
+
});
|
|
350830
|
+
}
|
|
350831
|
+
|
|
350832
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
350833
|
+
function fulfilled(value) {
|
|
350834
|
+
try {
|
|
350835
|
+
step(generator.next(value));
|
|
350836
|
+
} catch (e) {
|
|
350837
|
+
reject(e);
|
|
350838
|
+
}
|
|
350839
|
+
}
|
|
350840
|
+
|
|
350841
|
+
function rejected(value) {
|
|
350842
|
+
try {
|
|
350843
|
+
step(generator["throw"](value));
|
|
350844
|
+
} catch (e) {
|
|
350845
|
+
reject(e);
|
|
350846
|
+
}
|
|
350847
|
+
}
|
|
350848
|
+
|
|
350849
|
+
function step(result) {
|
|
350850
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
350851
|
+
}
|
|
350852
|
+
|
|
350853
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
350854
|
+
});
|
|
350855
|
+
};
|
|
350856
|
+
|
|
350857
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
350858
|
+
var _ = {
|
|
350859
|
+
label: 0,
|
|
350860
|
+
sent: function () {
|
|
350861
|
+
if (t[0] & 1) throw t[1];
|
|
350862
|
+
return t[1];
|
|
350863
|
+
},
|
|
350864
|
+
trys: [],
|
|
350865
|
+
ops: []
|
|
350866
|
+
},
|
|
350867
|
+
f,
|
|
350868
|
+
y,
|
|
350869
|
+
t,
|
|
350870
|
+
g;
|
|
350871
|
+
return g = {
|
|
350872
|
+
next: verb(0),
|
|
350873
|
+
"throw": verb(1),
|
|
350874
|
+
"return": verb(2)
|
|
350875
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
350876
|
+
return this;
|
|
350877
|
+
}), g;
|
|
350878
|
+
|
|
350879
|
+
function verb(n) {
|
|
350880
|
+
return function (v) {
|
|
350881
|
+
return step([n, v]);
|
|
350882
|
+
};
|
|
350883
|
+
}
|
|
350884
|
+
|
|
350885
|
+
function step(op) {
|
|
350886
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
350887
|
+
|
|
350888
|
+
while (_) try {
|
|
350889
|
+
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;
|
|
350890
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
350891
|
+
|
|
350892
|
+
switch (op[0]) {
|
|
350893
|
+
case 0:
|
|
350894
|
+
case 1:
|
|
350895
|
+
t = op;
|
|
350896
|
+
break;
|
|
350897
|
+
|
|
350898
|
+
case 4:
|
|
350899
|
+
_.label++;
|
|
350900
|
+
return {
|
|
350901
|
+
value: op[1],
|
|
350902
|
+
done: false
|
|
350903
|
+
};
|
|
350904
|
+
|
|
350905
|
+
case 5:
|
|
350906
|
+
_.label++;
|
|
350907
|
+
y = op[1];
|
|
350908
|
+
op = [0];
|
|
350909
|
+
continue;
|
|
350910
|
+
|
|
350911
|
+
case 7:
|
|
350912
|
+
op = _.ops.pop();
|
|
350913
|
+
|
|
350914
|
+
_.trys.pop();
|
|
350915
|
+
|
|
350916
|
+
continue;
|
|
350917
|
+
|
|
350918
|
+
default:
|
|
350919
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
350920
|
+
_ = 0;
|
|
350921
|
+
continue;
|
|
350922
|
+
}
|
|
350923
|
+
|
|
350924
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
350925
|
+
_.label = op[1];
|
|
350926
|
+
break;
|
|
350927
|
+
}
|
|
350928
|
+
|
|
350929
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
350930
|
+
_.label = t[1];
|
|
350931
|
+
t = op;
|
|
350932
|
+
break;
|
|
350933
|
+
}
|
|
350934
|
+
|
|
350935
|
+
if (t && _.label < t[2]) {
|
|
350936
|
+
_.label = t[2];
|
|
350937
|
+
|
|
350938
|
+
_.ops.push(op);
|
|
350939
|
+
|
|
350940
|
+
break;
|
|
350941
|
+
}
|
|
350942
|
+
|
|
350943
|
+
if (t[2]) _.ops.pop();
|
|
350944
|
+
|
|
350945
|
+
_.trys.pop();
|
|
350946
|
+
|
|
350947
|
+
continue;
|
|
350948
|
+
}
|
|
350949
|
+
|
|
350950
|
+
op = body.call(thisArg, _);
|
|
350951
|
+
} catch (e) {
|
|
350952
|
+
op = [6, e];
|
|
350953
|
+
y = 0;
|
|
350954
|
+
} finally {
|
|
350955
|
+
f = t = 0;
|
|
350956
|
+
}
|
|
350957
|
+
|
|
350958
|
+
if (op[0] & 5) throw op[1];
|
|
350959
|
+
return {
|
|
350960
|
+
value: op[0] ? op[1] : void 0,
|
|
350961
|
+
done: true
|
|
350962
|
+
};
|
|
350963
|
+
}
|
|
350964
|
+
};
|
|
350965
|
+
|
|
350966
|
+
exports.__esModule = true;
|
|
350967
|
+
exports.getEnvironment = void 0;
|
|
350968
|
+
|
|
350969
|
+
var getEnvironmentContext_1 = __nccwpck_require__(95141);
|
|
350970
|
+
|
|
350971
|
+
var getEnvironmentVariables_1 = __nccwpck_require__(76602);
|
|
350972
|
+
|
|
350973
|
+
var getEnvironment = function (config, componentName, env, commitInfo) {
|
|
350974
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
350975
|
+
var _a, envVars, secretEnvVarKeys, host, url, envContext, envType;
|
|
350976
|
+
|
|
350977
|
+
return __generator(this, function (_b) {
|
|
350978
|
+
switch (_b.label) {
|
|
350979
|
+
case 0:
|
|
350980
|
+
return [4
|
|
350981
|
+
/*yield*/
|
|
350982
|
+
, (0, getEnvironmentVariables_1.getEnvironmentVariables)(config, componentName, env, commitInfo)];
|
|
350983
|
+
|
|
350984
|
+
case 1:
|
|
350985
|
+
_a = _b.sent(), envVars = _a.envVars, secretEnvVarKeys = _a.secretEnvVarKeys, host = _a.host, url = _a.url;
|
|
350986
|
+
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
|
|
350987
|
+
envType = envContext.envType;
|
|
350988
|
+
return [2
|
|
350989
|
+
/*return*/
|
|
350990
|
+
, {
|
|
350991
|
+
envType: envType,
|
|
350992
|
+
host: host,
|
|
350993
|
+
url: url,
|
|
350994
|
+
gitlabEnvironment: {
|
|
350995
|
+
name: envContext.gitlabEnvironmentName,
|
|
350996
|
+
url: url
|
|
350997
|
+
},
|
|
350998
|
+
fullName: envContext.fullName,
|
|
350999
|
+
slug: envContext.environmentSlug,
|
|
351000
|
+
shortName: env,
|
|
351001
|
+
envVars: envVars,
|
|
351002
|
+
secretEnvVarKeys: secretEnvVarKeys
|
|
351003
|
+
}];
|
|
351004
|
+
}
|
|
351005
|
+
});
|
|
351006
|
+
});
|
|
351007
|
+
};
|
|
351008
|
+
|
|
351009
|
+
exports.getEnvironment = getEnvironment;
|
|
351010
|
+
|
|
351011
|
+
/***/ }),
|
|
351012
|
+
|
|
351013
|
+
/***/ 95141:
|
|
351014
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
351015
|
+
|
|
351016
|
+
"use strict";
|
|
351017
|
+
|
|
351018
|
+
|
|
351019
|
+
exports.__esModule = true;
|
|
351020
|
+
exports.getEnvironmentContext = void 0;
|
|
351021
|
+
|
|
351022
|
+
var getEnvConfig_1 = __nccwpck_require__(25706);
|
|
351023
|
+
|
|
351024
|
+
var getEnvType_1 = __nccwpck_require__(94811);
|
|
351025
|
+
|
|
351026
|
+
var getEnvironmentSlug = function (envConfig, env, componentName, commitInfo) {
|
|
351027
|
+
var envType = (0, getEnvType_1.getEnvType)(env, envConfig);
|
|
351028
|
+
return envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
|
|
351029
|
+
};
|
|
351030
|
+
|
|
351031
|
+
var getEnvironmentContext = function (config, env, componentName, commitInfo) {
|
|
351032
|
+
var envConfigRaw = (0, getEnvConfig_1.getEnvConfig)(config, componentName, env);
|
|
351033
|
+
var envType = (0, getEnvType_1.getEnvType)(env, envConfigRaw);
|
|
351034
|
+
var environmentSlug = getEnvironmentSlug(envConfigRaw, env, componentName, commitInfo);
|
|
351035
|
+
var gitlabEnvironmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
|
|
351036
|
+
var fullName = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
|
|
351037
|
+
return {
|
|
351038
|
+
envConfigRaw: envConfigRaw,
|
|
351039
|
+
deployConfigRaw: envConfigRaw.deploy,
|
|
351040
|
+
buildConfigRaw: envConfigRaw.build,
|
|
351041
|
+
environmentSlug: environmentSlug,
|
|
351042
|
+
gitlabEnvironmentName: gitlabEnvironmentName,
|
|
351043
|
+
fullName: fullName,
|
|
351044
|
+
envType: envType,
|
|
351045
|
+
commitInfo: commitInfo,
|
|
351046
|
+
componentName: componentName,
|
|
351047
|
+
env: env,
|
|
351048
|
+
fullConfig: config
|
|
351049
|
+
};
|
|
351050
|
+
};
|
|
351051
|
+
|
|
351052
|
+
exports.getEnvironmentContext = getEnvironmentContext;
|
|
351053
|
+
|
|
351054
|
+
/***/ }),
|
|
351055
|
+
|
|
351056
|
+
/***/ 76602:
|
|
351057
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
351058
|
+
|
|
351059
|
+
"use strict";
|
|
351060
|
+
|
|
351061
|
+
|
|
350767
351062
|
var __assign = this && this.__assign || function () {
|
|
350768
351063
|
__assign = Object.assign || function (t) {
|
|
350769
351064
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -350955,60 +351250,41 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
350955
351250
|
};
|
|
350956
351251
|
|
|
350957
351252
|
exports.__esModule = true;
|
|
350958
|
-
exports.getSecretVarNameForContext = exports.getSecretVarName = exports.
|
|
351253
|
+
exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvironmentVariables = void 0;
|
|
350959
351254
|
|
|
350960
351255
|
var lodash_1 = __nccwpck_require__(23255);
|
|
350961
351256
|
|
|
350962
351257
|
var deploy_1 = __nccwpck_require__(90223);
|
|
350963
351258
|
|
|
350964
|
-
var
|
|
350965
|
-
|
|
350966
|
-
var utils_1 = __nccwpck_require__(37461);
|
|
351259
|
+
var getEnvironmentContext_1 = __nccwpck_require__(95141);
|
|
350967
351260
|
|
|
350968
351261
|
var resolveReferences_1 = __nccwpck_require__(80928);
|
|
350969
351262
|
|
|
350970
|
-
var
|
|
351263
|
+
var getEnvironmentVariables = function (config, componentName, env, commitInfo, alreadyVisited // to prevent endless loop
|
|
350971
351264
|
) {
|
|
350972
351265
|
if (alreadyVisited === void 0) {
|
|
350973
351266
|
alreadyVisited = {};
|
|
350974
351267
|
}
|
|
350975
351268
|
|
|
350976
351269
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
350977
|
-
var
|
|
351270
|
+
var environmentContext, envConfigRaw, deployConfigRaw, envType, basePredefinedVariables, predefinedVariables, host, url, devLocalConfig, port, additionalEnvVars, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegasyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
|
|
350978
351271
|
|
|
350979
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
351272
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
350980
351273
|
|
|
350981
|
-
return __generator(this, function (
|
|
350982
|
-
switch (
|
|
351274
|
+
return __generator(this, function (_k) {
|
|
351275
|
+
switch (_k.label) {
|
|
350983
351276
|
case 0:
|
|
350984
|
-
|
|
350985
|
-
|
|
350986
|
-
|
|
350987
|
-
if (!envType) {
|
|
350988
|
-
throw new Error("Missing type in environment " + env + " in component " + componentName);
|
|
350989
|
-
}
|
|
350990
|
-
|
|
351277
|
+
environmentContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
|
|
351278
|
+
envConfigRaw = environmentContext.envConfigRaw, deployConfigRaw = environmentContext.deployConfigRaw, envType = environmentContext.envType;
|
|
350991
351279
|
basePredefinedVariables = {
|
|
350992
351280
|
ENV_SHORT: env,
|
|
350993
|
-
APP_DIR:
|
|
351281
|
+
APP_DIR: envConfigRaw.dir,
|
|
350994
351282
|
ENV_TYPE: envType
|
|
350995
351283
|
};
|
|
350996
|
-
gitlabEnvironmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
|
|
350997
|
-
environmentSlug = envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
|
|
350998
|
-
fullName = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
|
|
350999
|
-
envVarContext = {
|
|
351000
|
-
deployConfig: envConfig.deploy,
|
|
351001
|
-
fullName: fullName,
|
|
351002
|
-
envType: envType,
|
|
351003
|
-
commitInfo: commitInfo,
|
|
351004
|
-
componentName: componentName,
|
|
351005
|
-
env: env,
|
|
351006
|
-
fullConfig: config
|
|
351007
|
-
};
|
|
351008
351284
|
|
|
351009
351285
|
if (envType === "local") {
|
|
351010
|
-
devLocalConfig =
|
|
351011
|
-
port = (
|
|
351286
|
+
devLocalConfig = envConfigRaw;
|
|
351287
|
+
port = (_a = devLocalConfig.port) !== null && _a !== void 0 ? _a : 3000;
|
|
351012
351288
|
host = "localhost:" + port;
|
|
351013
351289
|
url = "http://" + host;
|
|
351014
351290
|
predefinedVariables = {
|
|
@@ -351017,8 +351293,8 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
|
|
|
351017
351293
|
PORT: port.toString()
|
|
351018
351294
|
};
|
|
351019
351295
|
} else {
|
|
351020
|
-
additionalEnvVars =
|
|
351021
|
-
host = (
|
|
351296
|
+
additionalEnvVars = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].getAdditionalEnvVars(environmentContext) : {};
|
|
351297
|
+
host = (_c = (_b = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _b !== void 0 ? _b : additionalEnvVars.HOST_CANONICAL) !== null && _c !== void 0 ? _c : "unknown-host.example.com";
|
|
351022
351298
|
url = "https://".concat(host);
|
|
351023
351299
|
predefinedVariables = __assign(__assign(__assign({}, basePredefinedVariables), {
|
|
351024
351300
|
HOST: host,
|
|
@@ -351026,13 +351302,13 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
|
|
|
351026
351302
|
}), additionalEnvVars);
|
|
351027
351303
|
}
|
|
351028
351304
|
|
|
351029
|
-
publicEnvVarsRaw = (
|
|
351030
|
-
additionalSecretKeys =
|
|
351031
|
-
secretEnvVarKeys = __spreadArray(__spreadArray([], __read((
|
|
351305
|
+
publicEnvVarsRaw = (_e = (_d = envConfigRaw.vars) === null || _d === void 0 ? void 0 : _d.public) !== null && _e !== void 0 ? _e : {};
|
|
351306
|
+
additionalSecretKeys = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].additionalSecretKeys(environmentContext) : [];
|
|
351307
|
+
secretEnvVarKeys = __spreadArray(__spreadArray([], __read((_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.secret) !== null && _g !== void 0 ? _g : []), false), __read(additionalSecretKeys), false);
|
|
351032
351308
|
secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
|
|
351033
351309
|
return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
|
|
351034
351310
|
}));
|
|
351035
|
-
legacyFromComponents = (
|
|
351311
|
+
legacyFromComponents = (_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.fromComponents) !== null && _j !== void 0 ? _j : {};
|
|
351036
351312
|
publicEnvVarsRawWithLegasyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
|
|
351037
351313
|
publicEnvVarsRawSanitized = Object.fromEntries(Object.entries(publicEnvVarsRawWithLegasyFromComponents).map(function (_a) {
|
|
351038
351314
|
var _b = __read(_a, 2),
|
|
@@ -351044,50 +351320,42 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
|
|
|
351044
351320
|
envVarsRaw = addIndexVar(__assign(__assign(__assign({}, predefinedVariables), secretEnvVars), publicEnvVarsRawSanitized));
|
|
351045
351321
|
return [4
|
|
351046
351322
|
/*yield*/
|
|
351047
|
-
, (0, resolveReferences_1.resolveReferences)(envVarsRaw, function (
|
|
351323
|
+
, (0, resolveReferences_1.resolveReferences)(envVarsRaw, function (otherComponentName, variableName, alreadyVisited) {
|
|
351048
351324
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
351049
|
-
var
|
|
351325
|
+
var otherEnvVars;
|
|
351050
351326
|
return __generator(this, function (_a) {
|
|
351051
351327
|
switch (_a.label) {
|
|
351052
351328
|
case 0:
|
|
351053
351329
|
return [4
|
|
351054
351330
|
/*yield*/
|
|
351055
|
-
, (0, exports.
|
|
351331
|
+
, (0, exports.getEnvironmentVariables)(config, otherComponentName, env, commitInfo, alreadyVisited)];
|
|
351056
351332
|
|
|
351057
351333
|
case 1:
|
|
351058
|
-
|
|
351334
|
+
otherEnvVars = _a.sent().envVars;
|
|
351059
351335
|
return [2
|
|
351060
351336
|
/*return*/
|
|
351061
|
-
,
|
|
351337
|
+
, otherEnvVars[variableName]];
|
|
351062
351338
|
}
|
|
351063
351339
|
});
|
|
351064
351340
|
});
|
|
351065
351341
|
}, alreadyVisited)];
|
|
351066
351342
|
|
|
351067
351343
|
case 1:
|
|
351068
|
-
envVars =
|
|
351344
|
+
envVars = _k.sent();
|
|
351069
351345
|
return [2
|
|
351070
351346
|
/*return*/
|
|
351071
351347
|
, {
|
|
351072
|
-
envType: envType,
|
|
351073
|
-
host: host,
|
|
351074
|
-
url: url,
|
|
351075
|
-
gitlabEnvironment: {
|
|
351076
|
-
name: gitlabEnvironmentName,
|
|
351077
|
-
url: url
|
|
351078
|
-
},
|
|
351079
|
-
fullName: fullName,
|
|
351080
|
-
slug: environmentSlug,
|
|
351081
|
-
shortName: env,
|
|
351082
351348
|
envVars: envVars,
|
|
351083
|
-
secretEnvVarKeys: secretEnvVarKeys
|
|
351349
|
+
secretEnvVarKeys: secretEnvVarKeys,
|
|
351350
|
+
host: host,
|
|
351351
|
+
url: url
|
|
351084
351352
|
}];
|
|
351085
351353
|
}
|
|
351086
351354
|
});
|
|
351087
351355
|
});
|
|
351088
351356
|
};
|
|
351089
351357
|
|
|
351090
|
-
exports.
|
|
351358
|
+
exports.getEnvironmentVariables = getEnvironmentVariables;
|
|
351091
351359
|
|
|
351092
351360
|
var sanitizeForEnVar = function (s) {
|
|
351093
351361
|
return s.replace(/-/g, "_");
|
|
@@ -351112,24 +351380,6 @@ var getSecretVarNameForContext = function (context, key) {
|
|
|
351112
351380
|
|
|
351113
351381
|
exports.getSecretVarNameForContext = getSecretVarNameForContext;
|
|
351114
351382
|
|
|
351115
|
-
var getEnvConfig = function (config, componentName, env) {
|
|
351116
|
-
var _a, _b;
|
|
351117
|
-
|
|
351118
|
-
var defaultConfig = config.components[componentName];
|
|
351119
|
-
|
|
351120
|
-
if (!defaultConfig) {
|
|
351121
|
-
throw new Error("unknown component " + componentName);
|
|
351122
|
-
}
|
|
351123
|
-
|
|
351124
|
-
var envCustomizations = (_b = (_a = defaultConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
|
|
351125
|
-
|
|
351126
|
-
if (envCustomizations === false) {
|
|
351127
|
-
throw new Error("env is disabled: " + env);
|
|
351128
|
-
}
|
|
351129
|
-
|
|
351130
|
-
return (0, utils_1.mergeWithMergingArrays)(defaultConfig, envCustomizations);
|
|
351131
|
-
};
|
|
351132
|
-
|
|
351133
351383
|
/***/ }),
|
|
351134
351384
|
|
|
351135
351385
|
/***/ 30486:
|
|
@@ -351363,34 +351613,30 @@ var utils_1 = __nccwpck_require__(37461);
|
|
|
351363
351613
|
|
|
351364
351614
|
var getEnvironment_1 = __nccwpck_require__(60740);
|
|
351365
351615
|
|
|
351616
|
+
var getEnvironmentContext_1 = __nccwpck_require__(95141);
|
|
351617
|
+
|
|
351366
351618
|
__exportStar(__nccwpck_require__(60740), exports);
|
|
351367
351619
|
|
|
351620
|
+
__exportStar(__nccwpck_require__(76602), exports);
|
|
351621
|
+
|
|
351368
351622
|
var createContext = function (config, componentName, env, commitInfo, packageManagerInfo) {
|
|
351369
351623
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
351370
|
-
var
|
|
351624
|
+
var envContext, componentConfigWithoutDefaults, defaults, componentConfig;
|
|
351371
351625
|
|
|
351372
351626
|
var _a;
|
|
351373
351627
|
|
|
351374
|
-
|
|
351375
|
-
|
|
351376
|
-
return __generator(this, function (_d) {
|
|
351377
|
-
switch (_d.label) {
|
|
351628
|
+
return __generator(this, function (_b) {
|
|
351629
|
+
switch (_b.label) {
|
|
351378
351630
|
case 0:
|
|
351379
351631
|
if (!/^[a-z0-9-]+$/.test(componentName)) {
|
|
351380
351632
|
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
351381
351633
|
}
|
|
351382
351634
|
|
|
351383
|
-
|
|
351384
|
-
|
|
351385
|
-
if (!rawConfig) {
|
|
351386
|
-
throw new Error("unknown component " + componentName);
|
|
351387
|
-
}
|
|
351388
|
-
|
|
351389
|
-
envConfig = (_c = (_b = rawConfig.env) === null || _b === void 0 ? void 0 : _b[env]) !== null && _c !== void 0 ? _c : {};
|
|
351390
|
-
componentConfigWithoutDefaults = (0, utils_1.mergeWithMergingArrays)(rawConfig, envConfig);
|
|
351635
|
+
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(config, env, componentName, commitInfo);
|
|
351636
|
+
componentConfigWithoutDefaults = envContext.envConfigRaw;
|
|
351391
351637
|
defaults = componentConfigWithoutDefaults.deploy ? {
|
|
351392
|
-
build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(),
|
|
351393
|
-
deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults()
|
|
351638
|
+
build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(envContext),
|
|
351639
|
+
deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext)
|
|
351394
351640
|
} : {
|
|
351395
351641
|
build: {},
|
|
351396
351642
|
deploy: {}
|
|
@@ -351408,7 +351654,7 @@ var createContext = function (config, componentName, env, commitInfo, packageMan
|
|
|
351408
351654
|
case 1:
|
|
351409
351655
|
return [2
|
|
351410
351656
|
/*return*/
|
|
351411
|
-
, (_a.environment =
|
|
351657
|
+
, (_a.environment = _b.sent(), _a.commitInfo = commitInfo, _a.packageManagerInfo = packageManagerInfo, _a)];
|
|
351412
351658
|
}
|
|
351413
351659
|
});
|
|
351414
351660
|
});
|
|
@@ -352165,14 +352411,14 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
|
|
|
352165
352411
|
var fullName = _a.fullName,
|
|
352166
352412
|
env = _a.env,
|
|
352167
352413
|
componentName = _a.componentName,
|
|
352168
|
-
|
|
352414
|
+
deployConfigRaw = _a.deployConfigRaw;
|
|
352169
352415
|
var HOST_CANONICAL = fullName.toLowerCase() + "-" + process.env[(0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX)];
|
|
352170
|
-
var jobTriggers =
|
|
352416
|
+
var jobTriggers = deployConfigRaw && deployConfigRaw.jobs ? Object.fromEntries(Object.entries(deployConfigRaw.jobs).map(function (_a) {
|
|
352171
352417
|
var _b = __read(_a, 2),
|
|
352172
352418
|
name = _b[0],
|
|
352173
352419
|
job = _b[1];
|
|
352174
352420
|
|
|
352175
|
-
return ["CLOUD_RUN_JOB_TRIGGER_URL_" + name, "https://".concat(
|
|
352421
|
+
return ["CLOUD_RUN_JOB_TRIGGER_URL_" + name, "https://".concat(deployConfigRaw.region, "-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/").concat(deployConfigRaw.projectId, "/jobs/").concat(name, ":run")];
|
|
352176
352422
|
})) : {};
|
|
352177
352423
|
return __assign({
|
|
352178
352424
|
HOST_CANONICAL: HOST_CANONICAL
|
|
@@ -352441,16 +352687,16 @@ var dockerTag_1 = __nccwpck_require__(18990);
|
|
|
352441
352687
|
|
|
352442
352688
|
var kubernetes_1 = __nccwpck_require__(95682);
|
|
352443
352689
|
|
|
352690
|
+
__exportStar(__nccwpck_require__(81344), exports);
|
|
352691
|
+
|
|
352692
|
+
__exportStar(__nccwpck_require__(13539), exports);
|
|
352693
|
+
|
|
352444
352694
|
__exportStar(__nccwpck_require__(95682), exports);
|
|
352445
352695
|
|
|
352446
352696
|
__exportStar(__nccwpck_require__(63109), exports);
|
|
352447
352697
|
|
|
352448
352698
|
__exportStar(__nccwpck_require__(92757), exports);
|
|
352449
352699
|
|
|
352450
|
-
__exportStar(__nccwpck_require__(13539), exports);
|
|
352451
|
-
|
|
352452
|
-
__exportStar(__nccwpck_require__(81344), exports);
|
|
352453
|
-
|
|
352454
352700
|
exports.DEPLOY_TYPES = {
|
|
352455
352701
|
kubernetes: kubernetes_1.KUBERNETES_DEPLOY_TYPE,
|
|
352456
352702
|
custom: custom_1.CUSTOM_DEPLOY_TYPE,
|
|
@@ -352472,23 +352718,23 @@ exports.additionalKubernetesSecretKeys = void 0;
|
|
|
352472
352718
|
var additionalKubernetesSecretKeys = function (_a) {
|
|
352473
352719
|
var _b, _c, _d, _e;
|
|
352474
352720
|
|
|
352475
|
-
var
|
|
352721
|
+
var deployConfigRaw = _a.deployConfigRaw;
|
|
352476
352722
|
|
|
352477
|
-
if (!
|
|
352723
|
+
if (!deployConfigRaw) {
|
|
352478
352724
|
return [];
|
|
352479
352725
|
}
|
|
352480
352726
|
|
|
352481
352727
|
var keys = [];
|
|
352482
352728
|
|
|
352483
|
-
if ((_c = (_b =
|
|
352729
|
+
if ((_c = (_b = deployConfigRaw.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled) {
|
|
352484
352730
|
keys.push("MONGODB_ROOT_PASSWORD");
|
|
352485
352731
|
|
|
352486
|
-
if (
|
|
352732
|
+
if (deployConfigRaw.values.mongodb.architecture === "replicaset") {
|
|
352487
352733
|
keys.push("MONGODB_REPLICASET_KEY");
|
|
352488
352734
|
}
|
|
352489
352735
|
}
|
|
352490
352736
|
|
|
352491
|
-
if ((_e = (_d =
|
|
352737
|
+
if ((_e = (_d = deployConfigRaw.values) === null || _d === void 0 ? void 0 : _d.cloudsql) === null || _e === void 0 ? void 0 : _e.enabled) {
|
|
352492
352738
|
keys.push("POSTGRESQL_PASSWORD");
|
|
352493
352739
|
keys.push("cloudsqlProxyCredentials");
|
|
352494
352740
|
}
|
|
@@ -352691,7 +352937,7 @@ exports.KUBERNETES_DEPLOY_TYPE = {
|
|
|
352691
352937
|
|
|
352692
352938
|
var componentName = _a.componentName,
|
|
352693
352939
|
fullConfig = _a.fullConfig,
|
|
352694
|
-
|
|
352940
|
+
deployConfigRaw = _a.deployConfigRaw,
|
|
352695
352941
|
env = _a.env,
|
|
352696
352942
|
envType = _a.envType,
|
|
352697
352943
|
commitInfo = _a.commitInfo;
|
|
@@ -352700,7 +352946,7 @@ exports.KUBERNETES_DEPLOY_TYPE = {
|
|
|
352700
352946
|
var KUBE_NAMESPACE = (0, __1.getKubernetesNamespace)(fullConfig, env);
|
|
352701
352947
|
var componentSlug = (0, slugify_1["default"])(componentName);
|
|
352702
352948
|
var envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, ".").concat(env) : env;
|
|
352703
|
-
var domainCanonical =
|
|
352949
|
+
var domainCanonical = deployConfigRaw && ((_b = deployConfigRaw.cluster) === null || _b === void 0 ? void 0 : _b.domainCanonical) || // for convenience, we allow clusters to define a canonical domain, because a cluster has a fixed ip and you will usually have a domain pointing to that cluster
|
|
352704
352950
|
fullConfig.domainCanonical || "panter.cloud";
|
|
352705
352951
|
var HOST_CANONICAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(fullConfig.appName, ".").concat(fullConfig.customerName, ".").concat(domainCanonical); // default for kubernetes and rest
|
|
352706
352952
|
|