@catladder/cli 0.0.0-next-5f70052e → 0.0.0-next-32b3a548
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 +424 -181
- package/dist/bundles/cli/index.js +437 -187
- package/dist/cli/src/apps/catenv/printVariables.js.map +1 -1
- package/dist/cli/src/apps/catenv/types.d.ts +0 -1
- package/dist/cli/src/apps/catenv/utils.d.ts +2 -5
- package/dist/cli/src/apps/catenv/utils.js +4 -9
- package/dist/cli/src/apps/catenv/utils.js.map +1 -1
- package/dist/cli/src/apps/catenv/writeDotEnvFiles.js +1 -3
- package/dist/cli/src/apps/catenv/writeDotEnvFiles.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js +12 -12
- package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js +6 -6
- package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
- package/dist/cli/src/config/getProjectConfig.js.map +1 -1
- package/dist/pipeline/src/bash/BashExpression.d.ts +0 -5
- package/dist/pipeline/src/bash/BashExpression.js +1 -15
- package/dist/pipeline/src/bash/BashExpression.js.map +1 -1
- package/dist/pipeline/src/bash/bashEscape.d.ts +30 -0
- package/dist/pipeline/src/bash/bashEscape.js +129 -0
- package/dist/pipeline/src/bash/bashEscape.js.map +1 -0
- package/dist/pipeline/src/bash/bashYaml.js +26 -2
- package/dist/pipeline/src/bash/bashYaml.js.map +1 -1
- package/dist/pipeline/src/bash/getInjectVarsScript.js +6 -2
- package/dist/pipeline/src/bash/getInjectVarsScript.js.map +1 -1
- package/dist/pipeline/src/bash/index.d.ts +2 -0
- package/dist/pipeline/src/bash/index.js +19 -0
- package/dist/pipeline/src/bash/index.js.map +1 -0
- package/dist/pipeline/src/build/base/writeDotEnv.js +4 -3
- package/dist/pipeline/src/build/base/writeDotEnv.js.map +1 -1
- package/dist/pipeline/src/build/docker.d.ts +3 -3
- package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +3 -1
- package/dist/pipeline/src/context/getEnvironmentVariables.js +23 -12
- package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +2 -2
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/utils/getServiceName.d.ts +1 -1
- package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/kubeEnv.d.ts +3 -3
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.d.ts +2 -2
- package/dist/pipeline/src/globalScriptFunctions/index.d.ts +6 -2
- package/dist/pipeline/src/globalScriptFunctions/index.js +17 -10
- package/dist/pipeline/src/globalScriptFunctions/index.js.map +1 -1
- package/dist/pipeline/src/index.d.ts +2 -0
- package/dist/pipeline/src/index.js +2 -0
- package/dist/pipeline/src/index.js.map +1 -1
- package/dist/pipeline/src/pipeline/gitlab/createGitlabPipeline.js +2 -25
- package/dist/pipeline/src/pipeline/gitlab/createGitlabPipeline.js.map +1 -1
- package/dist/pipeline/src/types/context.d.ts +2 -1
- package/dist/pipeline/src/types/context.js.map +1 -1
- package/dist/pipeline/src/utils/gitlab.js +9 -2
- package/dist/pipeline/src/utils/gitlab.js.map +1 -1
- package/dist/pipeline/src/variables/VariableValue.d.ts +3 -0
- package/dist/pipeline/src/variables/VariableValue.js +3 -0
- package/dist/pipeline/src/variables/VariableValue.js.map +1 -0
- package/dist/pipeline/src/variables/VariableValueContainingReferences.d.ts +24 -0
- package/dist/pipeline/src/variables/VariableValueContainingReferences.js +69 -0
- package/dist/pipeline/src/variables/VariableValueContainingReferences.js.map +1 -0
- package/dist/pipeline/src/variables/resolveAllReferences.d.ts +3 -0
- package/dist/pipeline/src/variables/resolveAllReferences.js +25 -0
- package/dist/pipeline/src/variables/resolveAllReferences.js.map +1 -0
- package/dist/pipeline/src/variables/resolveAllReferencesOnce.d.ts +5 -0
- package/dist/pipeline/src/variables/resolveAllReferencesOnce.js +23 -0
- package/dist/pipeline/src/variables/resolveAllReferencesOnce.js.map +1 -0
- package/dist/pipeline/src/variables/resolveReferencesOnce.d.ts +8 -0
- package/dist/pipeline/src/variables/resolveReferencesOnce.js +21 -0
- package/dist/pipeline/src/variables/resolveReferencesOnce.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/catenv/printVariables.ts +2 -2
- package/src/apps/catenv/types.ts +2 -2
- package/src/apps/catenv/utils.ts +8 -12
- package/src/apps/catenv/writeDotEnvFiles.ts +2 -5
- package/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.ts +16 -10
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +5 -3
- package/src/config/getProjectConfig.ts +5 -1
- package/dist/pipeline/src/bash/replaceAsync.d.ts +0 -2
- package/dist/pipeline/src/bash/replaceAsync.js +0 -37
- package/dist/pipeline/src/bash/replaceAsync.js.map +0 -1
- package/dist/pipeline/src/context/resolveReferences.d.ts +0 -3
- package/dist/pipeline/src/context/resolveReferences.js +0 -56
- package/dist/pipeline/src/context/resolveReferences.js.map +0 -1
|
@@ -862,7 +862,7 @@ const copyDb_1 = __nccwpck_require__(78651);
|
|
|
862
862
|
exports["default"] = async (vorpal) => vorpal
|
|
863
863
|
.command("project-cloud-sql-restore-db", "restores a project db from one source to another target")
|
|
864
864
|
.action(async function restoreDb() {
|
|
865
|
-
var _a, _b, _c, _d;
|
|
865
|
+
var _a, _b, _c, _d, _e;
|
|
866
866
|
const envs = await (0, autocompletions_1.envAndComponents)();
|
|
867
867
|
const { sourceEnvAndComponent } = await this.prompt({
|
|
868
868
|
type: "list",
|
|
@@ -892,7 +892,7 @@ exports["default"] = async (vorpal) => vorpal
|
|
|
892
892
|
scheme: "postgres",
|
|
893
893
|
hosts: [],
|
|
894
894
|
});
|
|
895
|
-
const parsersResult = parser.parse(sourceEnvVars.DATABASE_URL);
|
|
895
|
+
const parsersResult = parser.parse(sourceEnvVars.DATABASE_URL.toString());
|
|
896
896
|
sourcePort = (_b = (_a = parsersResult.hosts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.port;
|
|
897
897
|
sourceUsername = parsersResult.username;
|
|
898
898
|
sourcePassword = parsersResult.password;
|
|
@@ -901,12 +901,12 @@ exports["default"] = async (vorpal) => vorpal
|
|
|
901
901
|
else {
|
|
902
902
|
sourcePort = 54399;
|
|
903
903
|
sourceProxy = await (0, startProxy_1.startCloudSqlProxyInBackground)({
|
|
904
|
-
instanceName: sourceEnvVars.CLOUD_SQL_INSTANCE_CONNECTION_NAME,
|
|
904
|
+
instanceName: sourceEnvVars.CLOUD_SQL_INSTANCE_CONNECTION_NAME.toString(),
|
|
905
905
|
localPort: sourcePort,
|
|
906
906
|
});
|
|
907
|
-
sourceUsername = sourceEnvVars.DB_USER;
|
|
908
|
-
sourcePassword = sourceEnvVars.DB_PASSWORD;
|
|
909
|
-
sourceDbName = sourceEnvVars.DB_NAME;
|
|
907
|
+
sourceUsername = sourceEnvVars.DB_USER.toString();
|
|
908
|
+
sourcePassword = sourceEnvVars.DB_PASSWORD.toString();
|
|
909
|
+
sourceDbName = (_c = sourceEnvVars.DB_NAME) === null || _c === void 0 ? void 0 : _c.toString();
|
|
910
910
|
}
|
|
911
911
|
const { targetEnvAndComponent } = await this.prompt({
|
|
912
912
|
type: "list",
|
|
@@ -922,8 +922,8 @@ exports["default"] = async (vorpal) => vorpal
|
|
|
922
922
|
scheme: "postgres",
|
|
923
923
|
hosts: [],
|
|
924
924
|
});
|
|
925
|
-
const parsersResult = parser.parse(targetEnvVars.DATABASE_URL);
|
|
926
|
-
targetPort = (
|
|
925
|
+
const parsersResult = parser.parse(targetEnvVars.DATABASE_URL.toString());
|
|
926
|
+
targetPort = (_e = (_d = parsersResult.hosts) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.port;
|
|
927
927
|
targetUsername = parsersResult.username;
|
|
928
928
|
targetPassword = parsersResult.password;
|
|
929
929
|
targetDbName = parsersResult.endpoint;
|
|
@@ -931,12 +931,12 @@ exports["default"] = async (vorpal) => vorpal
|
|
|
931
931
|
else {
|
|
932
932
|
targetPort = 54499;
|
|
933
933
|
targetProxy = await (0, startProxy_1.startCloudSqlProxyInBackground)({
|
|
934
|
-
instanceName: targetEnvVars.CLOUD_SQL_INSTANCE_CONNECTION_NAME,
|
|
934
|
+
instanceName: targetEnvVars.CLOUD_SQL_INSTANCE_CONNECTION_NAME.toString(),
|
|
935
935
|
localPort: targetPort,
|
|
936
936
|
});
|
|
937
|
-
targetUsername = targetEnvVars.DB_USER;
|
|
938
|
-
targetPassword = targetEnvVars.DB_PASSWORD;
|
|
939
|
-
targetDbName = targetEnvVars.DB_NAME;
|
|
937
|
+
targetUsername = targetEnvVars.DB_USER.toString();
|
|
938
|
+
targetPassword = targetEnvVars.DB_PASSWORD.toString();
|
|
939
|
+
targetDbName = targetEnvVars.DB_NAME.toString();
|
|
940
940
|
}
|
|
941
941
|
const { shouldContinue } = await this.prompt({
|
|
942
942
|
type: "confirm",
|
|
@@ -1038,14 +1038,14 @@ exports["default"] = async (vorpal) => vorpal
|
|
|
1038
1038
|
});
|
|
1039
1039
|
});
|
|
1040
1040
|
const getProxyInfoForKubernetes = async (vorpal, context) => {
|
|
1041
|
-
var _a;
|
|
1041
|
+
var _a, _b;
|
|
1042
1042
|
if (!(0, pipeline_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
|
|
1043
1043
|
throw new Error("unsupported");
|
|
1044
1044
|
}
|
|
1045
1045
|
const envVars = await (0, getProjectConfig_1.getEnvVarsResolved)(vorpal, context.env, context.name);
|
|
1046
1046
|
// bit hacky, would be nicer if we would also declare this through env vars
|
|
1047
1047
|
const cloudSqlValues = (0, pipeline_1.createKubernetesCloudsqlBaseValues)(context);
|
|
1048
|
-
const DB_PASSWORD = (envVars === null || envVars === void 0 ? void 0 : envVars.DB_PASSWORD) || (envVars === null || envVars === void 0 ? void 0 : envVars.POSTGRESQL_PASSWORD);
|
|
1048
|
+
const DB_PASSWORD = (_b = ((envVars === null || envVars === void 0 ? void 0 : envVars.DB_PASSWORD) || (envVars === null || envVars === void 0 ? void 0 : envVars.POSTGRESQL_PASSWORD))) === null || _b === void 0 ? void 0 : _b.toString();
|
|
1049
1049
|
const DB_NAME = cloudSqlValues.cloudsql.fullDbName.toString();
|
|
1050
1050
|
const instanceName = cloudSqlValues.cloudsql.instanceConnectionName;
|
|
1051
1051
|
return {
|
|
@@ -1056,17 +1056,17 @@ const getProxyInfoForKubernetes = async (vorpal, context) => {
|
|
|
1056
1056
|
};
|
|
1057
1057
|
};
|
|
1058
1058
|
const getProxyInfoForCloudRun = async (vorpal, context) => {
|
|
1059
|
-
var _a, _b, _c;
|
|
1059
|
+
var _a, _b, _c, _d, _e;
|
|
1060
1060
|
if (!(0, pipeline_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "google-cloudrun") ||
|
|
1061
1061
|
!((_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.cloudSql)) {
|
|
1062
1062
|
throw new Error("unsupported");
|
|
1063
1063
|
}
|
|
1064
1064
|
const envVars = await (0, getProjectConfig_1.getEnvVarsResolved)(vorpal, context.env, context.name);
|
|
1065
|
-
const DB_PASSWORD = envVars === null || envVars === void 0 ? void 0 : envVars.DB_PASSWORD;
|
|
1066
|
-
const DB_USER = envVars === null || envVars === void 0 ? void 0 : envVars.DB_USER;
|
|
1065
|
+
const DB_PASSWORD = (_c = envVars === null || envVars === void 0 ? void 0 : envVars.DB_PASSWORD) === null || _c === void 0 ? void 0 : _c.toString();
|
|
1066
|
+
const DB_USER = (_d = envVars === null || envVars === void 0 ? void 0 : envVars.DB_USER) === null || _d === void 0 ? void 0 : _d.toString();
|
|
1067
1067
|
const DB_NAME = context.environment.envVars.DB_NAME.toString();
|
|
1068
1068
|
return {
|
|
1069
|
-
instanceName: (
|
|
1069
|
+
instanceName: (_e = context.deploy) === null || _e === void 0 ? void 0 : _e.config.cloudSql.instanceConnectionName,
|
|
1070
1070
|
DB_PASSWORD,
|
|
1071
1071
|
DB_NAME,
|
|
1072
1072
|
DB_USER,
|
|
@@ -3924,7 +3924,7 @@ exports.getShell = getShell;
|
|
|
3924
3924
|
"use strict";
|
|
3925
3925
|
|
|
3926
3926
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3927
|
-
exports.
|
|
3927
|
+
exports.joinBashExpressions = exports.getBashVariable = exports.BashExpression = void 0;
|
|
3928
3928
|
/**
|
|
3929
3929
|
* this class represents a string that can be evaluated in bash scripts.
|
|
3930
3930
|
*
|
|
@@ -3988,21 +3988,143 @@ const joinBashExpressions = (parts, joiner = "") => {
|
|
|
3988
3988
|
}
|
|
3989
3989
|
};
|
|
3990
3990
|
exports.joinBashExpressions = joinBashExpressions;
|
|
3991
|
+
//# sourceMappingURL=BashExpression.js.map
|
|
3992
|
+
|
|
3993
|
+
/***/ }),
|
|
3994
|
+
|
|
3995
|
+
/***/ 12463:
|
|
3996
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
3997
|
+
|
|
3998
|
+
"use strict";
|
|
3999
|
+
|
|
4000
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4001
|
+
exports.escapeForDotEnv = exports.escapeSingleQuotes = exports.escapeDoubleQuotes = exports.escapeBashExpression = exports.escapeString = exports.bashEscape = void 0;
|
|
4002
|
+
const globalScriptFunctions_1 = __nccwpck_require__(12912);
|
|
4003
|
+
const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
|
|
4004
|
+
const BashExpression_1 = __nccwpck_require__(42376);
|
|
3991
4005
|
/**
|
|
3992
4006
|
* escapes a string or bash expression for bash
|
|
3993
|
-
* it
|
|
4007
|
+
* it either can escape single or double quotes (double is default)
|
|
3994
4008
|
*/
|
|
3995
|
-
const bashEscape = (value
|
|
3996
|
-
|
|
3997
|
-
|
|
4009
|
+
const bashEscape = (value, options = {
|
|
4010
|
+
quotes: "double",
|
|
4011
|
+
}) => {
|
|
4012
|
+
if (value instanceof BashExpression_1.BashExpression) {
|
|
4013
|
+
// no need to escape
|
|
4014
|
+
return (0, exports.escapeBashExpression)(value, options);
|
|
3998
4015
|
}
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
return value;
|
|
4016
|
+
if (value instanceof VariableValueContainingReferences_1.VariableValueContainingReferences) {
|
|
4017
|
+
return value.toString(options);
|
|
4018
|
+
}
|
|
4019
|
+
return (0, exports.escapeString)(value, options);
|
|
4003
4020
|
};
|
|
4004
4021
|
exports.bashEscape = bashEscape;
|
|
4005
|
-
|
|
4022
|
+
const escapeString = (value, { quotes } = {
|
|
4023
|
+
quotes: "double",
|
|
4024
|
+
}) => {
|
|
4025
|
+
const quoteEscaped = quotes
|
|
4026
|
+
? quotes === "single"
|
|
4027
|
+
? (0, exports.escapeSingleQuotes)(value)
|
|
4028
|
+
: (0, exports.escapeDoubleQuotes)(value)
|
|
4029
|
+
: value;
|
|
4030
|
+
return quoteEscaped;
|
|
4031
|
+
};
|
|
4032
|
+
exports.escapeString = escapeString;
|
|
4033
|
+
const escapeBashExpression = (value, options) => {
|
|
4034
|
+
// no need to escape, we just return the string
|
|
4035
|
+
return value;
|
|
4036
|
+
};
|
|
4037
|
+
exports.escapeBashExpression = escapeBashExpression;
|
|
4038
|
+
const escapeDoubleQuotes = (value) => value === null || value === void 0 ? void 0 : value.toString().replace(/"/g, '\\"');
|
|
4039
|
+
exports.escapeDoubleQuotes = escapeDoubleQuotes;
|
|
4040
|
+
const escapeSingleQuotes = (value) => value === null || value === void 0 ? void 0 : value.toString().replace(/'/g, "\\'");
|
|
4041
|
+
exports.escapeSingleQuotes = escapeSingleQuotes;
|
|
4042
|
+
/**
|
|
4043
|
+
*
|
|
4044
|
+
* what an absolute nightmare.
|
|
4045
|
+
* unfortunatly, dotenv has many limitations. You can't escape quotes properly.
|
|
4046
|
+
*
|
|
4047
|
+
* In order to be very forgiving, we need to do some magic here:
|
|
4048
|
+
*
|
|
4049
|
+
* - when the value contains no newlines, we are fine
|
|
4050
|
+
* - if the value contains newlines, we need to wrap it in quotes. And thats where the problem begins:
|
|
4051
|
+
* - you can't escape quotes. this is a shitty limitation of dotenv and node
|
|
4052
|
+
* - you can have inner quotes, but they break in node.js (not in dotenv though), see https://github.com/nodejs/node/issues/54134
|
|
4053
|
+
* - so we need to quote cleverly
|
|
4054
|
+
* - to make things worse, we need to check whether we have a simple stirng or a bash expression, that needs to be evalulated first...
|
|
4055
|
+
*/
|
|
4056
|
+
const escapeForDotEnv = (value) => {
|
|
4057
|
+
if (value === undefined || value === null) {
|
|
4058
|
+
return "";
|
|
4059
|
+
}
|
|
4060
|
+
if (typeof value === "string") {
|
|
4061
|
+
// if string contains newlines, we need to wrap it in quotes
|
|
4062
|
+
// we additionaly escape newlines, that give best compatibility
|
|
4063
|
+
if (value.includes("\n")) {
|
|
4064
|
+
const newlinesReplaces = value.replace(/\n/g, "\\n");
|
|
4065
|
+
// default to ", but if this is not possible, we try to use ' or `
|
|
4066
|
+
const quote = value.includes(`"`)
|
|
4067
|
+
? value.includes(`'`)
|
|
4068
|
+
? value.includes("`")
|
|
4069
|
+
? // If all quote types are present, default to no
|
|
4070
|
+
""
|
|
4071
|
+
: "`"
|
|
4072
|
+
: "'"
|
|
4073
|
+
: '"';
|
|
4074
|
+
// if we found a quote, we can wrap the string in it
|
|
4075
|
+
return `${quote}${newlinesReplaces}${quote}`;
|
|
4076
|
+
}
|
|
4077
|
+
else {
|
|
4078
|
+
// otherwise we can return as is
|
|
4079
|
+
return value;
|
|
4080
|
+
}
|
|
4081
|
+
}
|
|
4082
|
+
else if (value instanceof BashExpression_1.BashExpression) {
|
|
4083
|
+
return escapeBashExpressionForDotEnv(value);
|
|
4084
|
+
}
|
|
4085
|
+
else if (value instanceof VariableValueContainingReferences_1.VariableValueContainingReferences) {
|
|
4086
|
+
// instead of doing it part-wise, we just do it all at once
|
|
4087
|
+
const containsAnyBashExpression = value.parts.some((part) => part instanceof BashExpression_1.BashExpression);
|
|
4088
|
+
if (!containsAnyBashExpression) {
|
|
4089
|
+
return (0, exports.escapeForDotEnv)(value.toString({
|
|
4090
|
+
quotes: "double",
|
|
4091
|
+
}));
|
|
4092
|
+
}
|
|
4093
|
+
else {
|
|
4094
|
+
const result = escapeBashExpressionForDotEnv(new BashExpression_1.BashExpression(value.toString({
|
|
4095
|
+
quotes: "double",
|
|
4096
|
+
})));
|
|
4097
|
+
return result;
|
|
4098
|
+
}
|
|
4099
|
+
}
|
|
4100
|
+
else {
|
|
4101
|
+
return value;
|
|
4102
|
+
}
|
|
4103
|
+
};
|
|
4104
|
+
exports.escapeForDotEnv = escapeForDotEnv;
|
|
4105
|
+
// basically the same thing as above for bash
|
|
4106
|
+
// thx chatgpt for this
|
|
4107
|
+
const escapeForDotEnvScript = (0, globalScriptFunctions_1.registerGlobalScriptFunction)("escapeForDotEnv", `
|
|
4108
|
+
input="\${1:-$(cat)}"
|
|
4109
|
+
input="\${input//$'\\n'/\\\\n}"
|
|
4110
|
+
if [[ "$input" == *\\\\n* ]]; then
|
|
4111
|
+
if [[ "$input" == *\\"* && "$input" == *\\'* && "$input" == *\\\`* ]]; then
|
|
4112
|
+
printf "%s\\n" "$input"
|
|
4113
|
+
elif [[ "$input" == *\\"* && "$input" == *\\'* ]]; then
|
|
4114
|
+
printf "\`%s\`\\n" "$input"
|
|
4115
|
+
elif [[ "$input" == *\\"* ]]; then
|
|
4116
|
+
printf "'%s'\\n" "$input"
|
|
4117
|
+
else
|
|
4118
|
+
printf "\\"%s\\"\\n" "$input"
|
|
4119
|
+
fi
|
|
4120
|
+
else
|
|
4121
|
+
printf "%s\\n" "$input"
|
|
4122
|
+
fi
|
|
4123
|
+
`);
|
|
4124
|
+
const escapeBashExpressionForDotEnv = (value) => {
|
|
4125
|
+
return value.transformWithCommand(escapeForDotEnvScript.name).toString();
|
|
4126
|
+
};
|
|
4127
|
+
//# sourceMappingURL=bashEscape.js.map
|
|
4006
4128
|
|
|
4007
4129
|
/***/ }),
|
|
4008
4130
|
|
|
@@ -4032,6 +4154,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
4032
4154
|
exports.writeBashYamlToFileScript = exports.yamlBashString = void 0;
|
|
4033
4155
|
const yaml_1 = __nccwpck_require__(68033);
|
|
4034
4156
|
const BashExpression_1 = __nccwpck_require__(42376);
|
|
4157
|
+
const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
|
|
4035
4158
|
const bashExpressionType = {
|
|
4036
4159
|
tag: "",
|
|
4037
4160
|
resolve: (str) => {
|
|
@@ -4042,10 +4165,33 @@ const bashExpressionType = {
|
|
|
4042
4165
|
// we create a BLOCK_LITERAL
|
|
4043
4166
|
// but because bash will interpret the value, it may resolve to a multiline string
|
|
4044
4167
|
// so we need to indent every line using sed
|
|
4045
|
-
return "|-\n" +
|
|
4168
|
+
return ("|-\n" +
|
|
4169
|
+
ctx.indent +
|
|
4170
|
+
indentNewlinesInBashExpression(node.value, ctx.indent));
|
|
4046
4171
|
},
|
|
4047
4172
|
identify: (v) => v instanceof BashExpression_1.BashExpression,
|
|
4048
4173
|
};
|
|
4174
|
+
const indentNewlinesInBashExpression = (expression, indent) => {
|
|
4175
|
+
return expression.transformWithCommand(`sed '1!s/^/${indent}/'`);
|
|
4176
|
+
};
|
|
4177
|
+
const variableContainingReferences = {
|
|
4178
|
+
tag: "",
|
|
4179
|
+
resolve: (str) => {
|
|
4180
|
+
// not really needed,but let's make typescript happy
|
|
4181
|
+
return new VariableValueContainingReferences_1.VariableValueContainingReferences(str);
|
|
4182
|
+
},
|
|
4183
|
+
stringify(node, ctx) {
|
|
4184
|
+
const value = node.value;
|
|
4185
|
+
const stringified = value.parts
|
|
4186
|
+
.map((part) => part instanceof BashExpression_1.BashExpression
|
|
4187
|
+
? indentNewlinesInBashExpression(part, ctx.indent)
|
|
4188
|
+
: // indent every new line
|
|
4189
|
+
part.toString().replace(/\n/g, `\n${ctx.indent}`))
|
|
4190
|
+
.join("");
|
|
4191
|
+
return "|-\n" + ctx.indent + stringified;
|
|
4192
|
+
},
|
|
4193
|
+
identify: (v) => v instanceof VariableValueContainingReferences_1.VariableValueContainingReferences,
|
|
4194
|
+
};
|
|
4049
4195
|
/***
|
|
4050
4196
|
* creates a yaml string that can be used in bash scripts
|
|
4051
4197
|
* it handles BashExpressions correctly so that they can be evaluated in bash
|
|
@@ -4054,7 +4200,7 @@ const yamlBashString = (value) => {
|
|
|
4054
4200
|
return (0, yaml_1.stringify)(value, {
|
|
4055
4201
|
defaultStringType: "BLOCK_LITERAL",
|
|
4056
4202
|
defaultKeyType: "PLAIN",
|
|
4057
|
-
customTags: [bashExpressionType],
|
|
4203
|
+
customTags: [bashExpressionType, variableContainingReferences],
|
|
4058
4204
|
aliasDuplicateObjects: false,
|
|
4059
4205
|
lineWidth: 0,
|
|
4060
4206
|
});
|
|
@@ -4085,61 +4231,47 @@ exports.writeBashYamlToFileScript = writeBashYamlToFileScript;
|
|
|
4085
4231
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4086
4232
|
exports.getInjectVarsScript = void 0;
|
|
4087
4233
|
const lodash_1 = __nccwpck_require__(23255);
|
|
4088
|
-
const
|
|
4234
|
+
const bashEscape_1 = __nccwpck_require__(12463);
|
|
4089
4235
|
const getInjectVarsScript = (vars) => {
|
|
4090
4236
|
if (!vars)
|
|
4091
4237
|
return [];
|
|
4092
4238
|
// filter out null and undefined values
|
|
4093
4239
|
return Object.entries(vars)
|
|
4094
4240
|
.filter(([, value]) => !(0, lodash_1.isNil)(value))
|
|
4095
|
-
.map(([key, value]) => `export ${key}="${value
|
|
4241
|
+
.map(([key, value]) => `export ${key}="${value
|
|
4242
|
+
? (0, bashEscape_1.bashEscape)(value, {
|
|
4243
|
+
quotes: "double",
|
|
4244
|
+
})
|
|
4245
|
+
: ""}"`);
|
|
4096
4246
|
};
|
|
4097
4247
|
exports.getInjectVarsScript = getInjectVarsScript;
|
|
4098
4248
|
//# sourceMappingURL=getInjectVarsScript.js.map
|
|
4099
4249
|
|
|
4100
4250
|
/***/ }),
|
|
4101
4251
|
|
|
4102
|
-
/***/
|
|
4103
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__)
|
|
4252
|
+
/***/ 22990:
|
|
4253
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
4104
4254
|
|
|
4105
4255
|
"use strict";
|
|
4106
4256
|
|
|
4107
|
-
Object.
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
const wasBashExpression = string instanceof BashExpression_1.BashExpression;
|
|
4113
|
-
try {
|
|
4114
|
-
// 1. Run fake pass of `replace`, collect values from `replacer` calls
|
|
4115
|
-
// 2. Resolve them with `Promise.all`
|
|
4116
|
-
// 3. Run `replace` with resolved values
|
|
4117
|
-
const values = [];
|
|
4118
|
-
String.prototype.replace.call(string instanceof BashExpression_1.BashExpression ? string : (0, BashExpression_1.bashEscape)(string), searchValue, function (...args) {
|
|
4119
|
-
// eslint-disable-next-line prefer-spread
|
|
4120
|
-
const result = replacer.apply(undefined, args);
|
|
4121
|
-
values.push(result);
|
|
4122
|
-
return "";
|
|
4123
|
-
});
|
|
4124
|
-
const resolvedValues = await Promise.all(values);
|
|
4125
|
-
const containsBashExpression = resolvedValues.some((value) => value instanceof BashExpression_1.BashExpression);
|
|
4126
|
-
const result = (string instanceof BashExpression_1.BashExpression ? string : (0, BashExpression_1.bashEscape)(string)).replace(searchValue, function () {
|
|
4127
|
-
var _a, _b;
|
|
4128
|
-
return (_b = (_a = resolvedValues.shift()) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "";
|
|
4129
|
-
});
|
|
4130
|
-
if (wasBashExpression || containsBashExpression) {
|
|
4131
|
-
return new BashExpression_1.BashExpression(result);
|
|
4132
|
-
}
|
|
4133
|
-
else {
|
|
4134
|
-
return result;
|
|
4135
|
-
}
|
|
4136
|
-
}
|
|
4137
|
-
catch (error) {
|
|
4138
|
-
return Promise.reject(error);
|
|
4257
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4258
|
+
if (k2 === undefined) k2 = k;
|
|
4259
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4260
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
4261
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
4139
4262
|
}
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4263
|
+
Object.defineProperty(o, k2, desc);
|
|
4264
|
+
}) : (function(o, m, k, k2) {
|
|
4265
|
+
if (k2 === undefined) k2 = k;
|
|
4266
|
+
o[k2] = m[k];
|
|
4267
|
+
}));
|
|
4268
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
4269
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
4270
|
+
};
|
|
4271
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4272
|
+
__exportStar(__nccwpck_require__(12463), exports);
|
|
4273
|
+
__exportStar(__nccwpck_require__(42376), exports);
|
|
4274
|
+
//# sourceMappingURL=index.js.map
|
|
4143
4275
|
|
|
4144
4276
|
/***/ }),
|
|
4145
4277
|
|
|
@@ -4433,8 +4565,9 @@ exports.writeBuildInfo = writeBuildInfo;
|
|
|
4433
4565
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4434
4566
|
exports.componentContextNeedsBuildTimeDotEnv = exports.writeDotEnv = void 0;
|
|
4435
4567
|
const lodash_1 = __nccwpck_require__(23255);
|
|
4436
|
-
const
|
|
4568
|
+
const bashEscape_1 = __nccwpck_require__(12463);
|
|
4437
4569
|
const getBuildInfoVariables_1 = __nccwpck_require__(17827);
|
|
4570
|
+
const gitlab_1 = __nccwpck_require__(38490);
|
|
4438
4571
|
/**
|
|
4439
4572
|
* writes a .env file in the components folder
|
|
4440
4573
|
* @param context
|
|
@@ -4449,9 +4582,9 @@ const writeDotEnv = (context) => {
|
|
|
4449
4582
|
// filter out build variables, since they may interfer with caching like turbo
|
|
4450
4583
|
// build variables are rarely used anyway and we may treat them differently in the future
|
|
4451
4584
|
.filter(([key]) => !getBuildInfoVariables_1.ALL_BUILD_VARIABLES.includes(key))
|
|
4452
|
-
.map(([key, value]) => `${key}=${
|
|
4585
|
+
.map(([key, value]) => `${key}=${(0, bashEscape_1.escapeForDotEnv)(value)}`)
|
|
4453
4586
|
.join("\n");
|
|
4454
|
-
return (0, gitlab_1.collapseableSection)("write-dotenv-" + context.name, "write dot env")([
|
|
4587
|
+
return (0, gitlab_1.collapseableSection)("write-dotenv-" + context.name, "write dot env for " + context.name)([
|
|
4455
4588
|
`cat <<EOF > ${context.build.dir}/.env
|
|
4456
4589
|
${keyValueString}
|
|
4457
4590
|
EOF`,
|
|
@@ -6078,9 +6211,10 @@ exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvir
|
|
|
6078
6211
|
const deploy_1 = __nccwpck_require__(68483);
|
|
6079
6212
|
const BashExpression_1 = __nccwpck_require__(42376);
|
|
6080
6213
|
const types_1 = __nccwpck_require__(84466);
|
|
6214
|
+
const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
|
|
6215
|
+
const resolveAllReferences_1 = __nccwpck_require__(16305);
|
|
6081
6216
|
const getBuildInfoVariables_1 = __nccwpck_require__(17827);
|
|
6082
6217
|
const getEnvironmentContext_1 = __nccwpck_require__(13663);
|
|
6083
|
-
const resolveReferences_1 = __nccwpck_require__(43115);
|
|
6084
6218
|
const transformJobOnlyVars_1 = __nccwpck_require__(1552);
|
|
6085
6219
|
const envVars_1 = __nccwpck_require__(16296);
|
|
6086
6220
|
const getBasePredefinedVariables = (ctx) => {
|
|
@@ -6091,8 +6225,8 @@ const getBasePredefinedVariables = (ctx) => {
|
|
|
6091
6225
|
...(ctx.envType !== "local" ? (0, getBuildInfoVariables_1.getBuildInfoVariables)(ctx) : {}),
|
|
6092
6226
|
};
|
|
6093
6227
|
};
|
|
6094
|
-
const getEnvironmentVariables = async (ctx,
|
|
6095
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
6228
|
+
const getEnvironmentVariables = async (ctx, options = {}) => {
|
|
6229
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6096
6230
|
const environmentContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
|
|
6097
6231
|
const { config, env, componentName } = ctx;
|
|
6098
6232
|
const { envConfigRaw, deployConfigRaw, buildConfigRaw, envType } = environmentContext;
|
|
@@ -6145,18 +6279,28 @@ const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
|
|
|
6145
6279
|
];
|
|
6146
6280
|
const secretEnvVars = (0, envVars_1.makeSecretEnvVarMapping)(env, componentName, secretEnvVarKeys);
|
|
6147
6281
|
const publicEnvVarsRawSanitized = (0, envVars_1.stringifyValues)(publicEnvVarsRaw);
|
|
6148
|
-
const
|
|
6282
|
+
const publicEnvVarsUnresolved = Object.fromEntries(Object.entries(publicEnvVarsRawSanitized).map(([key, value]) => [
|
|
6283
|
+
key,
|
|
6284
|
+
(0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)(value, {
|
|
6285
|
+
componentName: ctx.componentName,
|
|
6286
|
+
}),
|
|
6287
|
+
]));
|
|
6288
|
+
const publicEnvVars = ((_h = options.shouldResolveReferences) !== null && _h !== void 0 ? _h : true)
|
|
6289
|
+
? await (0, resolveAllReferences_1.resolveAllReferences)(publicEnvVarsUnresolved, async (otherComponentName) => {
|
|
6290
|
+
const { envVars: otherEnvVars } = await (0, exports.getEnvironmentVariables)({
|
|
6291
|
+
...ctx,
|
|
6292
|
+
componentName: otherComponentName,
|
|
6293
|
+
}, {
|
|
6294
|
+
shouldResolveReferences: false, // we already do this here with replaceAllReferences recursivly until re replaced all
|
|
6295
|
+
});
|
|
6296
|
+
return otherEnvVars;
|
|
6297
|
+
})
|
|
6298
|
+
: publicEnvVarsUnresolved;
|
|
6299
|
+
const envVars = addIndexVar({
|
|
6149
6300
|
...predefinedVariables,
|
|
6150
6301
|
...secretEnvVars,
|
|
6151
|
-
...
|
|
6302
|
+
...publicEnvVars,
|
|
6152
6303
|
});
|
|
6153
|
-
const envVars = (await (0, resolveReferences_1.resolveReferences)(envVarsRaw, async (otherComponentName, alreadyVisited) => {
|
|
6154
|
-
const { envVars: otherEnvVars } = await (0, exports.getEnvironmentVariables)({
|
|
6155
|
-
...ctx,
|
|
6156
|
-
componentName: otherComponentName,
|
|
6157
|
-
}, alreadyVisited);
|
|
6158
|
-
return otherEnvVars;
|
|
6159
|
-
}, alreadyVisited));
|
|
6160
6304
|
return {
|
|
6161
6305
|
envVars,
|
|
6162
6306
|
secretEnvVarKeys,
|
|
@@ -6274,69 +6418,6 @@ __exportStar(__nccwpck_require__(45133), exports);
|
|
|
6274
6418
|
|
|
6275
6419
|
/***/ }),
|
|
6276
6420
|
|
|
6277
|
-
/***/ 43115:
|
|
6278
|
-
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
6279
|
-
|
|
6280
|
-
"use strict";
|
|
6281
|
-
|
|
6282
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6283
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6284
|
-
};
|
|
6285
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6286
|
-
exports.resolveReferences = void 0;
|
|
6287
|
-
const lodash_1 = __nccwpck_require__(23255);
|
|
6288
|
-
const replaceAsync_1 = __importDefault(__nccwpck_require__(72233));
|
|
6289
|
-
// regex to resolve references in catladder variables
|
|
6290
|
-
// those expressions have the pattern ${componentName:variableName}
|
|
6291
|
-
const REGEX = /\$\{(([^:}]+):)?([^}]+)}/gm;
|
|
6292
|
-
const resolveReferences = async (vars, getOtherVariables, alreadyVisitedBase = {}) => {
|
|
6293
|
-
/**
|
|
6294
|
-
*
|
|
6295
|
-
* replace referenced variables with their values in a value string
|
|
6296
|
-
*/
|
|
6297
|
-
const replaceSingleValue = async (value, alreadyVisited = alreadyVisitedBase) => {
|
|
6298
|
-
if (REGEX.test(value.toString())) {
|
|
6299
|
-
// we consider variables that got references in it BashExpressions, because the replacement may be one
|
|
6300
|
-
return await (0, replaceAsync_1.default)(value, REGEX, async (match, _, componentName, variableName) => {
|
|
6301
|
-
var _a, _b;
|
|
6302
|
-
if ((_a = alreadyVisited[componentName]) === null || _a === void 0 ? void 0 : _a[variableName]) {
|
|
6303
|
-
return match; // prevent endless loop
|
|
6304
|
-
}
|
|
6305
|
-
const newAlreadyVisited = (0, lodash_1.merge)({}, alreadyVisited, {
|
|
6306
|
-
[componentName]: {
|
|
6307
|
-
[variableName]: true,
|
|
6308
|
-
},
|
|
6309
|
-
});
|
|
6310
|
-
const result = componentName
|
|
6311
|
-
? (_b = (await (getOtherVariables === null || getOtherVariables === void 0 ? void 0 : getOtherVariables(componentName, newAlreadyVisited).then((r) => r === null || r === void 0 ? void 0 : r[variableName])))) !== null && _b !== void 0 ? _b : null
|
|
6312
|
-
: vars[variableName]; // is self reference
|
|
6313
|
-
const replaced = result !== null && result !== undefined
|
|
6314
|
-
? await replaceSingleValue(result, newAlreadyVisited)
|
|
6315
|
-
: match;
|
|
6316
|
-
return replaced;
|
|
6317
|
-
});
|
|
6318
|
-
}
|
|
6319
|
-
else {
|
|
6320
|
-
return value;
|
|
6321
|
-
}
|
|
6322
|
-
};
|
|
6323
|
-
return Object.fromEntries(await Promise.all(Object.entries(vars).map(async ([key, value]) => {
|
|
6324
|
-
if (value === null || value === undefined) {
|
|
6325
|
-
return [key, null];
|
|
6326
|
-
}
|
|
6327
|
-
return [
|
|
6328
|
-
key,
|
|
6329
|
-
value !== null && value !== undefined
|
|
6330
|
-
? await replaceSingleValue(value)
|
|
6331
|
-
: null,
|
|
6332
|
-
];
|
|
6333
|
-
})));
|
|
6334
|
-
};
|
|
6335
|
-
exports.resolveReferences = resolveReferences;
|
|
6336
|
-
//# sourceMappingURL=resolveReferences.js.map
|
|
6337
|
-
|
|
6338
|
-
/***/ }),
|
|
6339
|
-
|
|
6340
6421
|
/***/ 1552:
|
|
6341
6422
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
6342
6423
|
|
|
@@ -7173,15 +7254,15 @@ exports.getCloudRunDeployScripts = void 0;
|
|
|
7173
7254
|
const lodash_1 = __nccwpck_require__(23255);
|
|
7174
7255
|
const gitlab_1 = __nccwpck_require__(38490);
|
|
7175
7256
|
const sbom_1 = __nccwpck_require__(44986);
|
|
7257
|
+
const __1 = __nccwpck_require__(2674);
|
|
7258
|
+
const bashYaml_1 = __nccwpck_require__(54660);
|
|
7176
7259
|
const cleanup_1 = __nccwpck_require__(67888);
|
|
7177
7260
|
const database_1 = __nccwpck_require__(28206);
|
|
7178
7261
|
const gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(46320);
|
|
7179
7262
|
const cloudRunJobs_1 = __nccwpck_require__(61224);
|
|
7180
7263
|
const cloudRunServices_1 = __nccwpck_require__(17334);
|
|
7181
7264
|
const common_1 = __nccwpck_require__(73325);
|
|
7182
|
-
const __1 = __nccwpck_require__(2674);
|
|
7183
7265
|
const constants_1 = __nccwpck_require__(38865);
|
|
7184
|
-
const bashYaml_1 = __nccwpck_require__(54660);
|
|
7185
7266
|
function getCloudRunDeployScripts(context) {
|
|
7186
7267
|
var _a;
|
|
7187
7268
|
const deployConfig = (0, common_1.getCloudRunDeployConfig)(context);
|
|
@@ -8391,7 +8472,7 @@ exports.contextIsStoppable = contextIsStoppable;
|
|
|
8391
8472
|
"use strict";
|
|
8392
8473
|
|
|
8393
8474
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
8394
|
-
exports.
|
|
8475
|
+
exports.registerGlobalScriptFunction = exports.globalScriptFunctions = void 0;
|
|
8395
8476
|
class GlobalScriptFunction {
|
|
8396
8477
|
constructor(name, script) {
|
|
8397
8478
|
this.name = name;
|
|
@@ -8399,20 +8480,27 @@ class GlobalScriptFunction {
|
|
|
8399
8480
|
}
|
|
8400
8481
|
toBashFunction() {
|
|
8401
8482
|
return `function ${this.name} () {
|
|
8402
|
-
|
|
8403
|
-
|
|
8483
|
+
${this.script.trim()}
|
|
8484
|
+
}`.trim();
|
|
8404
8485
|
}
|
|
8405
8486
|
invoke(...args) {
|
|
8406
8487
|
return `${this.name} ${args.join(" ")}`;
|
|
8407
8488
|
}
|
|
8408
8489
|
}
|
|
8409
|
-
exports.
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8490
|
+
exports.globalScriptFunctions = new Map();
|
|
8491
|
+
/**
|
|
8492
|
+
* registers a global script function
|
|
8493
|
+
* only use that in top-level scopes as it will attach the function to the global scope
|
|
8494
|
+
*/
|
|
8495
|
+
const registerGlobalScriptFunction = (name, script) => {
|
|
8496
|
+
if (exports.globalScriptFunctions.has(name)) {
|
|
8497
|
+
throw new Error(`Global script function ${name} already exists`);
|
|
8498
|
+
}
|
|
8499
|
+
const scriptFunction = new GlobalScriptFunction(name, script);
|
|
8500
|
+
exports.globalScriptFunctions.set(name, scriptFunction);
|
|
8501
|
+
return scriptFunction;
|
|
8502
|
+
};
|
|
8503
|
+
exports.registerGlobalScriptFunction = registerGlobalScriptFunction;
|
|
8416
8504
|
//# sourceMappingURL=index.js.map
|
|
8417
8505
|
|
|
8418
8506
|
/***/ }),
|
|
@@ -8446,6 +8534,8 @@ __exportStar(__nccwpck_require__(5875), exports);
|
|
|
8446
8534
|
__exportStar(__nccwpck_require__(67862), exports);
|
|
8447
8535
|
__exportStar(__nccwpck_require__(68483), exports);
|
|
8448
8536
|
__exportStar(__nccwpck_require__(92228), exports);
|
|
8537
|
+
__exportStar(__nccwpck_require__(51619), exports);
|
|
8538
|
+
__exportStar(__nccwpck_require__(22990), exports);
|
|
8449
8539
|
//# sourceMappingURL=index.js.map
|
|
8450
8540
|
|
|
8451
8541
|
/***/ }),
|
|
@@ -9036,37 +9126,14 @@ function getGitlabNeedsForWorkspaceJob(context, { needsStages, needs }, allJobs)
|
|
|
9036
9126
|
/***/ }),
|
|
9037
9127
|
|
|
9038
9128
|
/***/ 66551:
|
|
9039
|
-
/***/ (
|
|
9129
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
9040
9130
|
|
|
9041
9131
|
"use strict";
|
|
9042
9132
|
|
|
9043
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9044
|
-
if (k2 === undefined) k2 = k;
|
|
9045
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9046
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9047
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9048
|
-
}
|
|
9049
|
-
Object.defineProperty(o, k2, desc);
|
|
9050
|
-
}) : (function(o, m, k, k2) {
|
|
9051
|
-
if (k2 === undefined) k2 = k;
|
|
9052
|
-
o[k2] = m[k];
|
|
9053
|
-
}));
|
|
9054
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
9055
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
9056
|
-
}) : function(o, v) {
|
|
9057
|
-
o["default"] = v;
|
|
9058
|
-
});
|
|
9059
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
9060
|
-
if (mod && mod.__esModule) return mod;
|
|
9061
|
-
var result = {};
|
|
9062
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
9063
|
-
__setModuleDefault(result, mod);
|
|
9064
|
-
return result;
|
|
9065
|
-
};
|
|
9066
9133
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9067
9134
|
exports.createGitlabPipelineWithDefaults = void 0;
|
|
9068
9135
|
const runner_1 = __nccwpck_require__(4058);
|
|
9069
|
-
const
|
|
9136
|
+
const globalScriptFunctions_1 = __nccwpck_require__(12912);
|
|
9070
9137
|
const createGitlabPipelineWithDefaults = ({ image, variables, before_script, ...config }) => {
|
|
9071
9138
|
return {
|
|
9072
9139
|
image: image !== null && image !== void 0 ? image : (0, runner_1.getRunnerImage)("jobs-default"), // default image
|
|
@@ -9079,7 +9146,7 @@ const createGitlabPipelineWithDefaults = ({ image, variables, before_script, ...
|
|
|
9079
9146
|
...(variables !== null && variables !== void 0 ? variables : {}),
|
|
9080
9147
|
},
|
|
9081
9148
|
before_script: [
|
|
9082
|
-
...
|
|
9149
|
+
...[...globalScriptFunctions_1.globalScriptFunctions.values()].map((script) => script.toBashFunction()),
|
|
9083
9150
|
...(before_script !== null && before_script !== void 0 ? before_script : []),
|
|
9084
9151
|
],
|
|
9085
9152
|
...config,
|
|
@@ -9639,11 +9706,18 @@ const repeatOnFailure = (command, options) => {
|
|
|
9639
9706
|
`;
|
|
9640
9707
|
};
|
|
9641
9708
|
exports.repeatOnFailure = repeatOnFailure;
|
|
9709
|
+
const start = (0, globalScriptFunctions_1.registerGlobalScriptFunction)("collapseable_section_start", `local section_title="\${1}"
|
|
9710
|
+
local section_description="\${2:-$section_title}"
|
|
9711
|
+
echo -e "section_start:\`date +%s\`:\${section_title}[collapsed=true]\\r\\e[0K$\{section_description}"
|
|
9712
|
+
`);
|
|
9713
|
+
const end = (0, globalScriptFunctions_1.registerGlobalScriptFunction)("collapseable_section_end", `local section_title="\${1}"
|
|
9714
|
+
echo -e "section_end:\`date +%s\`:\${section_title}\\r\\e[0K"
|
|
9715
|
+
`);
|
|
9642
9716
|
const collapseableSection = (name, header) => (commands) => {
|
|
9643
9717
|
return [
|
|
9644
|
-
|
|
9718
|
+
start.invoke(`"${name}"`, `"${header}"`),
|
|
9645
9719
|
...commands,
|
|
9646
|
-
|
|
9720
|
+
end.invoke(`"${name}"`),
|
|
9647
9721
|
];
|
|
9648
9722
|
};
|
|
9649
9723
|
exports.collapseableSection = collapseableSection;
|
|
@@ -9758,6 +9832,182 @@ exports.writeYamlfile = writeYamlfile;
|
|
|
9758
9832
|
|
|
9759
9833
|
/***/ }),
|
|
9760
9834
|
|
|
9835
|
+
/***/ 51619:
|
|
9836
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
9837
|
+
|
|
9838
|
+
"use strict";
|
|
9839
|
+
|
|
9840
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9841
|
+
//# sourceMappingURL=VariableValue.js.map
|
|
9842
|
+
|
|
9843
|
+
/***/ }),
|
|
9844
|
+
|
|
9845
|
+
/***/ 84474:
|
|
9846
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
9847
|
+
|
|
9848
|
+
"use strict";
|
|
9849
|
+
|
|
9850
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9851
|
+
exports.createVariableValueContainingReferencesFromString = exports.VariableValueContainingReferences = exports.VariableReference = exports.UnresolvableReference = void 0;
|
|
9852
|
+
const BashExpression_1 = __nccwpck_require__(42376);
|
|
9853
|
+
const bashEscape_1 = __nccwpck_require__(12463);
|
|
9854
|
+
class UnresolvableReference {
|
|
9855
|
+
constructor(reference) {
|
|
9856
|
+
this.reference = reference;
|
|
9857
|
+
}
|
|
9858
|
+
toString() {
|
|
9859
|
+
return `Unresolvable reference: ${this.reference.toString()}`;
|
|
9860
|
+
}
|
|
9861
|
+
}
|
|
9862
|
+
exports.UnresolvableReference = UnresolvableReference;
|
|
9863
|
+
class VariableReference {
|
|
9864
|
+
constructor(componentName, variableName) {
|
|
9865
|
+
this.componentName = componentName;
|
|
9866
|
+
this.variableName = variableName;
|
|
9867
|
+
}
|
|
9868
|
+
toString() {
|
|
9869
|
+
return `\${${this.componentName}:${this.variableName}}`;
|
|
9870
|
+
}
|
|
9871
|
+
}
|
|
9872
|
+
exports.VariableReference = VariableReference;
|
|
9873
|
+
class VariableValueContainingReferences {
|
|
9874
|
+
constructor(parts) {
|
|
9875
|
+
this.parts = (Array.isArray(parts) ? parts : [parts]).flatMap((part) => part instanceof VariableValueContainingReferences
|
|
9876
|
+
? part.parts
|
|
9877
|
+
: part === ""
|
|
9878
|
+
? []
|
|
9879
|
+
: [part]);
|
|
9880
|
+
}
|
|
9881
|
+
toString(options = {
|
|
9882
|
+
quotes: false,
|
|
9883
|
+
}) {
|
|
9884
|
+
return this.parts
|
|
9885
|
+
.map((part) => {
|
|
9886
|
+
if (typeof part === "string") {
|
|
9887
|
+
return (0, bashEscape_1.escapeString)(part, options);
|
|
9888
|
+
}
|
|
9889
|
+
else if (part instanceof BashExpression_1.BashExpression) {
|
|
9890
|
+
return (0, bashEscape_1.escapeBashExpression)(part, options);
|
|
9891
|
+
}
|
|
9892
|
+
else {
|
|
9893
|
+
return part.toString();
|
|
9894
|
+
}
|
|
9895
|
+
})
|
|
9896
|
+
.join("");
|
|
9897
|
+
}
|
|
9898
|
+
}
|
|
9899
|
+
exports.VariableValueContainingReferences = VariableValueContainingReferences;
|
|
9900
|
+
// regex to resolve references in catladder variables
|
|
9901
|
+
// those expressions have the pattern ${componentName:variableName}
|
|
9902
|
+
const REGEX = /\$\{(([^:}]+):)?([^}]+)}/gm;
|
|
9903
|
+
const createVariableValueContainingReferencesFromString = (value, options) => {
|
|
9904
|
+
const parts = [];
|
|
9905
|
+
let match;
|
|
9906
|
+
let lastIndex = 0;
|
|
9907
|
+
while ((match = REGEX.exec(value)) !== null) {
|
|
9908
|
+
const [fullMatch, _, otherComponentName, variableName] = match;
|
|
9909
|
+
parts.push(value.slice(lastIndex, match.index));
|
|
9910
|
+
parts.push(new VariableReference(otherComponentName || options.componentName, variableName));
|
|
9911
|
+
lastIndex = REGEX.lastIndex;
|
|
9912
|
+
}
|
|
9913
|
+
parts.push(value.slice(lastIndex));
|
|
9914
|
+
return new VariableValueContainingReferences(parts);
|
|
9915
|
+
};
|
|
9916
|
+
exports.createVariableValueContainingReferencesFromString = createVariableValueContainingReferencesFromString;
|
|
9917
|
+
//# sourceMappingURL=VariableValueContainingReferences.js.map
|
|
9918
|
+
|
|
9919
|
+
/***/ }),
|
|
9920
|
+
|
|
9921
|
+
/***/ 16305:
|
|
9922
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
9923
|
+
|
|
9924
|
+
"use strict";
|
|
9925
|
+
|
|
9926
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9927
|
+
exports.resolveAllReferences = void 0;
|
|
9928
|
+
const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
|
|
9929
|
+
const resolveAllReferencesOnce_1 = __nccwpck_require__(89554);
|
|
9930
|
+
const resolveAllReferences = async (values, getEnvVars) => {
|
|
9931
|
+
// replace until there aren't any references left
|
|
9932
|
+
let result = values;
|
|
9933
|
+
let i = 0;
|
|
9934
|
+
while (Object.values(result).some((value) => value.parts.some((part) => part instanceof VariableValueContainingReferences_1.VariableReference))) {
|
|
9935
|
+
const replaced = await (0, resolveAllReferencesOnce_1.resolveAllReferencesOnce)(result, getEnvVars);
|
|
9936
|
+
result = replaced;
|
|
9937
|
+
i++;
|
|
9938
|
+
if (i > 1000) {
|
|
9939
|
+
const unresolved = Object.entries(result).filter(([key, value]) => value.parts.some((part) => part instanceof VariableValueContainingReferences_1.VariableReference));
|
|
9940
|
+
throw new Error("Infinite loop detected in these variables: " +
|
|
9941
|
+
unresolved
|
|
9942
|
+
.map(([key, value]) => `${key} (last reference: ${value.parts.find((part) => part instanceof VariableValueContainingReferences_1.VariableReference)})`)
|
|
9943
|
+
.join(", "));
|
|
9944
|
+
}
|
|
9945
|
+
}
|
|
9946
|
+
return result;
|
|
9947
|
+
};
|
|
9948
|
+
exports.resolveAllReferences = resolveAllReferences;
|
|
9949
|
+
//# sourceMappingURL=resolveAllReferences.js.map
|
|
9950
|
+
|
|
9951
|
+
/***/ }),
|
|
9952
|
+
|
|
9953
|
+
/***/ 89554:
|
|
9954
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
9955
|
+
|
|
9956
|
+
"use strict";
|
|
9957
|
+
|
|
9958
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9959
|
+
exports.resolveAllReferencesOnce = void 0;
|
|
9960
|
+
const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
|
|
9961
|
+
const resolveReferencesOnce_1 = __nccwpck_require__(78749);
|
|
9962
|
+
const resolveAllReferencesOnce = async (values, getEnvVars) => {
|
|
9963
|
+
const allReferences = Object.values(values).flatMap((value) => value === null || value === void 0 ? void 0 : value.parts.filter((part) => part instanceof VariableValueContainingReferences_1.VariableReference));
|
|
9964
|
+
const allComponentsUnique = Array.from(new Set(allReferences.map((reference) => reference.componentName)));
|
|
9965
|
+
const allEnvVarsInComponents = Object.fromEntries(await Promise.all(allComponentsUnique.map(async (componentName) => [
|
|
9966
|
+
componentName,
|
|
9967
|
+
await getEnvVars(componentName),
|
|
9968
|
+
])));
|
|
9969
|
+
return Object.fromEntries(Object.entries(values).map(([key, value]) => [
|
|
9970
|
+
key,
|
|
9971
|
+
value !== null && value !== undefined
|
|
9972
|
+
? (0, resolveReferencesOnce_1.resolveReferencesOnce)(value, ({ componentName, variableName }) => {
|
|
9973
|
+
return allEnvVarsInComponents[componentName][variableName];
|
|
9974
|
+
})
|
|
9975
|
+
: value,
|
|
9976
|
+
]));
|
|
9977
|
+
};
|
|
9978
|
+
exports.resolveAllReferencesOnce = resolveAllReferencesOnce;
|
|
9979
|
+
//# sourceMappingURL=resolveAllReferencesOnce.js.map
|
|
9980
|
+
|
|
9981
|
+
/***/ }),
|
|
9982
|
+
|
|
9983
|
+
/***/ 78749:
|
|
9984
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
9985
|
+
|
|
9986
|
+
"use strict";
|
|
9987
|
+
|
|
9988
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9989
|
+
exports.resolveReferencesOnce = void 0;
|
|
9990
|
+
const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
|
|
9991
|
+
const resolveReferencesOnce = (value, resolver) => {
|
|
9992
|
+
const replacedParts = value.parts.map((part) => {
|
|
9993
|
+
if (part instanceof VariableValueContainingReferences_1.VariableReference) {
|
|
9994
|
+
const result = resolver({
|
|
9995
|
+
componentName: part.componentName,
|
|
9996
|
+
variableName: part.variableName,
|
|
9997
|
+
});
|
|
9998
|
+
return result !== null && result !== void 0 ? result : new VariableValueContainingReferences_1.UnresolvableReference(part);
|
|
9999
|
+
}
|
|
10000
|
+
else {
|
|
10001
|
+
return part;
|
|
10002
|
+
}
|
|
10003
|
+
});
|
|
10004
|
+
return new VariableValueContainingReferences_1.VariableValueContainingReferences(replacedParts);
|
|
10005
|
+
};
|
|
10006
|
+
exports.resolveReferencesOnce = resolveReferencesOnce;
|
|
10007
|
+
//# sourceMappingURL=resolveReferencesOnce.js.map
|
|
10008
|
+
|
|
10009
|
+
/***/ }),
|
|
10010
|
+
|
|
9761
10011
|
/***/ 93090:
|
|
9762
10012
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
9763
10013
|
|