@catladder/pipeline 1.144.1 → 1.146.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bash/BashExpression.d.ts +40 -0
- package/dist/bash/BashExpression.js +124 -0
- package/dist/bash/bashExpressionPerPipelineType.d.ts +6 -0
- package/dist/bash/bashExpressionPerPipelineType.js +11 -0
- package/dist/bash/bashYaml.d.ts +10 -0
- package/dist/bash/bashYaml.js +46 -0
- package/dist/bash/getInjectVarsScript.d.ts +2 -0
- package/dist/bash/getInjectVarsScript.js +45 -0
- package/dist/bash/replaceAsync.d.ts +2 -0
- package/dist/{pipeline/commitInfo/getCommitInfo.js → bash/replaceAsync.js} +49 -21
- package/dist/build/base/__tests__/createArtifactsConfig.test.js +3 -1
- package/dist/build/base/constants.js +3 -1
- package/dist/build/base/createAppBuildJob.d.ts +2 -1
- package/dist/build/base/createAppBuildJob.js +10 -6
- package/dist/build/base/createArtifactsConfig.d.ts +1 -1
- package/dist/build/base/createArtifactsConfig.js +3 -1
- package/dist/build/base/index.js +3 -1
- package/dist/build/base/writeBuildInfo.js +4 -3
- package/dist/build/base/writeDotEnv.js +12 -3
- package/dist/build/custom/__tests__/testJob.test.js +3 -1
- package/dist/build/custom/buildJob.js +4 -12
- package/dist/build/custom/index.js +3 -1
- package/dist/build/custom/testJob.d.ts +1 -1
- package/dist/build/custom/testJob.js +18 -14
- package/dist/build/docker.d.ts +5 -31
- package/dist/build/docker.js +16 -9
- package/dist/build/index.d.ts +1 -1
- package/dist/build/index.js +13 -7
- package/dist/build/node/buildJob.js +4 -12
- package/dist/build/node/cache.js +6 -3
- package/dist/build/node/constants.js +3 -1
- package/dist/build/node/index.js +3 -1
- package/dist/build/node/meteor.js +5 -2
- package/dist/build/node/testJob.js +18 -14
- package/dist/build/node/yarn.d.ts +3 -2
- package/dist/build/node/yarn.js +6 -3
- package/dist/build/rails/build.js +3 -1
- package/dist/build/rails/index.js +3 -1
- package/dist/build/rails/test.js +15 -11
- package/dist/build/sbom.js +3 -1
- package/dist/build/types.d.ts +24 -18
- package/dist/build/types.js +3 -1
- package/dist/bundles/catladder-gitlab/index.js +3 -3
- package/dist/catladder-gitlab.js +10 -54
- package/dist/config/__tests__/configruedEnvs.test.js +3 -1
- package/dist/config/configruedEnvs.js +3 -1
- package/dist/config/index.js +13 -7
- package/dist/config/readConfig.js +6 -5
- package/dist/constants.js +5 -3
- package/dist/context/__tests__/resolveReferences.test.js +40 -8
- package/dist/context/getBuildInfoVariables.d.ts +7 -0
- package/dist/context/getBuildInfoVariables.js +29 -0
- package/dist/context/getEnvConfig.js +3 -1
- package/dist/context/getEnvType.js +3 -1
- package/dist/context/getEnvironment.d.ts +3 -3
- package/dist/context/getEnvironment.js +10 -14
- package/dist/context/getEnvironmentContext.d.ts +7 -3
- package/dist/context/getEnvironmentContext.js +21 -11
- package/dist/context/getEnvironmentVariables.d.ts +26 -5
- package/dist/context/getEnvironmentVariables.js +40 -25
- package/dist/context/getLabels.js +4 -2
- package/dist/context/getReviewSlug.d.ts +4 -0
- package/dist/context/getReviewSlug.js +22 -0
- package/dist/context/index.d.ts +12 -3
- package/dist/context/index.js +21 -15
- package/dist/context/resolveReferences.d.ts +3 -1
- package/dist/context/resolveReferences.js +53 -21
- package/dist/context/transformJobOnlyVars.d.ts +5 -2
- package/dist/context/transformJobOnlyVars.js +4 -2
- package/dist/context/utils/envVars.d.ts +1 -1
- package/dist/context/utils/envVars.js +5 -2
- package/dist/defaults/index.js +3 -1
- package/dist/deploy/base/deploy.d.ts +1 -1
- package/dist/deploy/base/deploy.js +12 -11
- package/dist/deploy/base/index.js +3 -1
- package/dist/deploy/base/rollback.d.ts +1 -1
- package/dist/deploy/base/rollback.js +13 -9
- package/dist/deploy/base/stop.d.ts +1 -1
- package/dist/deploy/base/stop.js +16 -11
- package/dist/deploy/base/types.d.ts +1 -1
- package/dist/deploy/base/types.js +3 -1
- package/dist/deploy/base/variables.js +3 -1
- package/dist/deploy/cloudRun/artifactsRegistry.d.ts +2 -1
- package/dist/deploy/cloudRun/artifactsRegistry.js +6 -4
- package/dist/deploy/cloudRun/cleanup.js +3 -1
- package/dist/deploy/cloudRun/cloudRunRevisions.js +3 -1
- package/dist/deploy/cloudRun/createJobs/cloudRunJobs.js +8 -5
- package/dist/deploy/cloudRun/createJobs/cloudRunServices.d.ts +2 -2
- package/dist/deploy/cloudRun/createJobs/cloudRunServices.js +6 -3
- package/dist/deploy/cloudRun/createJobs/common.d.ts +3 -3
- package/dist/deploy/cloudRun/createJobs/common.js +3 -1
- package/dist/deploy/cloudRun/createJobs/constants.d.ts +1 -0
- package/dist/deploy/cloudRun/createJobs/constants.js +7 -0
- package/dist/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +10 -4
- package/dist/deploy/cloudRun/createJobs/getCloudRunStopScripts.js +3 -1
- package/dist/deploy/cloudRun/createJobs/index.js +25 -8
- package/dist/deploy/cloudRun/createJobs/volumes.js +3 -1
- package/dist/deploy/cloudRun/index.js +5 -3
- package/dist/deploy/cloudRun/utils/createArgsString.d.ts +2 -1
- package/dist/deploy/cloudRun/utils/createArgsString.js +3 -1
- package/dist/deploy/cloudRun/utils/database.js +13 -13
- package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js +3 -1
- package/dist/deploy/cloudRun/utils/getServiceName.d.ts +1 -1
- package/dist/deploy/cloudRun/utils/getServiceName.js +3 -1
- package/dist/deploy/cloudRun/utils/jobName.d.ts +2 -1
- package/dist/deploy/cloudRun/utils/jobName.js +4 -2
- package/dist/deploy/cloudRun/utils/removeFirstLinesFromCommandOutput.js +3 -1
- package/dist/deploy/cloudSql/utils.d.ts +2 -1
- package/dist/deploy/cloudSql/utils.js +7 -2
- package/dist/deploy/custom/deployJob.js +3 -1
- package/dist/deploy/custom/index.js +3 -1
- package/dist/deploy/dockerTag/deployJob.js +3 -1
- package/dist/deploy/dockerTag/index.js +3 -1
- package/dist/deploy/index.d.ts +4 -3
- package/dist/deploy/index.js +13 -7
- package/dist/deploy/kubernetes/additionalSecretKeys.js +3 -1
- package/dist/deploy/kubernetes/cloudSql/index.d.ts +3 -2
- package/dist/deploy/kubernetes/cloudSql/index.js +6 -4
- package/dist/deploy/kubernetes/deployJob.js +22 -15
- package/dist/deploy/kubernetes/index.js +51 -14
- package/dist/deploy/kubernetes/kubeEnv.d.ts +3 -2
- package/dist/deploy/kubernetes/kubeEnv.js +7 -4
- package/dist/deploy/kubernetes/kubeValues.d.ts +2 -2
- package/dist/deploy/kubernetes/kubeValues.js +4 -5
- package/dist/deploy/kubernetes/mongodb.js +3 -1
- package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +2 -1
- package/dist/deploy/kubernetes/processSecretsAsFiles.js +3 -1
- package/dist/deploy/sbom.js +3 -1
- package/dist/deploy/types/base.d.ts +8 -2
- package/dist/deploy/types/base.js +3 -1
- package/dist/deploy/types/custom.d.ts +1 -1
- package/dist/deploy/types/custom.js +3 -1
- package/dist/deploy/types/dockerTag.d.ts +1 -1
- package/dist/deploy/types/dockerTag.js +3 -1
- package/dist/deploy/types/googleCloudRun.d.ts +19 -18
- package/dist/deploy/types/googleCloudRun.js +3 -1
- package/dist/deploy/types/index.d.ts +6 -6
- package/dist/deploy/types/index.js +13 -7
- package/dist/deploy/types/kubernetes.d.ts +22 -22
- package/dist/deploy/types/kubernetes.js +3 -1
- package/dist/deploy/utils.js +3 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +16 -9
- package/dist/packageInfos.d.ts +2 -0
- package/dist/packageInfos.js +14 -0
- package/dist/pipeline/createAllJobs.d.ts +13 -5
- package/dist/pipeline/createAllJobs.js +21 -10
- package/dist/pipeline/createChildPipeline.d.ts +1 -1
- package/dist/pipeline/createChildPipeline.js +24 -7
- package/dist/pipeline/createJobsForComponent.d.ts +3 -3
- package/dist/pipeline/createJobsForComponent.js +19 -18
- package/dist/pipeline/createMainPipeline.d.ts +3 -0
- package/dist/pipeline/createMainPipeline.js +248 -0
- package/dist/pipeline/generatePipelineFiles.d.ts +2 -0
- package/dist/pipeline/generatePipelineFiles.js +178 -0
- package/dist/pipeline/getPipelineStages.js +3 -1
- package/dist/pipeline/gitlab/createGitlabJobs.d.ts +15 -5
- package/dist/pipeline/gitlab/createGitlabJobs.js +98 -25
- package/dist/pipeline/gitlab/createGitlabPipeline.d.ts +7 -2
- package/dist/pipeline/gitlab/createGitlabPipeline.js +34 -17
- package/dist/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.d.ts +1 -0
- package/dist/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.js +29 -0
- package/dist/pipeline/gitlab/gitlabReleaseJobs.d.ts +33 -0
- package/dist/pipeline/gitlab/gitlabReleaseJobs.js +24 -0
- package/dist/pipeline/index.d.ts +3 -1
- package/dist/pipeline/index.js +16 -8
- package/dist/pipeline/packageManager.js +4 -2
- package/dist/pipeline/yarn/yarnUtils.js +6 -4
- package/dist/rules/index.d.ts +4 -1
- package/dist/rules/index.js +25 -18
- package/dist/runner/index.d.ts +1 -1
- package/dist/runner/index.js +3 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +18 -15
- package/dist/types/config.js +5 -2
- package/dist/types/context.d.ts +37 -32
- package/dist/types/context.js +3 -1
- package/dist/types/environmentContext.d.ts +11 -7
- package/dist/types/environmentContext.js +3 -1
- package/dist/types/gitlab-ci-yml.d.ts +30 -30
- package/dist/types/gitlab-ci-yml.js +3 -2
- package/dist/types/gitlab-types.d.ts +4 -6
- package/dist/types/gitlab-types.js +3 -1
- package/dist/types/index.js +13 -7
- package/dist/types/jobs.d.ts +23 -6
- package/dist/types/jobs.js +3 -1
- package/dist/types/pipeline.d.ts +4 -3
- package/dist/types/pipeline.js +3 -1
- package/dist/types/utils.d.ts +1 -1
- package/dist/types/utils.js +3 -1
- package/dist/utils/gitlab.js +3 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +3 -1
- package/dist/utils/writeFiles.d.ts +7 -0
- package/dist/{pipeline/commitInfo/getBuildId.js → utils/writeFiles.js} +39 -22
- package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +480 -384
- package/examples/__snapshots__/cloud-run-meteor-with-worker.ts.snap +462 -366
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +480 -384
- package/examples/__snapshots__/cloud-run-no-service.ts.snap +501 -393
- package/examples/__snapshots__/cloud-run-non-public.ts.snap +480 -384
- package/examples/__snapshots__/cloud-run-post-stop-job.ts.snap +489 -392
- package/examples/__snapshots__/cloud-run-service-gen2.ts.snap +480 -384
- package/examples/__snapshots__/cloud-run-service-with-volumes.ts.snap +501 -401
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +1155 -915
- package/examples/__snapshots__/cloud-run-with-sql.ts.snap +1116 -888
- package/examples/__snapshots__/cloud-run-with-worker.ts.snap +482 -386
- package/examples/__snapshots__/custom-build-job-with-tests.ts.snap +452 -356
- package/examples/__snapshots__/custom-build-job.ts.snap +434 -350
- package/examples/__snapshots__/custom-deploy.ts.snap +319 -223
- package/examples/__snapshots__/custom-envs.ts.snap +123 -81
- package/examples/__snapshots__/custom-sbom-java.ts.snap +434 -350
- package/examples/__snapshots__/kubernetes-application-customization.ts.snap +846 -969
- package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.ts.snap +886 -957
- package/examples/__snapshots__/kubernetes-with-cloud-sql.ts.snap +894 -969
- package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +1626 -1728
- package/examples/__snapshots__/kubernetes-with-mongodb.ts.snap +974 -1137
- package/examples/__snapshots__/local-dot-env.ts.snap +480 -384
- package/examples/__snapshots__/meteor-kubernetes.ts.snap +906 -1069
- package/examples/__snapshots__/multiline-var.ts.snap +4500 -0
- package/examples/__snapshots__/native-app.ts.snap +706 -578
- package/examples/__snapshots__/node-build-with-custom-image.ts.snap +480 -384
- package/examples/__snapshots__/node-build-with-docker-additions.ts.snap +488 -384
- package/examples/__snapshots__/rails-k8s-with-worker.ts.snap +1656 -1942
- package/examples/__snapshots__/wait-for-other-deploy.ts.snap +287 -231
- package/examples/__utils__/helpers.ts +2 -2
- package/examples/custom-deploy.ts +7 -7
- package/examples/multiline-var.ts +64 -0
- package/package.json +5 -8
- package/scripts/generate-gitlab-ci-types.ts +2 -2
- package/src/bash/BashExpression.ts +81 -0
- package/src/bash/bashExpressionPerPipelineType.ts +16 -0
- package/src/bash/bashYaml.ts +46 -0
- package/src/bash/getInjectVarsScript.ts +12 -0
- package/src/bash/replaceAsync.ts +50 -0
- package/src/build/base/__tests__/createArtifactsConfig.test.ts +3 -3
- package/src/build/base/createAppBuildJob.ts +8 -4
- package/src/build/base/createArtifactsConfig.ts +2 -2
- package/src/build/base/index.ts +1 -1
- package/src/build/base/writeBuildInfo.ts +1 -1
- package/src/build/base/writeDotEnv.ts +6 -1
- package/src/build/custom/__tests__/testJob.test.ts +1 -1
- package/src/build/custom/buildJob.ts +4 -6
- package/src/build/custom/testJob.ts +6 -5
- package/src/build/docker.ts +21 -13
- package/src/build/index.ts +1 -1
- package/src/build/node/buildJob.ts +3 -5
- package/src/build/node/cache.ts +4 -4
- package/src/build/node/meteor.ts +1 -1
- package/src/build/node/testJob.ts +6 -5
- package/src/build/node/yarn.ts +14 -9
- package/src/build/rails/test.ts +2 -1
- package/src/build/types.ts +8 -1
- package/src/catladder-gitlab.ts +8 -55
- package/src/config/configruedEnvs.ts +6 -6
- package/src/config/readConfig.ts +4 -5
- package/src/constants.ts +5 -2
- package/src/context/__tests__/resolveReferences.test.ts +11 -6
- package/src/context/getBuildInfoVariables.ts +40 -0
- package/src/context/getEnvConfig.ts +1 -1
- package/src/context/getEnvType.ts +1 -1
- package/src/context/getEnvironment.ts +7 -30
- package/src/context/getEnvironmentContext.ts +25 -29
- package/src/context/getEnvironmentVariables.ts +72 -47
- package/src/context/getReviewSlug.ts +27 -0
- package/src/context/index.ts +26 -25
- package/src/context/resolveReferences.ts +40 -17
- package/src/context/transformJobOnlyVars.ts +6 -3
- package/src/context/utils/envVars.ts +5 -4
- package/src/deploy/base/deploy.ts +25 -23
- package/src/deploy/base/index.ts +1 -1
- package/src/deploy/base/rollback.ts +9 -11
- package/src/deploy/base/stop.ts +9 -10
- package/src/deploy/cloudRun/artifactsRegistry.ts +13 -8
- package/src/deploy/cloudRun/cleanup.ts +3 -3
- package/src/deploy/cloudRun/cloudRunRevisions.ts +3 -3
- package/src/deploy/cloudRun/createJobs/cloudRunJobs.ts +22 -17
- package/src/deploy/cloudRun/createJobs/cloudRunServices.ts +7 -6
- package/src/deploy/cloudRun/createJobs/common.ts +1 -1
- package/src/deploy/cloudRun/createJobs/constants.ts +1 -0
- package/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.ts +25 -7
- package/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.ts +1 -1
- package/src/deploy/cloudRun/createJobs/index.ts +18 -9
- package/src/deploy/cloudRun/createJobs/volumes.ts +2 -2
- package/src/deploy/cloudRun/index.ts +22 -10
- package/src/deploy/cloudRun/utils/createArgsString.ts +3 -2
- package/src/deploy/cloudRun/utils/database.ts +7 -7
- package/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.ts +1 -1
- package/src/deploy/cloudRun/utils/jobName.ts +7 -2
- package/src/deploy/cloudRun/utils/removeFirstLinesFromCommandOutput.ts +1 -1
- package/src/deploy/cloudSql/utils.ts +13 -10
- package/src/deploy/index.ts +5 -4
- package/src/deploy/kubernetes/cloudSql/index.ts +6 -5
- package/src/deploy/kubernetes/deployJob.ts +28 -14
- package/src/deploy/kubernetes/index.ts +15 -8
- package/src/deploy/kubernetes/kubeEnv.ts +9 -7
- package/src/deploy/kubernetes/kubeValues.ts +5 -6
- package/src/deploy/kubernetes/mongodb.ts +1 -1
- package/src/deploy/kubernetes/processSecretsAsFiles.ts +5 -4
- package/src/deploy/types/base.ts +6 -0
- package/src/deploy/types/googleCloudRun.ts +2 -0
- package/src/deploy/utils.ts +2 -2
- package/src/index.ts +2 -1
- package/src/packageInfos.ts +10 -0
- package/src/pipeline/createAllJobs.ts +28 -14
- package/src/pipeline/createChildPipeline.ts +20 -9
- package/src/pipeline/createJobsForComponent.ts +15 -23
- package/src/pipeline/createMainPipeline.ts +91 -0
- package/src/pipeline/generatePipelineFiles.ts +29 -0
- package/src/pipeline/getPipelineStages.ts +1 -1
- package/src/pipeline/gitlab/createGitlabJobs.ts +182 -59
- package/src/pipeline/gitlab/createGitlabPipeline.ts +16 -14
- package/src/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.ts +46 -0
- package/src/pipeline/gitlab/gitlabReleaseJobs.ts +20 -0
- package/src/pipeline/index.ts +2 -0
- package/src/pipeline/packageManager.ts +2 -2
- package/src/pipeline/yarn/yarnUtils.ts +7 -7
- package/src/rules/index.ts +15 -9
- package/src/types/config.ts +12 -3
- package/src/types/context.ts +39 -26
- package/src/types/environmentContext.ts +13 -7
- package/src/types/gitlab-ci-yml.ts +0 -1
- package/src/types/gitlab-types.ts +5 -4
- package/src/types/jobs.ts +29 -4
- package/src/types/pipeline.ts +4 -0
- package/src/types/utils.ts +4 -4
- package/src/utils/gitlab.ts +1 -1
- package/src/utils/index.ts +2 -2
- package/src/utils/writeFiles.ts +40 -0
- package/dist/deploy/cloudRun/createJobs/variables.d.ts +0 -5
- package/dist/deploy/cloudRun/createJobs/variables.js +0 -19
- package/dist/pipeline/commitInfo/getBuildId.d.ts +0 -6
- package/dist/pipeline/commitInfo/getCommitInfo.d.ts +0 -2
- package/src/deploy/cloudRun/createJobs/variables.ts +0 -21
- package/src/pipeline/commitInfo/getBuildId.ts +0 -17
- package/src/pipeline/commitInfo/getCommitInfo.ts +0 -15
|
@@ -41,7 +41,9 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
41
41
|
}
|
|
42
42
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
43
43
|
};
|
|
44
|
-
exports
|
|
44
|
+
Object.defineProperty(exports, "__esModule", {
|
|
45
|
+
value: true
|
|
46
|
+
});
|
|
45
47
|
exports.getCreateScheduleScripts = exports.getJobCreateScripts = exports.getJobRunScripts = exports.getDeleteJobsScripts = exports.getDeleteSchedulesScripts = void 0;
|
|
46
48
|
var gitlab_1 = require("../../../utils/gitlab");
|
|
47
49
|
var createArgsString_1 = require("../utils/createArgsString");
|
|
@@ -49,10 +51,11 @@ var jobName_1 = require("../utils/jobName");
|
|
|
49
51
|
var common_1 = require("./common");
|
|
50
52
|
var getLabels_1 = require("../../../context/getLabels");
|
|
51
53
|
var volumes_1 = require("./volumes");
|
|
54
|
+
var constants_1 = require("./constants");
|
|
52
55
|
var getJobRunScriptForJob = function (context, jobName, wait) {
|
|
53
56
|
var commonArgs = (0, common_1.getCommonCloudRunArgs)(context);
|
|
54
57
|
var commonArgsString = (0, createArgsString_1.createArgsString)(commonArgs);
|
|
55
|
-
return "".concat((0, common_1.gcloudRunCmd)(), " jobs execute ").concat(jobName, " ").concat(commonArgsString).concat(wait ? " --wait" : "");
|
|
58
|
+
return "".concat((0, common_1.gcloudRunCmd)(), " jobs execute ").concat(jobName.toString(), " ").concat(commonArgsString).concat(wait ? " --wait" : "");
|
|
56
59
|
};
|
|
57
60
|
var getDeleteSchedulesScripts = function (context) {
|
|
58
61
|
var deployConfig = (0, common_1.getCloudRunDeployConfig)(context);
|
|
@@ -111,14 +114,14 @@ var getJobCreateScriptsForJob = function (context, jobName, job) {
|
|
|
111
114
|
command: '"' + commandArray.join(",") + '"'
|
|
112
115
|
}, commonDeployArgs), {
|
|
113
116
|
labels: (0, common_1.makeLabelString)(__assign(__assign({}, (0, getLabels_1.getLabels)(context)), {
|
|
114
|
-
"cloud-run-job-name": jobName
|
|
117
|
+
"cloud-run-job-name": jobName.toString()
|
|
115
118
|
})),
|
|
116
119
|
image: job.image || commonDeployArgs.image,
|
|
117
120
|
cpu: job === null || job === void 0 ? void 0 : job.cpu,
|
|
118
121
|
memory: job.memory || "512Mi",
|
|
119
122
|
"task-timeout": job.timeout || "10m",
|
|
120
123
|
parallelism: job.parallelism || 1,
|
|
121
|
-
"env-vars-file":
|
|
124
|
+
"env-vars-file": constants_1.ENV_VARS_FILENAME,
|
|
122
125
|
"max-retries": 0
|
|
123
126
|
}));
|
|
124
127
|
var requiresBeta = (job === null || job === void 0 ? void 0 : job.volumes) && Object.keys(job === null || job === void 0 ? void 0 : job.volumes).length > 0;
|
|
@@ -157,7 +160,7 @@ var getCloudRunJobsWithSchedule = function (context) {
|
|
|
157
160
|
return {
|
|
158
161
|
job: job,
|
|
159
162
|
jobName: jobName,
|
|
160
|
-
schedulerName: jobName
|
|
163
|
+
schedulerName: jobName.concat("-scheduler")
|
|
161
164
|
};
|
|
162
165
|
});
|
|
163
166
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Context } from "../../../types/context";
|
|
2
2
|
import type { DeployConfigCloudRunService } from "../../types/googleCloudRun";
|
|
3
|
-
export declare const getServiceDeployScript: (context: Context, service: DeployConfigCloudRunService | true | undefined, nameSuffix?: string
|
|
4
|
-
export declare const getServiceDeleteScript: (context: Context, serviceSuffix?: string
|
|
3
|
+
export declare const getServiceDeployScript: (context: Context, service: DeployConfigCloudRunService | true | undefined, nameSuffix?: string) => string;
|
|
4
|
+
export declare const getServiceDeleteScript: (context: Context, serviceSuffix?: string) => string[];
|
|
@@ -41,12 +41,15 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
41
41
|
}
|
|
42
42
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
43
43
|
};
|
|
44
|
-
exports
|
|
44
|
+
Object.defineProperty(exports, "__esModule", {
|
|
45
|
+
value: true
|
|
46
|
+
});
|
|
45
47
|
exports.getServiceDeleteScript = exports.getServiceDeployScript = void 0;
|
|
46
48
|
var getLabels_1 = require("../../../context/getLabels");
|
|
47
49
|
var createArgsString_1 = require("../utils/createArgsString");
|
|
48
50
|
var getServiceName_1 = require("../utils/getServiceName");
|
|
49
51
|
var common_1 = require("./common");
|
|
52
|
+
var constants_1 = require("./constants");
|
|
50
53
|
var volumes_1 = require("./volumes");
|
|
51
54
|
var getServiceDeployScript = function (context, service, nameSuffix) {
|
|
52
55
|
var _a, _b, _c, _d, _e;
|
|
@@ -55,7 +58,7 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
|
|
|
55
58
|
var customConfig = service !== true ? service : undefined;
|
|
56
59
|
var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand : undefined;
|
|
57
60
|
var commandArray = command ? Array.isArray(command) ? command : command.split(" ") : undefined;
|
|
58
|
-
var fullServiceName =
|
|
61
|
+
var fullServiceName = serviceName.concat(nameSuffix !== null && nameSuffix !== void 0 ? nameSuffix : "");
|
|
59
62
|
var argsString = createArgsString_1.createArgsString.apply(void 0, __spreadArray([__assign(__assign({
|
|
60
63
|
// command as empty string resets it to default (uses the image's entrypoint)
|
|
61
64
|
command: commandArray ? '"' + commandArray.join(",") + '"' : '""'
|
|
@@ -63,7 +66,7 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
|
|
|
63
66
|
labels: (0, common_1.makeLabelString)(__assign(__assign({}, (0, getLabels_1.getLabels)(context)), {
|
|
64
67
|
"cloud-run-service-name": fullServiceName
|
|
65
68
|
})),
|
|
66
|
-
"env-vars-file":
|
|
69
|
+
"env-vars-file": constants_1.ENV_VARS_FILENAME,
|
|
67
70
|
"min-instances": (_b = customConfig === null || customConfig === void 0 ? void 0 : customConfig.minInstances) !== null && _b !== void 0 ? _b : 0,
|
|
68
71
|
"max-instances": (_c = customConfig === null || customConfig === void 0 ? void 0 : customConfig.maxInstances) !== null && _c !== void 0 ? _c : 100,
|
|
69
72
|
"cpu-throttling": (customConfig === null || customConfig === void 0 ? void 0 : customConfig.noCpuThrottling) !== true,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Context } from "../../../types/context";
|
|
2
2
|
import type { DeployConfigCloudRun } from "../../types/googleCloudRun";
|
|
3
|
-
export declare const gcloudCmd: (version?: "beta"
|
|
4
|
-
export declare const gcloudRunCmd: (version?: "beta"
|
|
5
|
-
export declare const gcloudSchedulerCmd: (version?: "beta"
|
|
3
|
+
export declare const gcloudCmd: (version?: "beta") => string;
|
|
4
|
+
export declare const gcloudRunCmd: (version?: "beta") => string;
|
|
5
|
+
export declare const gcloudSchedulerCmd: (version?: "beta") => string;
|
|
6
6
|
export declare const setGoogleProjectNumberScript: (deployConfig: DeployConfigCloudRun) => string[];
|
|
7
7
|
export declare const makeLabelString: (obj: Record<string, unknown>) => string;
|
|
8
8
|
export declare const getCloudRunDeployConfig: (context: Context) => DeployConfigCloudRun;
|
|
@@ -32,7 +32,9 @@ var __read = this && this.__read || function (o, n) {
|
|
|
32
32
|
}
|
|
33
33
|
return ar;
|
|
34
34
|
};
|
|
35
|
-
exports
|
|
35
|
+
Object.defineProperty(exports, "__esModule", {
|
|
36
|
+
value: true
|
|
37
|
+
});
|
|
36
38
|
exports.getCommonDeployArgs = exports.getCommonCloudRunArgs = exports.getCloudRunDeployConfig = exports.makeLabelString = exports.setGoogleProjectNumberScript = exports.gcloudSchedulerCmd = exports.gcloudRunCmd = exports.gcloudCmd = void 0;
|
|
37
39
|
var types_1 = require("../../types");
|
|
38
40
|
var artifactsRegistry_1 = require("../artifactsRegistry");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ENV_VARS_FILENAME = "____envvars.yaml";
|
|
@@ -31,8 +31,11 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
31
31
|
}
|
|
32
32
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33
33
|
};
|
|
34
|
-
exports
|
|
34
|
+
Object.defineProperty(exports, "__esModule", {
|
|
35
|
+
value: true
|
|
36
|
+
});
|
|
35
37
|
exports.getCloudRunDeployScripts = void 0;
|
|
38
|
+
var lodash_1 = require("lodash");
|
|
36
39
|
var gitlab_1 = require("../../../utils/gitlab");
|
|
37
40
|
var sbom_1 = require("../../sbom");
|
|
38
41
|
var cleanup_1 = require("../cleanup");
|
|
@@ -41,16 +44,19 @@ var gcloudServiceAccountLoginCommands_1 = require("../utils/gcloudServiceAccount
|
|
|
41
44
|
var cloudRunJobs_1 = require("./cloudRunJobs");
|
|
42
45
|
var cloudRunServices_1 = require("./cloudRunServices");
|
|
43
46
|
var common_1 = require("./common");
|
|
47
|
+
var __1 = require("..");
|
|
48
|
+
var constants_1 = require("./constants");
|
|
49
|
+
var bashYaml_1 = require("../../../bash/bashYaml");
|
|
44
50
|
function getCloudRunDeployScripts(context) {
|
|
45
51
|
var _a;
|
|
46
52
|
var deployConfig = (0, common_1.getCloudRunDeployConfig)(context);
|
|
47
|
-
|
|
53
|
+
var allEnvVars = (0, lodash_1.omit)(context.environment.envVars, __1.GCLOUD_DEPLOY_CREDENTIALS_KEY);
|
|
54
|
+
return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gitlab_1.collapseableSection)("prepare", "Prepare...")(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read((0, common_1.setGoogleProjectNumberScript)(deployConfig)), false))), false), __read((0, gitlab_1.collapseableSection)("writeenvvars", "Write env vars to file")((0, bashYaml_1.writeBashYamlToFileScript)(allEnvVars, constants_1.ENV_VARS_FILENAME))), false), __read((0, gitlab_1.collapseableSection)("deploy", "Deploy to cloud run")(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(deployConfig.cloudSql ? (0, database_1.getDatabaseCreateScript)(context, deployConfig) // we create the db, so that we can also delete it afterwards
|
|
48
55
|
: []), false), __read((0, cloudRunJobs_1.getCreateScheduleScripts)(context)), false), __read((0, cloudRunJobs_1.getJobCreateScripts)(context)), false), __read((0, cloudRunJobs_1.getJobRunScripts)(context, "preDeploy")), false), __read(deployConfig.service !== false ? [(0, cloudRunServices_1.getServiceDeployScript)(context, deployConfig.service)] : []), false), __read(Object.entries((_a = deployConfig.additionalServices) !== null && _a !== void 0 ? _a : {}).map(function (_a) {
|
|
49
56
|
var _b = __read(_a, 2),
|
|
50
57
|
name = _b[0],
|
|
51
58
|
service = _b[1];
|
|
52
59
|
return (0, cloudRunServices_1.getServiceDeployScript)(context, service, "-" + name);
|
|
53
|
-
})), false), __read((0, cloudRunJobs_1.getJobRunScripts)(context, "postDeploy")), false))), false), __read((0, gitlab_1.collapseableSection)("cleanup", "Cleanup")((0, cleanup_1.getRemoveOldRevisionsAndImagesCommand)(context, "postDeploy")
|
|
54
|
-
)), false), __read((0, sbom_1.getDependencyTrackUploadScript)(context)), false);
|
|
60
|
+
})), false), __read((0, cloudRunJobs_1.getJobRunScripts)(context, "postDeploy")), false))), false), __read((0, gitlab_1.collapseableSection)("cleanup", "Cleanup")((0, cleanup_1.getRemoveOldRevisionsAndImagesCommand)(context, "postDeploy"))), false), __read((0, sbom_1.getDependencyTrackUploadScript)(context)), false);
|
|
55
61
|
}
|
|
56
62
|
exports.getCloudRunDeployScripts = getCloudRunDeployScripts;
|
|
@@ -31,7 +31,9 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
31
31
|
}
|
|
32
32
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33
33
|
};
|
|
34
|
-
exports
|
|
34
|
+
Object.defineProperty(exports, "__esModule", {
|
|
35
|
+
value: true
|
|
36
|
+
});
|
|
35
37
|
exports.getCloudRunStopScripts = void 0;
|
|
36
38
|
var sbom_1 = require("../../sbom");
|
|
37
39
|
var cleanup_1 = require("../cleanup");
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
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
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", {
|
|
14
|
+
value: true
|
|
15
|
+
});
|
|
4
16
|
exports.createGoogleCloudRunDeployJobs = void 0;
|
|
5
|
-
var lodash_1 = require("lodash");
|
|
6
|
-
var docker_1 = require("../../../build/docker");
|
|
7
17
|
var runner_1 = require("../../../runner");
|
|
8
18
|
var gitlab_1 = require("../../../utils/gitlab");
|
|
9
19
|
var base_1 = require("../../base");
|
|
10
20
|
var types_1 = require("../../types");
|
|
11
|
-
var
|
|
21
|
+
var constants_1 = require("./constants");
|
|
12
22
|
var getCloudRunDeployScripts_1 = require("./getCloudRunDeployScripts");
|
|
13
23
|
var getCloudRunStopScripts_1 = require("./getCloudRunStopScripts");
|
|
14
24
|
var createGoogleCloudRunDeployJobs = function (context) {
|
|
@@ -23,11 +33,18 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
23
33
|
var deployScripts = (0, getCloudRunDeployScripts_1.getCloudRunDeployScripts)(context);
|
|
24
34
|
var stopScripts = (0, getCloudRunStopScripts_1.getCloudRunStopScripts)(context);
|
|
25
35
|
return (0, base_1.createDeployementJobs)(context, {
|
|
26
|
-
deploy: (
|
|
36
|
+
deploy: __assign(__assign({
|
|
37
|
+
variables: {
|
|
38
|
+
CLOUDSDK_CORE_DISABLE_PROMPTS: "1"
|
|
39
|
+
}
|
|
40
|
+
}, deployConfig.debug ? {
|
|
27
41
|
artifacts: {
|
|
28
|
-
paths: [
|
|
29
|
-
|
|
30
|
-
|
|
42
|
+
paths: [constants_1.ENV_VARS_FILENAME // debug
|
|
43
|
+
],
|
|
44
|
+
|
|
45
|
+
when: "always"
|
|
46
|
+
}
|
|
47
|
+
} : {}), {
|
|
31
48
|
image: (0, runner_1.getRunnerImage)("gcloud"),
|
|
32
49
|
script: deployScripts
|
|
33
50
|
}),
|
|
@@ -31,7 +31,9 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
31
31
|
}
|
|
32
32
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33
33
|
};
|
|
34
|
-
exports
|
|
34
|
+
Object.defineProperty(exports, "__esModule", {
|
|
35
|
+
value: true
|
|
36
|
+
});
|
|
35
37
|
exports.createVolumeConfig = void 0;
|
|
36
38
|
var createVolumeConfig = function (volumes, type) {
|
|
37
39
|
if (!volumes) {
|
|
@@ -41,8 +41,11 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
41
41
|
}
|
|
42
42
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
43
43
|
};
|
|
44
|
-
exports
|
|
44
|
+
Object.defineProperty(exports, "__esModule", {
|
|
45
|
+
value: true
|
|
46
|
+
});
|
|
45
47
|
exports.GCLOUD_RUN_DEPLOY_TYPE = exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = void 0;
|
|
48
|
+
var BashExpression_1 = require("../../bash/BashExpression");
|
|
46
49
|
var context_1 = require("../../context");
|
|
47
50
|
var gitlab_1 = require("../../utils/gitlab");
|
|
48
51
|
var utils_1 = require("../cloudSql/utils");
|
|
@@ -104,12 +107,11 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
|
|
|
104
107
|
}] : []), false);
|
|
105
108
|
},
|
|
106
109
|
getAdditionalEnvVars: function (ctx) {
|
|
107
|
-
var _a;
|
|
108
110
|
var fullName = ctx.fullName,
|
|
109
111
|
env = ctx.env,
|
|
110
112
|
componentName = ctx.componentName,
|
|
111
113
|
deployConfigRaw = ctx.deployConfigRaw;
|
|
112
|
-
var HOST_INTERNAL =
|
|
114
|
+
var HOST_INTERNAL = (0, BashExpression_1.joinBashExpressions)([fullName, (0, BashExpression_1.getBashVariable)((0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX))], "-").toLowerCase();
|
|
113
115
|
var jobTriggers = deployConfigRaw && deployConfigRaw.jobs ? Object.fromEntries(Object.entries(deployConfigRaw.jobs).map(function (_a) {
|
|
114
116
|
var _b = __read(_a, 2),
|
|
115
117
|
name = _b[0],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BashExpression } from "../../../bash/BashExpression";
|
|
1
2
|
/**
|
|
2
3
|
* creates arguments string:
|
|
3
4
|
*
|
|
@@ -9,4 +10,4 @@
|
|
|
9
10
|
* @returns
|
|
10
11
|
*/
|
|
11
12
|
export declare const createArgsString: (...args: keyValuesArg[]) => string;
|
|
12
|
-
export
|
|
13
|
+
export type keyValuesArg = Record<string, string | number | true | false | undefined | BashExpression>;
|
|
@@ -22,7 +22,9 @@ var __read = this && this.__read || function (o, n) {
|
|
|
22
22
|
}
|
|
23
23
|
return ar;
|
|
24
24
|
};
|
|
25
|
-
exports
|
|
25
|
+
Object.defineProperty(exports, "__esModule", {
|
|
26
|
+
value: true
|
|
27
|
+
});
|
|
26
28
|
exports.createArgsString = void 0;
|
|
27
29
|
var lodash_1 = require("lodash");
|
|
28
30
|
/**
|
|
@@ -22,22 +22,23 @@ var __read = this && this.__read || function (o, n) {
|
|
|
22
22
|
}
|
|
23
23
|
return ar;
|
|
24
24
|
};
|
|
25
|
-
exports
|
|
25
|
+
Object.defineProperty(exports, "__esModule", {
|
|
26
|
+
value: true
|
|
27
|
+
});
|
|
26
28
|
exports.getDatabaseConnectionString = exports.DATABASE_JDBC_URL = exports.getDatabaseCreateScript = exports.getDatabaseDeleteScript = void 0;
|
|
27
29
|
var gitlab_1 = require("../../../utils/gitlab");
|
|
28
30
|
var getDatabaseDeleteScript = function (context, deployConfig) {
|
|
29
|
-
var _a;
|
|
30
31
|
if (!deployConfig.cloudSql || !deployConfig.cloudSql.deleteDatabaseOnStop) {
|
|
31
32
|
throw new Error("not possible");
|
|
32
33
|
}
|
|
33
|
-
var DB_NAME =
|
|
34
|
+
var DB_NAME = context.environment.envVars["DB_NAME"];
|
|
34
35
|
if (!DB_NAME) {
|
|
35
36
|
throw new Error("error: env vars did not specify DB_NAME");
|
|
36
37
|
}
|
|
37
|
-
var
|
|
38
|
-
projectId =
|
|
39
|
-
region =
|
|
40
|
-
instanceId =
|
|
38
|
+
var _a = __read(deployConfig.cloudSql.instanceConnectionName.split(":"), 3),
|
|
39
|
+
projectId = _a[0],
|
|
40
|
+
region = _a[1],
|
|
41
|
+
instanceId = _a[2];
|
|
41
42
|
// unfortunatly the database cannot be deleted right after the service has stopped, as it might still have connections
|
|
42
43
|
// we have to repeate this process
|
|
43
44
|
return ["echo \"deleting database ".concat(DB_NAME, "...\""), "echo \"\uD83D\uDC46 this can take multiple attemps (3-5min), because google cloud run may still have a connection to the database after the cloud run service is shut down\"", (0, gitlab_1.repeatOnFailure)("gcloud sql databases delete ".concat(DB_NAME, " --instance=").concat(instanceId, " --project ").concat(projectId), {
|
|
@@ -46,18 +47,17 @@ var getDatabaseDeleteScript = function (context, deployConfig) {
|
|
|
46
47
|
};
|
|
47
48
|
exports.getDatabaseDeleteScript = getDatabaseDeleteScript;
|
|
48
49
|
var getDatabaseCreateScript = function (context, deployConfig) {
|
|
49
|
-
var _a;
|
|
50
50
|
if (!deployConfig.cloudSql) {
|
|
51
51
|
throw new Error("not possible");
|
|
52
52
|
}
|
|
53
|
-
var DB_NAME =
|
|
53
|
+
var DB_NAME = context.environment.envVars["DB_NAME"];
|
|
54
54
|
if (!DB_NAME) {
|
|
55
55
|
throw new Error("error: env vars did not specify DB_NAME");
|
|
56
56
|
}
|
|
57
|
-
var
|
|
58
|
-
projectId =
|
|
59
|
-
region =
|
|
60
|
-
instanceId =
|
|
57
|
+
var _a = __read(deployConfig.cloudSql.instanceConnectionName.split(":"), 3),
|
|
58
|
+
projectId = _a[0],
|
|
59
|
+
region = _a[1],
|
|
60
|
+
instanceId = _a[2];
|
|
61
61
|
// may fail if it already exists
|
|
62
62
|
return (0, gitlab_1.allowFailureInScripts)(["echo \"ensuring Database...\"", "gcloud sql databases create ".concat(DB_NAME, " --instance=").concat(instanceId, " --project ").concat(projectId)]);
|
|
63
63
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Context } from "../../../types/context";
|
|
2
|
-
export declare const getServiceName: (context: Context) => string;
|
|
2
|
+
export declare const getServiceName: (context: Context) => string | import("../../../bash/BashExpression").BashExpression;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { StringOrBashExpression } from "../../../bash/BashExpression";
|
|
2
|
+
export declare const getCloudRunJobName: (fullAppName: StringOrBashExpression, jobName: string) => StringOrBashExpression;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
4
6
|
exports.getCloudRunJobName = void 0;
|
|
5
7
|
var getCloudRunJobName = function (fullAppName, jobName) {
|
|
6
|
-
return fullAppName.toLowerCase()
|
|
8
|
+
return fullAppName.toLowerCase().concat("-" + jobName.toLowerCase());
|
|
7
9
|
};
|
|
8
10
|
exports.getCloudRunJobName = getCloudRunJobName;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Config } from "../..";
|
|
2
|
+
import type { StringOrBashExpression } from "../../bash/BashExpression";
|
|
2
3
|
import type { DeployConfigCloudRunCloudSql, DeployConfigKubernetesValuesCloudSQLUnmanaged } from "../types";
|
|
3
|
-
export declare const getFullDbName: (cloudSqlConfig: DeployConfigCloudRunCloudSql | DeployConfigKubernetesValuesCloudSQLUnmanaged, fullConfig: Config<never>, environmentSlugPrefix:
|
|
4
|
+
export declare const getFullDbName: (cloudSqlConfig: DeployConfigCloudRunCloudSql | DeployConfigKubernetesValuesCloudSQLUnmanaged, fullConfig: Config<never>, environmentSlugPrefix: StringOrBashExpression, componentName: string) => StringOrBashExpression;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
4
6
|
exports.getFullDbName = void 0;
|
|
7
|
+
var BashExpression_1 = require("../../bash/BashExpression");
|
|
5
8
|
var getFullDbName = function (cloudSqlConfig, fullConfig, environmentSlugPrefix, componentName) {
|
|
6
9
|
var _a, _b;
|
|
7
|
-
return [(_a = cloudSqlConfig.dbNamePrefix) !== null && _a !== void 0 ? _a : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlugPrefix, (_b = cloudSqlConfig.dbBaseName) !== null && _b !== void 0 ? _b : componentName].
|
|
10
|
+
return (0, BashExpression_1.joinBashExpressions)([(_a = cloudSqlConfig.dbNamePrefix) !== null && _a !== void 0 ? _a : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlugPrefix, (_b = cloudSqlConfig.dbBaseName) !== null && _b !== void 0 ? _b : componentName].flatMap(function (part) {
|
|
11
|
+
return part ? [part] : [];
|
|
12
|
+
}), "-");
|
|
8
13
|
};
|
|
9
14
|
exports.getFullDbName = getFullDbName;
|
|
@@ -31,7 +31,9 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
31
31
|
}
|
|
32
32
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33
33
|
};
|
|
34
|
-
exports
|
|
34
|
+
Object.defineProperty(exports, "__esModule", {
|
|
35
|
+
value: true
|
|
36
|
+
});
|
|
35
37
|
exports.createCustomDeployJobs = void 0;
|
|
36
38
|
var yarn_1 = require("../../build/node/yarn");
|
|
37
39
|
var runner_1 = require("../../runner");
|
|
@@ -41,7 +41,9 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
41
41
|
}
|
|
42
42
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
43
43
|
};
|
|
44
|
-
exports
|
|
44
|
+
Object.defineProperty(exports, "__esModule", {
|
|
45
|
+
value: true
|
|
46
|
+
});
|
|
45
47
|
exports.createDockerTagDeployJobs = void 0;
|
|
46
48
|
var docker_1 = require("../../build/docker");
|
|
47
49
|
var base_1 = require("../base");
|
package/dist/deploy/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SecretEnvVar } from "..";
|
|
2
|
+
import type { BashExpression } from "../bash/BashExpression";
|
|
2
3
|
import type { Context } from "../types/context";
|
|
3
4
|
import type { EnvironmentContext } from "../types/environmentContext";
|
|
4
5
|
import type { CatladderJob } from "../types/jobs";
|
|
@@ -8,11 +9,11 @@ export * from "./cloudRun";
|
|
|
8
9
|
export * from "./kubernetes";
|
|
9
10
|
export * from "./types";
|
|
10
11
|
export * from "./utils";
|
|
11
|
-
export
|
|
12
|
+
export type DeployTypeDefinition<T extends DeployConfigType> = {
|
|
12
13
|
jobs: (context: Context) => CatladderJob[];
|
|
13
14
|
defaults: (envContext: EnvironmentContext<any, T>) => PartialDeep<DeployConfigGeneric<T>>;
|
|
14
15
|
additionalSecretKeys: (envContext: EnvironmentContext<any, T>) => SecretEnvVar[];
|
|
15
|
-
getAdditionalEnvVars: (envContext: EnvironmentContext<any, T>) => Record<string, string | undefined | null>;
|
|
16
|
+
getAdditionalEnvVars: (envContext: EnvironmentContext<any, T>) => Record<string, string | BashExpression | undefined | null>;
|
|
16
17
|
};
|
|
17
|
-
export
|
|
18
|
+
export type DeployTypes = { [T in DeployConfigType]: DeployTypeDefinition<T> };
|
|
18
19
|
export declare const DEPLOY_TYPES: DeployTypes;
|
package/dist/deploy/index.js
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
4
|
if (k2 === undefined) k2 = k;
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
11
15
|
} : function (o, m, k, k2) {
|
|
12
16
|
if (k2 === undefined) k2 = k;
|
|
13
17
|
o[k2] = m[k];
|
|
@@ -15,7 +19,9 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
|
|
|
15
19
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
16
20
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
21
|
};
|
|
18
|
-
exports
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
19
25
|
exports.DEPLOY_TYPES = void 0;
|
|
20
26
|
var cloudRun_1 = require("./cloudRun");
|
|
21
27
|
var custom_1 = require("./custom");
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { StringOrBashExpression } from "../../../bash/BashExpression";
|
|
1
2
|
import type { Context } from "../../../types";
|
|
2
3
|
export declare const hasKubernetesCloudSQL: (context: Context) => boolean | undefined;
|
|
3
|
-
|
|
4
|
+
type CloudSqlValues = {
|
|
4
5
|
enabled: boolean;
|
|
5
6
|
proxyCredentials: string;
|
|
6
7
|
instanceConnectionName: string;
|
|
7
|
-
fullDbName:
|
|
8
|
+
fullDbName: StringOrBashExpression;
|
|
8
9
|
dbUser: string;
|
|
9
10
|
};
|
|
10
11
|
export declare const createKubernetesCloudsqlBaseValues: (context: Context) => {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
4
6
|
exports.createKubernetesCloudsqlBaseValues = exports.hasKubernetesCloudSQL = void 0;
|
|
5
7
|
var context_1 = require("../../../context");
|
|
6
8
|
var utils_1 = require("../../cloudSql/utils");
|
|
@@ -14,7 +16,7 @@ var hasKubernetesCloudSQL = function (context) {
|
|
|
14
16
|
};
|
|
15
17
|
exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
|
|
16
18
|
var createKubernetesCloudsqlBaseValues = function (context) {
|
|
17
|
-
var _a, _b, _c, _d, _e;
|
|
19
|
+
var _a, _b, _c, _d, _e, _f;
|
|
18
20
|
if (!(0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
|
|
19
21
|
throw new Error("cannot get cloud sql config");
|
|
20
22
|
}
|
|
@@ -31,14 +33,14 @@ var createKubernetesCloudsqlBaseValues = function (context) {
|
|
|
31
33
|
dbUser: "postgres",
|
|
32
34
|
instanceConnectionName: instanceConnectionName,
|
|
33
35
|
proxyCredentials: proxyCredentials,
|
|
34
|
-
fullDbName: context.environment.envVars.KUBE_APP_NAME
|
|
36
|
+
fullDbName: (_e = context.environment.envVars.KUBE_APP_NAME) !== null && _e !== void 0 ? _e : ""
|
|
35
37
|
}
|
|
36
38
|
};
|
|
37
39
|
} else if (config.type === "unmanaged") {
|
|
38
40
|
return {
|
|
39
41
|
cloudsql: {
|
|
40
42
|
enabled: config.enabled,
|
|
41
|
-
dbUser: (
|
|
43
|
+
dbUser: (_f = config.dbUser) !== null && _f !== void 0 ? _f : "postgres",
|
|
42
44
|
instanceConnectionName: config.instanceConnectionName,
|
|
43
45
|
proxyCredentials: proxyCredentials,
|
|
44
46
|
fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.componentName)
|