@catladder/pipeline 1.83.0 → 1.83.2

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.
@@ -65,7 +65,13 @@ exports.BUILD_TYPES = {
65
65
  rails: {
66
66
  jobs: rails_1.createRailsJobs,
67
67
  defaults: function () {
68
- return {};
68
+ return {
69
+ startCommand: "/cnb/process/web",
70
+ cnbBuilder: {
71
+ image: "heroku/buildpacks:20",
72
+ packVersion: "0.28.0"
73
+ }
74
+ };
69
75
  }
70
76
  }
71
77
  };
@@ -1,30 +1,55 @@
1
1
  "use strict";
2
2
 
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];
3
+ var __read = this && this.__read || function (o, n) {
4
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
5
+ if (!m) return o;
6
+ var i = m.call(o),
7
+ r,
8
+ ar = [],
9
+ e;
10
+ try {
11
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
12
+ } catch (error) {
13
+ e = {
14
+ error: error
15
+ };
16
+ } finally {
17
+ try {
18
+ if (r && !r.done && (m = i["return"])) m.call(i);
19
+ } finally {
20
+ if (e) throw e.error;
8
21
  }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
22
+ }
23
+ return ar;
12
24
  };
13
25
  exports.__esModule = true;
14
26
  exports.createRailsBuildJobs = void 0;
27
+ var types_1 = require("../types");
15
28
  var docker_1 = require("../docker");
16
29
  var createRailsBuildJobs = function (context) {
30
+ var _a, _b, _c, _d, _e, _f;
31
+ var buildConfig = context.componentConfig.build;
32
+ if (!(0, types_1.isOfBuildType)(buildConfig, "rails")) {
33
+ // should not happen
34
+ throw new Error("build type is not rails");
35
+ }
36
+ var cnbConf = buildConfig.cnbBuilder;
37
+ // backwards compatabilty with CNB_ENV_VARS
38
+ // TODO: remove when all projects are migrated
39
+ var packEnvArgs = (_c = (_b = (_a = buildConfig.extraVars) === null || _a === void 0 ? void 0 : _a.CNB_ENV_VARS) === null || _b === void 0 ? void 0 : _b.split(" ").map(function (v) {
40
+ return "--env '".concat(v, "'");
41
+ })) !== null && _c !== void 0 ? _c : Object.entries((_d = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.buildVars) !== null && _d !== void 0 ? _d : {}).map(function (_a) {
42
+ var _b = __read(_a, 2),
43
+ k = _b[0],
44
+ v = _b[1];
45
+ return "--env '".concat(k).concat(v ? "=".concat(v) : "", "'");
46
+ });
17
47
  return [(0, docker_1.createDockerBuildJobBase)(context, {
18
- variables: __assign({
19
- CNB_BUILDER: "heroku/buildpacks:18",
20
- CNB_ENV_VARS: "BUNDLE_GIT__PANTER__CH",
21
- CNB_EXTRA_ARGS: "",
22
- CNB_PACK_VERSION: "0.20.0"
23
- }, context.componentConfig.build.extraVars),
48
+ variables: context.componentConfig.build.extraVars,
24
49
  // custom script
25
- 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",
50
+ script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"), "chmod +x /usr/local/bin/pack",
26
51
  // replace private git ssh gem sources with https to make bundler with credentials via env var work
27
- "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"]
52
+ "sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "pack build \"$DOCKER_IMAGE:$DOCKER_IMAGE_TAG\" --builder '".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.image, "' --publish --cache-image \"$DOCKER_CACHE_IMAGE\" ").concat(packEnvArgs.join(" "), " ").concat((_f = (_e = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packExtraArgs) === null || _e === void 0 ? void 0 : _e.join(" ")) !== null && _f !== void 0 ? _f : "")]
28
53
  })];
29
54
  };
30
55
  exports.createRailsBuildJobs = createRailsBuildJobs;
@@ -1,3 +1,3 @@
1
- import { Context } from "../../types";
2
- import { CatladderJob } from "../../types/jobs";
1
+ import type { Context } from "../../types";
2
+ import type { CatladderJob } from "../../types/jobs";
3
3
  export declare const createRailsJobs: (context: Context) => CatladderJob[];
@@ -94,6 +94,33 @@ export declare type BuildConfigCustom = BuildConfigBase & {
94
94
  };
95
95
  export declare type BuildConfigRails = BuildConfigBase & {
96
96
  type: "rails";
97
+ cnbBuilder?: {
98
+ /**
99
+ * The Cloud Native Buildpacks builder image to use.
100
+ * See e.g. https://github.com/heroku/builder or others.
101
+ * Default: heroku/buildpacks:20
102
+ */
103
+ image?: string;
104
+ /**
105
+ * The version of the Cloud Native Buildpacks pack command to use.
106
+ * See https://buildpacks.io/docs/tools/pack/
107
+ * Default: 0.28.0
108
+ */
109
+ packVersion?: string;
110
+ /**
111
+ * Additional command arguments passed to the pack command.
112
+ * See https://buildpacks.io/docs/tools/pack/
113
+ */
114
+ packExtraArgs?: string[];
115
+ /**
116
+ * Variables needed for Bundler and Rails asset precompilation.
117
+ *
118
+ * Specify a key with the value `undefined` to inherit it from the EnvVars.
119
+ *
120
+ * See https://github.com/rails/rails/issues/32947
121
+ */
122
+ buildVars?: Record<string, string | undefined>;
123
+ };
97
124
  };
98
125
  export declare type BuildConfigStorybook = BuildConfigNodeBase & {
99
126
  type: "storybook";