@catladder/pipeline 1.68.0 โ†’ 1.70.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.
@@ -24,6 +24,8 @@ var custom_1 = require("./custom");
24
24
 
25
25
  var node_1 = require("./node");
26
26
 
27
+ var rails_1 = require("./rails");
28
+
27
29
  __exportStar(require("./types"), exports);
28
30
 
29
31
  __exportStar(require("./node"), exports);
@@ -67,5 +69,11 @@ exports.BUILD_TYPES = {
67
69
  defaults: function () {
68
70
  return {};
69
71
  }
72
+ },
73
+ rails: {
74
+ jobs: rails_1.createRailsJobs,
75
+ defaults: function () {
76
+ return {};
77
+ }
70
78
  }
71
79
  };
@@ -0,0 +1,3 @@
1
+ import type { Context } from "../..";
2
+ import type { CatladderJob } from "../../types/jobs";
3
+ export declare const createRailsBuildJobs: (context: Context) => CatladderJob[];
@@ -0,0 +1,37 @@
1
+ "use strict";
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
+
8
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
9
+ }
10
+
11
+ return t;
12
+ };
13
+
14
+ return __assign.apply(this, arguments);
15
+ };
16
+
17
+ exports.__esModule = true;
18
+ exports.createRailsBuildJobs = void 0;
19
+
20
+ var docker_1 = require("../docker");
21
+
22
+ var createRailsBuildJobs = function (context) {
23
+ return [(0, docker_1.createDockerBuildJobBase)(context, {
24
+ variables: __assign({
25
+ CNB_BUILDER: "heroku/buildpacks:18",
26
+ CNB_ENV_VARS: "BUNDLE_GIT__PANTER__CH",
27
+ CNB_EXTRA_ARGS: "",
28
+ CNB_PACK_VERSION: "0.20.0"
29
+ }, context.componentConfig.build.extraVars),
30
+ // custom script
31
+ 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
32
+ // eslint-disable-next-line no-useless-escape
33
+ "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"]
34
+ })];
35
+ };
36
+
37
+ exports.createRailsBuildJobs = createRailsBuildJobs;
@@ -0,0 +1,3 @@
1
+ import { Context } from "../../types";
2
+ import { CatladderJob } from "../../types/jobs";
3
+ export declare const createRailsJobs: (context: Context) => CatladderJob[];
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
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
+
11
+ try {
12
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
13
+ } catch (error) {
14
+ e = {
15
+ error: error
16
+ };
17
+ } finally {
18
+ try {
19
+ if (r && !r.done && (m = i["return"])) m.call(i);
20
+ } finally {
21
+ if (e) throw e.error;
22
+ }
23
+ }
24
+
25
+ return ar;
26
+ };
27
+
28
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
29
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
30
+ if (ar || !(i in from)) {
31
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
32
+ ar[i] = from[i];
33
+ }
34
+ }
35
+ return to.concat(ar || Array.prototype.slice.call(from));
36
+ };
37
+
38
+ exports.__esModule = true;
39
+ exports.createRailsJobs = void 0;
40
+
41
+ var build_1 = require("./build");
42
+
43
+ var test_1 = require("./test");
44
+
45
+ var createRailsJobs = function (context) {
46
+ return __spreadArray(__spreadArray([], __read((0, test_1.createRailsTestJobs)(context)), false), __read((0, build_1.createRailsBuildJobs)(context)), false);
47
+ };
48
+
49
+ exports.createRailsJobs = createRailsJobs;
@@ -0,0 +1,3 @@
1
+ import type { Context } from "../..";
2
+ import type { CatladderJob } from "../../types/jobs";
3
+ export declare const createRailsTestJobs: (context: Context) => CatladderJob[];
@@ -0,0 +1,107 @@
1
+ "use strict";
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
+
8
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
9
+ }
10
+
11
+ return t;
12
+ };
13
+
14
+ return __assign.apply(this, arguments);
15
+ };
16
+
17
+ var __read = this && this.__read || function (o, n) {
18
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
19
+ if (!m) return o;
20
+ var i = m.call(o),
21
+ r,
22
+ ar = [],
23
+ e;
24
+
25
+ try {
26
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
27
+ } catch (error) {
28
+ e = {
29
+ error: error
30
+ };
31
+ } finally {
32
+ try {
33
+ if (r && !r.done && (m = i["return"])) m.call(i);
34
+ } finally {
35
+ if (e) throw e.error;
36
+ }
37
+ }
38
+
39
+ return ar;
40
+ };
41
+
42
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
43
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
44
+ if (ar || !(i in from)) {
45
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
46
+ ar[i] = from[i];
47
+ }
48
+ }
49
+ return to.concat(ar || Array.prototype.slice.call(from));
50
+ };
51
+
52
+ exports.__esModule = true;
53
+ exports.createRailsTestJobs = void 0;
54
+
55
+ var utils_1 = require("../../utils");
56
+
57
+ var createRailsTestJobs = function (context) {
58
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; // don't run tests after release
59
+
60
+
61
+ if (((_a = context.commitInfo) === null || _a === void 0 ? void 0 : _a.trigger) === "taggedRelease") {
62
+ return [];
63
+ }
64
+
65
+ var buildConfig = context.componentConfig.build;
66
+ var base = {
67
+ variables: (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {},
68
+ stage: "test",
69
+ needs: [],
70
+ envMode: "none"
71
+ };
72
+ var defaultImage = "docker.io/ruby";
73
+ var bundlerCacheDir = "tmp/cache";
74
+ var bundlerInstall = ["bundle config set path '".concat(bundlerCacheDir, "'"), "bundle install -j $(nproc)"];
75
+ var bundlerCache = {
76
+ key: {
77
+ files: ["Gemfile.lock"],
78
+ prefix: "$CI_JOB_IMAGE"
79
+ },
80
+ paths: [bundlerCacheDir]
81
+ };
82
+ var auditJob = buildConfig.audit !== false ? __assign(__assign({
83
+ name: "๐Ÿ›ก audit"
84
+ }, base), {
85
+ cache: undefined,
86
+ image: (_d = (_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.jobImage) !== null && _d !== void 0 ? _d : defaultImage,
87
+ 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),
88
+ allow_failure: true
89
+ }) : null;
90
+ var lintJob = buildConfig.lint !== false ? __assign(__assign({
91
+ name: "๐Ÿ‘ฎ lint"
92
+ }, base), {
93
+ cache: bundlerCache,
94
+ image: (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : defaultImage,
95
+ 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)
96
+ }) : null;
97
+ var testJob = buildConfig.test !== false ? __assign(__assign({
98
+ name: "๐Ÿงช test"
99
+ }, base), {
100
+ cache: bundlerCache,
101
+ image: (_m = (_l = buildConfig.test) === null || _l === void 0 ? void 0 : _l.jobImage) !== null && _m !== void 0 ? _m : defaultImage,
102
+ 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)
103
+ }) : null;
104
+ return [auditJob, lintJob, testJob].filter(utils_1.notNil);
105
+ };
106
+
107
+ exports.createRailsTestJobs = createRailsTestJobs;
@@ -28,6 +28,7 @@ export declare type BuildConfigBase = {
28
28
 
29
29
  lint?: false | {
30
30
  command?: string | string[];
31
+ jobImage?: string;
31
32
  };
32
33
  /**
33
34
  * customize test, set false to disable
@@ -35,6 +36,7 @@ export declare type BuildConfigBase = {
35
36
 
36
37
  test?: false | {
37
38
  command?: string | string[];
39
+ jobImage?: string;
38
40
  };
39
41
  /**
40
42
  * customize audit, set false to disable
@@ -42,6 +44,7 @@ export declare type BuildConfigBase = {
42
44
 
43
45
  audit?: false | {
44
46
  command?: string | string[];
47
+ jobImage?: string;
45
48
  };
46
49
  /**
47
50
  * additional paths for artifacts,
@@ -98,16 +101,19 @@ export declare type BuildConfigCustom = BuildConfigBase & {
98
101
  jobServices?: GitlabJobService[];
99
102
  docker: BuildConfigCustomDocker;
100
103
  };
104
+ export declare type BuildConfigRails = BuildConfigBase & {
105
+ type: "rails";
106
+ };
101
107
  export declare type BuildConfigStorybook = BuildConfigNodeBase & {
102
108
  type: "storybook";
103
109
  startCommand?: never;
104
110
  };
105
- export declare type BuildConfig = BuildConfigNode | BuildConfigNodeStatic | BuildConfigStorybook | BuildConfigMeteor | BuildConfigCustom;
111
+ export declare type BuildConfig = BuildConfigNode | BuildConfigNodeStatic | BuildConfigStorybook | BuildConfigMeteor | BuildConfigCustom | BuildConfigRails;
106
112
  export declare type BuildConfigType = BuildConfig["type"];
107
113
  export declare type BuildConfigGeneric<T extends BuildConfigType> = Extract<BuildConfig, {
108
114
  type: T;
109
115
  }>;
110
- export declare const isOfBuildType: <T extends ("node" | "node-static" | "meteor" | "custom" | "storybook")[]>(t: BuildConfig, ...types: T) => t is Extract<BuildConfigNode, {
116
+ export declare const isOfBuildType: <T extends ("node" | "node-static" | "meteor" | "custom" | "rails" | "storybook")[]>(t: BuildConfig, ...types: T) => t is Extract<BuildConfigNode, {
111
117
  type: T[number];
112
118
  }> | Extract<BuildConfigNodeStatic, {
113
119
  type: T[number];
@@ -115,6 +121,8 @@ export declare const isOfBuildType: <T extends ("node" | "node-static" | "meteor
115
121
  type: T[number];
116
122
  }> | Extract<BuildConfigCustom, {
117
123
  type: T[number];
124
+ }> | Extract<BuildConfigRails, {
125
+ type: T[number];
118
126
  }> | Extract<BuildConfigStorybook, {
119
127
  type: T[number];
120
128
  }>;