@catladder/cli 0.0.0-main-e52d6632 โ†’ 0.0.0-main-344735ad

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.
@@ -5845,7 +5845,7 @@ var detectBuildConfig = function (gitlabCi) {
5845
5845
  return "meteor";
5846
5846
  }
5847
5847
  if (firstInclude.file === "rails-kubernetes.yml") {
5848
- throw new Error("rails is not yet implemented");
5848
+ return "rails";
5849
5849
  }
5850
5850
  };
5851
5851
  exports.detectBuildConfig = detectBuildConfig;
@@ -350144,6 +350144,8 @@ var custom_1 = __nccwpck_require__(53437);
350144
350144
 
350145
350145
  var node_1 = __nccwpck_require__(66994);
350146
350146
 
350147
+ var rails_1 = __nccwpck_require__(34665);
350148
+
350147
350149
  __exportStar(__nccwpck_require__(71197), exports);
350148
350150
 
350149
350151
  __exportStar(__nccwpck_require__(66994), exports);
@@ -350187,6 +350189,12 @@ exports.BUILD_TYPES = {
350187
350189
  defaults: function () {
350188
350190
  return {};
350189
350191
  }
350192
+ },
350193
+ rails: {
350194
+ jobs: rails_1.createRailsJobs,
350195
+ defaults: function () {
350196
+ return {};
350197
+ }
350190
350198
  }
350191
350199
  };
350192
350200
 
@@ -350801,6 +350809,220 @@ exports.getYarnInstall = getYarnInstall;
350801
350809
 
350802
350810
  /***/ }),
350803
350811
 
350812
+ /***/ 38597:
350813
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
350814
+
350815
+ "use strict";
350816
+
350817
+
350818
+ var __assign = this && this.__assign || function () {
350819
+ __assign = Object.assign || function (t) {
350820
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
350821
+ s = arguments[i];
350822
+
350823
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
350824
+ }
350825
+
350826
+ return t;
350827
+ };
350828
+
350829
+ return __assign.apply(this, arguments);
350830
+ };
350831
+
350832
+ exports.__esModule = true;
350833
+ exports.createRailsBuildJobs = void 0;
350834
+
350835
+ var docker_1 = __nccwpck_require__(33219);
350836
+
350837
+ var createRailsBuildJobs = function (context) {
350838
+ return [(0, docker_1.createDockerBuildJobBase)(context, {
350839
+ variables: __assign({
350840
+ CNB_BUILDER: "heroku/buildpacks:18",
350841
+ CNB_ENV_VARS: "BUNDLE_GIT__PANTER__CH",
350842
+ CNB_EXTRA_ARGS: "",
350843
+ CNB_PACK_VERSION: "0.20.0"
350844
+ }, context.componentConfig.build.extraVars),
350845
+ // custom script
350846
+ script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v$CNB_PACK_VERSION/pack-v$CNB_PACK_VERSION-linux.tgz | tar -zx --directory /usr/local/bin pack", "chmod +x /usr/local/bin/pack", // replace private git ssh gem sources with https to make bundler with credentials via env var work
350847
+ // eslint-disable-next-line no-useless-escape
350848
+ "sed --in-place 's|git@([^:]*):|https://1/|g' Gemfile Gemfile.lock", "for v in $CNB_ENV_VARS; do env_args=\"$env_args --env $v\"; done", "pack build $DOCKER_IMAGE:$DOCKER_IMAGE_TAG --builder $CNB_BUILDER --publish --cache-image $DOCKER_CACHE_IMAGE $env_args $CNB_EXTRA_ARGS"]
350849
+ })];
350850
+ };
350851
+
350852
+ exports.createRailsBuildJobs = createRailsBuildJobs;
350853
+
350854
+ /***/ }),
350855
+
350856
+ /***/ 34665:
350857
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
350858
+
350859
+ "use strict";
350860
+
350861
+
350862
+ var __read = this && this.__read || function (o, n) {
350863
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
350864
+ if (!m) return o;
350865
+ var i = m.call(o),
350866
+ r,
350867
+ ar = [],
350868
+ e;
350869
+
350870
+ try {
350871
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
350872
+ } catch (error) {
350873
+ e = {
350874
+ error: error
350875
+ };
350876
+ } finally {
350877
+ try {
350878
+ if (r && !r.done && (m = i["return"])) m.call(i);
350879
+ } finally {
350880
+ if (e) throw e.error;
350881
+ }
350882
+ }
350883
+
350884
+ return ar;
350885
+ };
350886
+
350887
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
350888
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
350889
+ if (ar || !(i in from)) {
350890
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
350891
+ ar[i] = from[i];
350892
+ }
350893
+ }
350894
+ return to.concat(ar || Array.prototype.slice.call(from));
350895
+ };
350896
+
350897
+ exports.__esModule = true;
350898
+ exports.createRailsJobs = void 0;
350899
+
350900
+ var build_1 = __nccwpck_require__(38597);
350901
+
350902
+ var test_1 = __nccwpck_require__(25444);
350903
+
350904
+ var createRailsJobs = function (context) {
350905
+ return __spreadArray(__spreadArray([], __read((0, test_1.createRailsTestJobs)(context)), false), __read((0, build_1.createRailsBuildJobs)(context)), false);
350906
+ };
350907
+
350908
+ exports.createRailsJobs = createRailsJobs;
350909
+
350910
+ /***/ }),
350911
+
350912
+ /***/ 25444:
350913
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
350914
+
350915
+ "use strict";
350916
+
350917
+
350918
+ var __assign = this && this.__assign || function () {
350919
+ __assign = Object.assign || function (t) {
350920
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
350921
+ s = arguments[i];
350922
+
350923
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
350924
+ }
350925
+
350926
+ return t;
350927
+ };
350928
+
350929
+ return __assign.apply(this, arguments);
350930
+ };
350931
+
350932
+ var __read = this && this.__read || function (o, n) {
350933
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
350934
+ if (!m) return o;
350935
+ var i = m.call(o),
350936
+ r,
350937
+ ar = [],
350938
+ e;
350939
+
350940
+ try {
350941
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
350942
+ } catch (error) {
350943
+ e = {
350944
+ error: error
350945
+ };
350946
+ } finally {
350947
+ try {
350948
+ if (r && !r.done && (m = i["return"])) m.call(i);
350949
+ } finally {
350950
+ if (e) throw e.error;
350951
+ }
350952
+ }
350953
+
350954
+ return ar;
350955
+ };
350956
+
350957
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
350958
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
350959
+ if (ar || !(i in from)) {
350960
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
350961
+ ar[i] = from[i];
350962
+ }
350963
+ }
350964
+ return to.concat(ar || Array.prototype.slice.call(from));
350965
+ };
350966
+
350967
+ exports.__esModule = true;
350968
+ exports.createRailsTestJobs = void 0;
350969
+
350970
+ var utils_1 = __nccwpck_require__(37461);
350971
+
350972
+ var createRailsTestJobs = function (context) {
350973
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; // don't run tests after release
350974
+
350975
+
350976
+ if (((_a = context.commitInfo) === null || _a === void 0 ? void 0 : _a.trigger) === "taggedRelease") {
350977
+ return [];
350978
+ }
350979
+
350980
+ var buildConfig = context.componentConfig.build;
350981
+ var base = {
350982
+ variables: (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {},
350983
+ stage: "test",
350984
+ needs: [],
350985
+ envMode: "none"
350986
+ };
350987
+ var defaultImage = "docker.io/ruby";
350988
+ var bundlerCacheDir = "tmp/cache";
350989
+ var bundlerInstall = ["bundle config set path '".concat(bundlerCacheDir, "'"), "bundle install -j $(nproc)"];
350990
+ var bundlerCache = {
350991
+ key: {
350992
+ files: ["Gemfile.lock"],
350993
+ prefix: "$CI_JOB_IMAGE"
350994
+ },
350995
+ paths: [bundlerCacheDir]
350996
+ };
350997
+ var auditJob = buildConfig.audit !== false ? __assign(__assign({
350998
+ name: "๐Ÿ›ก audit"
350999
+ }, base), {
351000
+ cache: undefined,
351001
+ image: (_d = (_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.jobImage) !== null && _d !== void 0 ? _d : defaultImage,
351002
+ script: __spreadArray(["cd ".concat(context.componentConfig.dir)], __read((_f = (0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : ["gem install bundler-audit", "bundle audit check"]), false),
351003
+ allow_failure: true
351004
+ }) : null;
351005
+ var lintJob = buildConfig.lint !== false ? __assign(__assign({
351006
+ name: "๐Ÿ‘ฎ lint"
351007
+ }, base), {
351008
+ cache: bundlerCache,
351009
+ image: (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : defaultImage,
351010
+ script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(bundlerInstall), false), __read((_k = (0, utils_1.ensureArray)((_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.command)) !== null && _k !== void 0 ? _k : ["bundle exec rubocop"]), false)
351011
+ }) : null;
351012
+ var testJob = buildConfig.test !== false ? __assign(__assign({
351013
+ name: "๐Ÿงช test"
351014
+ }, base), {
351015
+ cache: bundlerCache,
351016
+ image: (_m = (_l = buildConfig.test) === null || _l === void 0 ? void 0 : _l.jobImage) !== null && _m !== void 0 ? _m : defaultImage,
351017
+ script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(bundlerInstall), false), __read((_p = (0, utils_1.ensureArray)((_o = buildConfig.test) === null || _o === void 0 ? void 0 : _o.command)) !== null && _p !== void 0 ? _p : ["bundle exec rspec"]), false)
351018
+ }) : null;
351019
+ return [auditJob, lintJob, testJob].filter(utils_1.notNil);
351020
+ };
351021
+
351022
+ exports.createRailsTestJobs = createRailsTestJobs;
351023
+
351024
+ /***/ }),
351025
+
350804
351026
  /***/ 71197:
350805
351027
  /***/ ((__unused_webpack_module, exports) => {
350806
351028
 
@@ -351025,7 +351247,7 @@ exports.readConfigSync = readConfigSync;
351025
351247
 
351026
351248
  exports.__esModule = true;
351027
351249
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
351028
- exports.PIPELINE_IMAGE_TAG = "main-e52d6632" || 0;
351250
+ exports.PIPELINE_IMAGE_TAG = "main-344735ad" || 0;
351029
351251
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
351030
351252
 
351031
351253
  /***/ }),
@@ -351568,8 +351790,9 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
351568
351790
  additionalEnvVars = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].getAdditionalEnvVars(environmentContext) : {};
351569
351791
  host = (_c = (_b = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _b !== void 0 ? _b : additionalEnvVars.HOST_CANONICAL) !== null && _c !== void 0 ? _c : "unknown-host.example.com";
351570
351792
  url = "https://".concat(host);
351571
- predefinedVariables = __assign(__assign(__assign({}, basePredefinedVariables), {
351572
- HOST: host,
351793
+ predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), config.components[componentName].build.type === "rails" ? {} : {
351794
+ HOST: host
351795
+ }), {
351573
351796
  ROOT_URL: url
351574
351797
  }), additionalEnvVars);
351575
351798
  }
@@ -352507,7 +352730,7 @@ var setExtraVarsScripts = function (deployConfig) {
352507
352730
  };
352508
352731
 
352509
352732
  var createGoogleCloudRunDeployJobs = function (context) {
352510
- var _a;
352733
+ var _a, _b, _c;
352511
352734
 
352512
352735
  var deployConfig = context.componentConfig.deploy;
352513
352736
 
@@ -352567,12 +352790,31 @@ var createGoogleCloudRunDeployJobs = function (context) {
352567
352790
  };
352568
352791
  });
352569
352792
 
352570
- var getServiceDeployScript = function (service) {
352793
+ var getServiceDeployScript = function (service, nameSuffix) {
352571
352794
  var _a;
352572
352795
 
352796
+ var customConfig = service !== true ? service : undefined;
352573
352797
  var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand : undefined;
352574
352798
  var commandArg = command ? "--command=\"".concat(command.split(" ").join(","), "\"") : "";
352575
- return "gcloud run deploy ".concat(serviceName, " ").concat(commandArg, " ").concat(commonDeployArgs, " --env-vars-file=____envvars.yaml --allow-unauthenticated");
352799
+ var args = {
352800
+ "allow-unauthenticated": true,
352801
+ "min-instances": customConfig === null || customConfig === void 0 ? void 0 : customConfig.minInstances,
352802
+ "max-instances": customConfig === null || customConfig === void 0 ? void 0 : customConfig.maxInstances,
352803
+ "no-cpu-throttling": customConfig === null || customConfig === void 0 ? void 0 : customConfig.noCpuThrottling
352804
+ };
352805
+ var argsString = Object.entries(args).filter(function (_a) {
352806
+ var _b = __read(_a, 2),
352807
+ value = _b[1];
352808
+
352809
+ return !(0, lodash_1.isNil)(value);
352810
+ }).map(function (_a) {
352811
+ var _b = __read(_a, 2),
352812
+ key = _b[0],
352813
+ value = _b[1];
352814
+
352815
+ return "--".concat(key).concat(value !== true ? "=".concat(value) : "");
352816
+ }).join(" ");
352817
+ return "gcloud run deploy ".concat(serviceName).concat(nameSuffix !== null && nameSuffix !== void 0 ? nameSuffix : "", " ").concat(commandArg, " ").concat(commonDeployArgs, " --env-vars-file=____envvars.yaml ").concat(argsString);
352576
352818
  };
352577
352819
 
352578
352820
  var getJobCreateScriptsForJob = function (jobName, job) {
@@ -352629,10 +352871,21 @@ var createGoogleCloudRunDeployJobs = function (context) {
352629
352871
  });
352630
352872
  };
352631
352873
 
352632
- var deployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(setExtraVarsScripts(deployConfig)), false), __read(pushImageToArtifactsRegistry), false), ["echo \"$ENV_VARS\" > ____envvars.yaml"], false), __read(deployConfig.cloudSql ? (0, database_1.getDatabaseCreateScript)(context, deployConfig) // we create the db, so that we can also delete it afterwards
352633
- : []), false), __read(getCreateScheduleScripts()), false), __read(getJobCreateScripts()), false), __read(getJobRunScripts("preDeploy")), false), __read(deployConfig.service !== false ? [getServiceDeployScript(deployConfig.service)] : []), false), __read(getJobRunScripts("postDeploy")), false), ["docker image rm ".concat(gcloudImageName)], false);
352874
+ var deployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(setExtraVarsScripts(deployConfig)), false), __read(pushImageToArtifactsRegistry), false), ["echo \"$ENV_VARS\" > ____envvars.yaml"], false), __read(deployConfig.cloudSql ? (0, database_1.getDatabaseCreateScript)(context, deployConfig) // we create the db, so that we can also delete it afterwards
352875
+ : []), false), __read(getCreateScheduleScripts()), false), __read(getJobCreateScripts()), false), __read(getJobRunScripts("preDeploy")), false), __read(deployConfig.service !== false ? [getServiceDeployScript(deployConfig.service)] : []), false), __read(Object.entries((_b = deployConfig.additionalServices) !== null && _b !== void 0 ? _b : {}).map(function (_a) {
352876
+ var _b = __read(_a, 2),
352877
+ name = _b[0],
352878
+ service = _b[1];
352879
+
352880
+ return getServiceDeployScript(service, "-" + name);
352881
+ })), false), __read(getJobRunScripts("postDeploy")), false), ["docker image rm ".concat(gcloudImageName)], false);
352882
+
352883
+ var stopScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(deployConfig.service !== false ? ["gcloud run services delete ".concat(serviceName, " ").concat(commonArgs)] : []), false), __read(Object.entries((_c = deployConfig.additionalServices) !== null && _c !== void 0 ? _c : {}).map(function (_a) {
352884
+ var _b = __read(_a, 1),
352885
+ name = _b[0];
352634
352886
 
352635
- var stopScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(deployConfig.service !== false ? ["gcloud run services delete ".concat(serviceName, " ").concat(commonArgs)] : []), false), __read(getDeleteSchedulesScripts()), false), __read(getDeleteJobsScripts()), false), __read(deployConfig.cloudSql && deployConfig.cloudSql.deleteDatabaseOnStop ? (0, database_1.getDatabaseDeleteScript)(context, deployConfig) : []), false);
352887
+ return "gcloud run services delete ".concat(serviceName, "-").concat(name, " ").concat(commonArgs);
352888
+ })), false), __read(getDeleteSchedulesScripts()), false), __read(getDeleteJobsScripts()), false), __read(deployConfig.cloudSql && deployConfig.cloudSql.deleteDatabaseOnStop ? (0, database_1.getDatabaseDeleteScript)(context, deployConfig) : []), false);
352636
352889
 
352637
352890
  return [(0, lodash_1.merge)({}, baseDeploymentJob, (0, docker_1.getDockerJobBaseProps)(context), {
352638
352891
  artifacts: {