@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.
@@ -23,7 +23,7 @@ var detectBuildConfig = function (gitlabCi) {
23
23
  return "meteor";
24
24
  }
25
25
  if (firstInclude.file === "rails-kubernetes.yml") {
26
- throw new Error("rails is not yet implemented");
26
+ return "rails";
27
27
  }
28
28
  };
29
29
  exports.detectBuildConfig = detectBuildConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"oldGitlabCi.js","sourceRoot":"","sources":["../../../../../src/apps/cli/verify/migration/oldGitlabCi.ts"],"names":[],"mappings":";;;AAkBO,IAAM,YAAY,GAAG,UAAC,QAAyB;;IACpD,OAAO,CAAA,MAAA,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,0CAAE,OAAO,MAAK,qBAAqB,CAAC;AAChE,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEK,IAAM,iBAAiB,GAAG,UAC/B,QAAyB;IAEzB,IAAI,CAAC,IAAA,oBAAY,EAAC,QAAQ,CAAC,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;KAC/C;IAED,IAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAEzC,IAAI,YAAY,CAAC,IAAI,KAAK,cAAc;QAAE,OAAO,UAAU,CAAC;IAE5D,IAAI,YAAY,CAAC,IAAI,KAAK,qBAAqB,EAAE;QAC/C,OAAO,MAAM,CAAC;KACf;IAED,IAAI,YAAY,CAAC,IAAI,KAAK,0BAA0B,EAAE;QACpD,OAAO,aAAa,CAAC;KACtB;IACD,IAAI,YAAY,CAAC,IAAI,KAAK,uBAAuB,EAAE;QACjD,OAAO,QAAQ,CAAC;KACjB;IAED,IAAI,YAAY,CAAC,IAAI,KAAK,sBAAsB,EAAE;QAChD,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;KACjD;AACH,CAAC,CAAC;AAzBW,QAAA,iBAAiB,qBAyB5B"}
1
+ {"version":3,"file":"oldGitlabCi.js","sourceRoot":"","sources":["../../../../../src/apps/cli/verify/migration/oldGitlabCi.ts"],"names":[],"mappings":";;;AAkBO,IAAM,YAAY,GAAG,UAAC,QAAyB;;IACpD,OAAO,CAAA,MAAA,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,0CAAE,OAAO,MAAK,qBAAqB,CAAC;AAChE,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEK,IAAM,iBAAiB,GAAG,UAC/B,QAAyB;IAEzB,IAAI,CAAC,IAAA,oBAAY,EAAC,QAAQ,CAAC,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;KAC/C;IAED,IAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAEzC,IAAI,YAAY,CAAC,IAAI,KAAK,cAAc;QAAE,OAAO,UAAU,CAAC;IAE5D,IAAI,YAAY,CAAC,IAAI,KAAK,qBAAqB,EAAE;QAC/C,OAAO,MAAM,CAAC;KACf;IAED,IAAI,YAAY,CAAC,IAAI,KAAK,0BAA0B,EAAE;QACpD,OAAO,aAAa,CAAC;KACtB;IACD,IAAI,YAAY,CAAC,IAAI,KAAK,uBAAuB,EAAE;QACjD,OAAO,QAAQ,CAAC;KACjB;IAED,IAAI,YAAY,CAAC,IAAI,KAAK,sBAAsB,EAAE;QAChD,OAAO,OAAO,CAAC;KAChB;AACH,CAAC,CAAC;AAzBW,QAAA,iBAAiB,qBAyB5B"}
@@ -39193,6 +39193,8 @@ var custom_1 = __nccwpck_require__(3437);
39193
39193
 
39194
39194
  var node_1 = __nccwpck_require__(6994);
39195
39195
 
39196
+ var rails_1 = __nccwpck_require__(4665);
39197
+
39196
39198
  __exportStar(__nccwpck_require__(1197), exports);
39197
39199
 
39198
39200
  __exportStar(__nccwpck_require__(6994), exports);
@@ -39236,6 +39238,12 @@ exports.BUILD_TYPES = {
39236
39238
  defaults: function () {
39237
39239
  return {};
39238
39240
  }
39241
+ },
39242
+ rails: {
39243
+ jobs: rails_1.createRailsJobs,
39244
+ defaults: function () {
39245
+ return {};
39246
+ }
39239
39247
  }
39240
39248
  };
39241
39249
 
@@ -39850,6 +39858,220 @@ exports.getYarnInstall = getYarnInstall;
39850
39858
 
39851
39859
  /***/ }),
39852
39860
 
39861
+ /***/ 8597:
39862
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
39863
+
39864
+ "use strict";
39865
+
39866
+
39867
+ var __assign = this && this.__assign || function () {
39868
+ __assign = Object.assign || function (t) {
39869
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
39870
+ s = arguments[i];
39871
+
39872
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
39873
+ }
39874
+
39875
+ return t;
39876
+ };
39877
+
39878
+ return __assign.apply(this, arguments);
39879
+ };
39880
+
39881
+ exports.__esModule = true;
39882
+ exports.createRailsBuildJobs = void 0;
39883
+
39884
+ var docker_1 = __nccwpck_require__(3219);
39885
+
39886
+ var createRailsBuildJobs = function (context) {
39887
+ return [(0, docker_1.createDockerBuildJobBase)(context, {
39888
+ variables: __assign({
39889
+ CNB_BUILDER: "heroku/buildpacks:18",
39890
+ CNB_ENV_VARS: "BUNDLE_GIT__PANTER__CH",
39891
+ CNB_EXTRA_ARGS: "",
39892
+ CNB_PACK_VERSION: "0.20.0"
39893
+ }, context.componentConfig.build.extraVars),
39894
+ // custom script
39895
+ 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
39896
+ // eslint-disable-next-line no-useless-escape
39897
+ "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"]
39898
+ })];
39899
+ };
39900
+
39901
+ exports.createRailsBuildJobs = createRailsBuildJobs;
39902
+
39903
+ /***/ }),
39904
+
39905
+ /***/ 4665:
39906
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
39907
+
39908
+ "use strict";
39909
+
39910
+
39911
+ var __read = this && this.__read || function (o, n) {
39912
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
39913
+ if (!m) return o;
39914
+ var i = m.call(o),
39915
+ r,
39916
+ ar = [],
39917
+ e;
39918
+
39919
+ try {
39920
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
39921
+ } catch (error) {
39922
+ e = {
39923
+ error: error
39924
+ };
39925
+ } finally {
39926
+ try {
39927
+ if (r && !r.done && (m = i["return"])) m.call(i);
39928
+ } finally {
39929
+ if (e) throw e.error;
39930
+ }
39931
+ }
39932
+
39933
+ return ar;
39934
+ };
39935
+
39936
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
39937
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
39938
+ if (ar || !(i in from)) {
39939
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
39940
+ ar[i] = from[i];
39941
+ }
39942
+ }
39943
+ return to.concat(ar || Array.prototype.slice.call(from));
39944
+ };
39945
+
39946
+ exports.__esModule = true;
39947
+ exports.createRailsJobs = void 0;
39948
+
39949
+ var build_1 = __nccwpck_require__(8597);
39950
+
39951
+ var test_1 = __nccwpck_require__(5444);
39952
+
39953
+ var createRailsJobs = function (context) {
39954
+ return __spreadArray(__spreadArray([], __read((0, test_1.createRailsTestJobs)(context)), false), __read((0, build_1.createRailsBuildJobs)(context)), false);
39955
+ };
39956
+
39957
+ exports.createRailsJobs = createRailsJobs;
39958
+
39959
+ /***/ }),
39960
+
39961
+ /***/ 5444:
39962
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
39963
+
39964
+ "use strict";
39965
+
39966
+
39967
+ var __assign = this && this.__assign || function () {
39968
+ __assign = Object.assign || function (t) {
39969
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
39970
+ s = arguments[i];
39971
+
39972
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
39973
+ }
39974
+
39975
+ return t;
39976
+ };
39977
+
39978
+ return __assign.apply(this, arguments);
39979
+ };
39980
+
39981
+ var __read = this && this.__read || function (o, n) {
39982
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
39983
+ if (!m) return o;
39984
+ var i = m.call(o),
39985
+ r,
39986
+ ar = [],
39987
+ e;
39988
+
39989
+ try {
39990
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
39991
+ } catch (error) {
39992
+ e = {
39993
+ error: error
39994
+ };
39995
+ } finally {
39996
+ try {
39997
+ if (r && !r.done && (m = i["return"])) m.call(i);
39998
+ } finally {
39999
+ if (e) throw e.error;
40000
+ }
40001
+ }
40002
+
40003
+ return ar;
40004
+ };
40005
+
40006
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
40007
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
40008
+ if (ar || !(i in from)) {
40009
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
40010
+ ar[i] = from[i];
40011
+ }
40012
+ }
40013
+ return to.concat(ar || Array.prototype.slice.call(from));
40014
+ };
40015
+
40016
+ exports.__esModule = true;
40017
+ exports.createRailsTestJobs = void 0;
40018
+
40019
+ var utils_1 = __nccwpck_require__(7461);
40020
+
40021
+ var createRailsTestJobs = function (context) {
40022
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; // don't run tests after release
40023
+
40024
+
40025
+ if (((_a = context.commitInfo) === null || _a === void 0 ? void 0 : _a.trigger) === "taggedRelease") {
40026
+ return [];
40027
+ }
40028
+
40029
+ var buildConfig = context.componentConfig.build;
40030
+ var base = {
40031
+ variables: (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {},
40032
+ stage: "test",
40033
+ needs: [],
40034
+ envMode: "none"
40035
+ };
40036
+ var defaultImage = "docker.io/ruby";
40037
+ var bundlerCacheDir = "tmp/cache";
40038
+ var bundlerInstall = ["bundle config set path '".concat(bundlerCacheDir, "'"), "bundle install -j $(nproc)"];
40039
+ var bundlerCache = {
40040
+ key: {
40041
+ files: ["Gemfile.lock"],
40042
+ prefix: "$CI_JOB_IMAGE"
40043
+ },
40044
+ paths: [bundlerCacheDir]
40045
+ };
40046
+ var auditJob = buildConfig.audit !== false ? __assign(__assign({
40047
+ name: "๐Ÿ›ก audit"
40048
+ }, base), {
40049
+ cache: undefined,
40050
+ image: (_d = (_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.jobImage) !== null && _d !== void 0 ? _d : defaultImage,
40051
+ 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),
40052
+ allow_failure: true
40053
+ }) : null;
40054
+ var lintJob = buildConfig.lint !== false ? __assign(__assign({
40055
+ name: "๐Ÿ‘ฎ lint"
40056
+ }, base), {
40057
+ cache: bundlerCache,
40058
+ image: (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : defaultImage,
40059
+ 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)
40060
+ }) : null;
40061
+ var testJob = buildConfig.test !== false ? __assign(__assign({
40062
+ name: "๐Ÿงช test"
40063
+ }, base), {
40064
+ cache: bundlerCache,
40065
+ image: (_m = (_l = buildConfig.test) === null || _l === void 0 ? void 0 : _l.jobImage) !== null && _m !== void 0 ? _m : defaultImage,
40066
+ 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)
40067
+ }) : null;
40068
+ return [auditJob, lintJob, testJob].filter(utils_1.notNil);
40069
+ };
40070
+
40071
+ exports.createRailsTestJobs = createRailsTestJobs;
40072
+
40073
+ /***/ }),
40074
+
39853
40075
  /***/ 1197:
39854
40076
  /***/ ((__unused_webpack_module, exports) => {
39855
40077
 
@@ -40074,7 +40296,7 @@ exports.readConfigSync = readConfigSync;
40074
40296
 
40075
40297
  exports.__esModule = true;
40076
40298
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
40077
- exports.PIPELINE_IMAGE_TAG = "main-e52d6632" || 0;
40299
+ exports.PIPELINE_IMAGE_TAG = "main-344735ad" || 0;
40078
40300
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
40079
40301
 
40080
40302
  /***/ }),
@@ -40617,8 +40839,9 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
40617
40839
  additionalEnvVars = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].getAdditionalEnvVars(environmentContext) : {};
40618
40840
  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";
40619
40841
  url = "https://".concat(host);
40620
- predefinedVariables = __assign(__assign(__assign({}, basePredefinedVariables), {
40621
- HOST: host,
40842
+ predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), config.components[componentName].build.type === "rails" ? {} : {
40843
+ HOST: host
40844
+ }), {
40622
40845
  ROOT_URL: url
40623
40846
  }), additionalEnvVars);
40624
40847
  }
@@ -41556,7 +41779,7 @@ var setExtraVarsScripts = function (deployConfig) {
41556
41779
  };
41557
41780
 
41558
41781
  var createGoogleCloudRunDeployJobs = function (context) {
41559
- var _a;
41782
+ var _a, _b, _c;
41560
41783
 
41561
41784
  var deployConfig = context.componentConfig.deploy;
41562
41785
 
@@ -41616,12 +41839,31 @@ var createGoogleCloudRunDeployJobs = function (context) {
41616
41839
  };
41617
41840
  });
41618
41841
 
41619
- var getServiceDeployScript = function (service) {
41842
+ var getServiceDeployScript = function (service, nameSuffix) {
41620
41843
  var _a;
41621
41844
 
41845
+ var customConfig = service !== true ? service : undefined;
41622
41846
  var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand : undefined;
41623
41847
  var commandArg = command ? "--command=\"".concat(command.split(" ").join(","), "\"") : "";
41624
- return "gcloud run deploy ".concat(serviceName, " ").concat(commandArg, " ").concat(commonDeployArgs, " --env-vars-file=____envvars.yaml --allow-unauthenticated");
41848
+ var args = {
41849
+ "allow-unauthenticated": true,
41850
+ "min-instances": customConfig === null || customConfig === void 0 ? void 0 : customConfig.minInstances,
41851
+ "max-instances": customConfig === null || customConfig === void 0 ? void 0 : customConfig.maxInstances,
41852
+ "no-cpu-throttling": customConfig === null || customConfig === void 0 ? void 0 : customConfig.noCpuThrottling
41853
+ };
41854
+ var argsString = Object.entries(args).filter(function (_a) {
41855
+ var _b = __read(_a, 2),
41856
+ value = _b[1];
41857
+
41858
+ return !(0, lodash_1.isNil)(value);
41859
+ }).map(function (_a) {
41860
+ var _b = __read(_a, 2),
41861
+ key = _b[0],
41862
+ value = _b[1];
41863
+
41864
+ return "--".concat(key).concat(value !== true ? "=".concat(value) : "");
41865
+ }).join(" ");
41866
+ return "gcloud run deploy ".concat(serviceName).concat(nameSuffix !== null && nameSuffix !== void 0 ? nameSuffix : "", " ").concat(commandArg, " ").concat(commonDeployArgs, " --env-vars-file=____envvars.yaml ").concat(argsString);
41625
41867
  };
41626
41868
 
41627
41869
  var getJobCreateScriptsForJob = function (jobName, job) {
@@ -41678,10 +41920,21 @@ var createGoogleCloudRunDeployJobs = function (context) {
41678
41920
  });
41679
41921
  };
41680
41922
 
41681
- 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
41682
- : []), 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);
41923
+ 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
41924
+ : []), 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) {
41925
+ var _b = __read(_a, 2),
41926
+ name = _b[0],
41927
+ service = _b[1];
41928
+
41929
+ return getServiceDeployScript(service, "-" + name);
41930
+ })), false), __read(getJobRunScripts("postDeploy")), false), ["docker image rm ".concat(gcloudImageName)], false);
41931
+
41932
+ 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) {
41933
+ var _b = __read(_a, 1),
41934
+ name = _b[0];
41683
41935
 
41684
- 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);
41936
+ return "gcloud run services delete ".concat(serviceName, "-").concat(name, " ").concat(commonArgs);
41937
+ })), false), __read(getDeleteSchedulesScripts()), false), __read(getDeleteJobsScripts()), false), __read(deployConfig.cloudSql && deployConfig.cloudSql.deleteDatabaseOnStop ? (0, database_1.getDatabaseDeleteScript)(context, deployConfig) : []), false);
41685
41938
 
41686
41939
  return [(0, lodash_1.merge)({}, baseDeploymentJob, (0, docker_1.getDockerJobBaseProps)(context), {
41687
41940
  artifacts: {