gitlab-radiator 3.4.3 → 3.5.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/package.json +13 -14
- package/public/client.js +1 -1
- package/src/app.js +55 -74
- package/src/gitlab/index.js +63 -71
- package/src/gitlab/pipelines.js +194 -208
- package/src/gitlab/projects.js +46 -50
- package/src/gitlab/runners.js +28 -32
- package/src/less.js +58 -0
package/src/gitlab/pipelines.js
CHANGED
|
@@ -15,7 +15,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
15
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
16
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
17
17
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
18
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
19
19
|
function fetchLatestPipelines(_x, _x2) {
|
|
20
20
|
return _fetchLatestPipelines.apply(this, arguments);
|
|
21
21
|
} // eslint-disable-next-line max-statements
|
|
@@ -23,53 +23,49 @@ function _fetchLatestPipelines() {
|
|
|
23
23
|
_fetchLatestPipelines = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(projectId, gitlab) {
|
|
24
24
|
var pipelines;
|
|
25
25
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
26
|
-
while (1) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
case 4:
|
|
70
|
-
case "end":
|
|
71
|
-
return _context2.stop();
|
|
72
|
-
}
|
|
26
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
27
|
+
case 0:
|
|
28
|
+
_context2.next = 2;
|
|
29
|
+
return fetchLatestAndMasterPipeline(projectId, gitlab);
|
|
30
|
+
case 2:
|
|
31
|
+
pipelines = _context2.sent;
|
|
32
|
+
return _context2.abrupt("return", Promise.all(pipelines.map( /*#__PURE__*/function () {
|
|
33
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
|
|
34
|
+
var id, ref, status, _yield$fetchJobs, commit, stages, downstreamStages;
|
|
35
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
36
|
+
while (1) switch (_context.prev = _context.next) {
|
|
37
|
+
case 0:
|
|
38
|
+
id = _ref.id, ref = _ref.ref, status = _ref.status;
|
|
39
|
+
_context.next = 3;
|
|
40
|
+
return fetchJobs(projectId, id, gitlab);
|
|
41
|
+
case 3:
|
|
42
|
+
_yield$fetchJobs = _context.sent;
|
|
43
|
+
commit = _yield$fetchJobs.commit;
|
|
44
|
+
stages = _yield$fetchJobs.stages;
|
|
45
|
+
_context.next = 8;
|
|
46
|
+
return fetchDownstreamJobs(projectId, id, gitlab);
|
|
47
|
+
case 8:
|
|
48
|
+
downstreamStages = _context.sent;
|
|
49
|
+
return _context.abrupt("return", {
|
|
50
|
+
id,
|
|
51
|
+
ref,
|
|
52
|
+
status,
|
|
53
|
+
commit,
|
|
54
|
+
stages: stages.concat(downstreamStages)
|
|
55
|
+
});
|
|
56
|
+
case 10:
|
|
57
|
+
case "end":
|
|
58
|
+
return _context.stop();
|
|
59
|
+
}
|
|
60
|
+
}, _callee);
|
|
61
|
+
}));
|
|
62
|
+
return function (_x14) {
|
|
63
|
+
return _ref2.apply(this, arguments);
|
|
64
|
+
};
|
|
65
|
+
}())));
|
|
66
|
+
case 4:
|
|
67
|
+
case "end":
|
|
68
|
+
return _context2.stop();
|
|
73
69
|
}
|
|
74
70
|
}, _callee2);
|
|
75
71
|
}));
|
|
@@ -82,49 +78,47 @@ function _fetchLatestAndMasterPipeline() {
|
|
|
82
78
|
_fetchLatestAndMasterPipeline = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(projectId, config) {
|
|
83
79
|
var pipelines, latestPipeline, latestMasterPipeline, masterPipelines;
|
|
84
80
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
85
|
-
while (1) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return _context3.stop();
|
|
127
|
-
}
|
|
81
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
82
|
+
case 0:
|
|
83
|
+
_context3.next = 2;
|
|
84
|
+
return fetchPipelines(projectId, config, {
|
|
85
|
+
per_page: 100
|
|
86
|
+
});
|
|
87
|
+
case 2:
|
|
88
|
+
pipelines = _context3.sent;
|
|
89
|
+
if (!(pipelines.length === 0)) {
|
|
90
|
+
_context3.next = 5;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
return _context3.abrupt("return", []);
|
|
94
|
+
case 5:
|
|
95
|
+
latestPipeline = _lodash.default.take(pipelines, 1);
|
|
96
|
+
if (!(latestPipeline[0].ref === 'master')) {
|
|
97
|
+
_context3.next = 8;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
return _context3.abrupt("return", latestPipeline);
|
|
101
|
+
case 8:
|
|
102
|
+
latestMasterPipeline = (0, _lodash.default)(pipelines).filter({
|
|
103
|
+
ref: 'master'
|
|
104
|
+
}).take(1).value();
|
|
105
|
+
if (!(latestMasterPipeline.length > 0)) {
|
|
106
|
+
_context3.next = 11;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
return _context3.abrupt("return", latestPipeline.concat(latestMasterPipeline));
|
|
110
|
+
case 11:
|
|
111
|
+
_context3.next = 13;
|
|
112
|
+
return fetchPipelines(projectId, config, {
|
|
113
|
+
per_page: 50,
|
|
114
|
+
ref: 'master'
|
|
115
|
+
});
|
|
116
|
+
case 13:
|
|
117
|
+
masterPipelines = _context3.sent;
|
|
118
|
+
return _context3.abrupt("return", latestPipeline.concat(_lodash.default.take(masterPipelines, 1)));
|
|
119
|
+
case 15:
|
|
120
|
+
case "end":
|
|
121
|
+
return _context3.stop();
|
|
128
122
|
}
|
|
129
123
|
}, _callee3);
|
|
130
124
|
}));
|
|
@@ -137,19 +131,17 @@ function _fetchPipelines() {
|
|
|
137
131
|
_fetchPipelines = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(projectId, config, options) {
|
|
138
132
|
var _yield$gitlabRequest, pipelines;
|
|
139
133
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
140
|
-
while (1) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
return _context4.stop();
|
|
152
|
-
}
|
|
134
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
135
|
+
case 0:
|
|
136
|
+
_context4.next = 2;
|
|
137
|
+
return (0, _client.gitlabRequest)("/projects/".concat(projectId, "/pipelines"), options, config);
|
|
138
|
+
case 2:
|
|
139
|
+
_yield$gitlabRequest = _context4.sent;
|
|
140
|
+
pipelines = _yield$gitlabRequest.data;
|
|
141
|
+
return _context4.abrupt("return", pipelines.filter(pipeline => pipeline.status !== 'skipped'));
|
|
142
|
+
case 5:
|
|
143
|
+
case "end":
|
|
144
|
+
return _context4.stop();
|
|
153
145
|
}
|
|
154
146
|
}, _callee4);
|
|
155
147
|
}));
|
|
@@ -162,69 +154,65 @@ function _fetchDownstreamJobs() {
|
|
|
162
154
|
_fetchDownstreamJobs = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(projectId, pipelineId, config) {
|
|
163
155
|
var _yield$gitlabRequest2, gitlabBridgeJobs, childPipelines, downstreamStages, _iterator, _step, _loop;
|
|
164
156
|
return _regenerator.default.wrap(function _callee5$(_context6) {
|
|
165
|
-
while (1) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
case 10:
|
|
203
|
-
if ((_step = _iterator.n()).done) {
|
|
204
|
-
_context6.next = 14;
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
return _context6.delegateYield(_loop(), "t0", 12);
|
|
208
|
-
case 12:
|
|
209
|
-
_context6.next = 10;
|
|
210
|
-
break;
|
|
211
|
-
case 14:
|
|
212
|
-
_context6.next = 19;
|
|
157
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
158
|
+
case 0:
|
|
159
|
+
_context6.next = 2;
|
|
160
|
+
return (0, _client.gitlabRequest)("/projects/".concat(projectId, "/pipelines/").concat(pipelineId, "/bridges"), {
|
|
161
|
+
per_page: 100
|
|
162
|
+
}, config);
|
|
163
|
+
case 2:
|
|
164
|
+
_yield$gitlabRequest2 = _context6.sent;
|
|
165
|
+
gitlabBridgeJobs = _yield$gitlabRequest2.data;
|
|
166
|
+
childPipelines = gitlabBridgeJobs.filter(bridge => bridge.downstream_pipeline.status !== 'skipped');
|
|
167
|
+
downstreamStages = [];
|
|
168
|
+
_iterator = _createForOfIteratorHelper(childPipelines);
|
|
169
|
+
_context6.prev = 7;
|
|
170
|
+
_loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
|
|
171
|
+
var childPipeline, _yield$fetchJobs2, stages;
|
|
172
|
+
return _regenerator.default.wrap(function _loop$(_context5) {
|
|
173
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
174
|
+
case 0:
|
|
175
|
+
childPipeline = _step.value;
|
|
176
|
+
_context5.next = 3;
|
|
177
|
+
return fetchJobs(projectId, childPipeline.downstream_pipeline.id, config);
|
|
178
|
+
case 3:
|
|
179
|
+
_yield$fetchJobs2 = _context5.sent;
|
|
180
|
+
stages = _yield$fetchJobs2.stages;
|
|
181
|
+
downstreamStages.push(stages.map(stage => _objectSpread(_objectSpread({}, stage), {}, {
|
|
182
|
+
name: "".concat(childPipeline.stage, ":").concat(stage.name)
|
|
183
|
+
})));
|
|
184
|
+
case 6:
|
|
185
|
+
case "end":
|
|
186
|
+
return _context5.stop();
|
|
187
|
+
}
|
|
188
|
+
}, _loop);
|
|
189
|
+
});
|
|
190
|
+
_iterator.s();
|
|
191
|
+
case 10:
|
|
192
|
+
if ((_step = _iterator.n()).done) {
|
|
193
|
+
_context6.next = 14;
|
|
213
194
|
break;
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
195
|
+
}
|
|
196
|
+
return _context6.delegateYield(_loop(), "t0", 12);
|
|
197
|
+
case 12:
|
|
198
|
+
_context6.next = 10;
|
|
199
|
+
break;
|
|
200
|
+
case 14:
|
|
201
|
+
_context6.next = 19;
|
|
202
|
+
break;
|
|
203
|
+
case 16:
|
|
204
|
+
_context6.prev = 16;
|
|
205
|
+
_context6.t1 = _context6["catch"](7);
|
|
206
|
+
_iterator.e(_context6.t1);
|
|
207
|
+
case 19:
|
|
208
|
+
_context6.prev = 19;
|
|
209
|
+
_iterator.f();
|
|
210
|
+
return _context6.finish(19);
|
|
211
|
+
case 22:
|
|
212
|
+
return _context6.abrupt("return", downstreamStages.flat());
|
|
213
|
+
case 23:
|
|
214
|
+
case "end":
|
|
215
|
+
return _context6.stop();
|
|
228
216
|
}
|
|
229
217
|
}, _callee5, null, [[7, 16, 19, 22]]);
|
|
230
218
|
}));
|
|
@@ -237,48 +225,46 @@ function _fetchJobs() {
|
|
|
237
225
|
_fetchJobs = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(projectId, pipelineId, config) {
|
|
238
226
|
var _yield$gitlabRequest3, gitlabJobs, commit, stages;
|
|
239
227
|
return _regenerator.default.wrap(function _callee6$(_context7) {
|
|
240
|
-
while (1) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
return _context7.stop();
|
|
281
|
-
}
|
|
228
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
229
|
+
case 0:
|
|
230
|
+
_context7.next = 2;
|
|
231
|
+
return (0, _client.gitlabRequest)("/projects/".concat(projectId, "/pipelines/").concat(pipelineId, "/jobs?include_retried=true"), {
|
|
232
|
+
per_page: 100
|
|
233
|
+
}, config);
|
|
234
|
+
case 2:
|
|
235
|
+
_yield$gitlabRequest3 = _context7.sent;
|
|
236
|
+
gitlabJobs = _yield$gitlabRequest3.data;
|
|
237
|
+
if (!(gitlabJobs.length === 0)) {
|
|
238
|
+
_context7.next = 6;
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
return _context7.abrupt("return", {});
|
|
242
|
+
case 6:
|
|
243
|
+
commit = findCommit(gitlabJobs);
|
|
244
|
+
stages = (0, _lodash.default)(gitlabJobs).map(job => ({
|
|
245
|
+
id: job.id,
|
|
246
|
+
status: job.status,
|
|
247
|
+
stage: job.stage,
|
|
248
|
+
name: job.name,
|
|
249
|
+
startedAt: job.started_at,
|
|
250
|
+
finishedAt: job.finished_at,
|
|
251
|
+
url: job.web_url
|
|
252
|
+
})).orderBy('id').groupBy('stage').mapValues(mergeRetriedJobs).mapValues(cleanup).toPairs().map(_ref3 => {
|
|
253
|
+
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
|
254
|
+
name = _ref4[0],
|
|
255
|
+
jobs = _ref4[1];
|
|
256
|
+
return {
|
|
257
|
+
name,
|
|
258
|
+
jobs: _lodash.default.sortBy(jobs, 'name')
|
|
259
|
+
};
|
|
260
|
+
}).value();
|
|
261
|
+
return _context7.abrupt("return", {
|
|
262
|
+
commit,
|
|
263
|
+
stages
|
|
264
|
+
});
|
|
265
|
+
case 9:
|
|
266
|
+
case "end":
|
|
267
|
+
return _context7.stop();
|
|
282
268
|
}
|
|
283
269
|
}, _callee6);
|
|
284
270
|
}));
|
package/src/gitlab/projects.js
CHANGED
|
@@ -15,20 +15,18 @@ function _fetchProjects() {
|
|
|
15
15
|
_fetchProjects = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(gitlab) {
|
|
16
16
|
var projects;
|
|
17
17
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
18
|
-
while (1) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return _context.stop();
|
|
31
|
-
}
|
|
18
|
+
while (1) switch (_context.prev = _context.next) {
|
|
19
|
+
case 0:
|
|
20
|
+
_context.next = 2;
|
|
21
|
+
return fetchOwnProjects(gitlab);
|
|
22
|
+
case 2:
|
|
23
|
+
projects = _context.sent;
|
|
24
|
+
return _context.abrupt("return", projects
|
|
25
|
+
// Ignore projects for which CI/CD is not enabled
|
|
26
|
+
.filter(project => project.jobs_enabled).map(projectMapper).filter(includeRegexFilter(gitlab)).filter(excludeRegexFilter(gitlab)).filter(archivedFilter(gitlab)));
|
|
27
|
+
case 4:
|
|
28
|
+
case "end":
|
|
29
|
+
return _context.stop();
|
|
32
30
|
}
|
|
33
31
|
}, _callee);
|
|
34
32
|
}));
|
|
@@ -41,43 +39,41 @@ function _fetchOwnProjects() {
|
|
|
41
39
|
_fetchOwnProjects = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(gitlab) {
|
|
42
40
|
var projects, SAFETY_MAX_PAGE, page, _yield$gitlabRequest, data, headers;
|
|
43
41
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
44
|
-
while (1) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
_context2.next = 15;
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
_context2.next = 6;
|
|
56
|
-
return (0, _client.gitlabRequest)('/projects', {
|
|
57
|
-
page,
|
|
58
|
-
per_page: 100,
|
|
59
|
-
membership: true
|
|
60
|
-
}, gitlab);
|
|
61
|
-
case 6:
|
|
62
|
-
_yield$gitlabRequest = _context2.sent;
|
|
63
|
-
data = _yield$gitlabRequest.data;
|
|
64
|
-
headers = _yield$gitlabRequest.headers;
|
|
65
|
-
projects.push(data);
|
|
66
|
-
if (!(data.length === 0 || !headers['x-next-page'])) {
|
|
67
|
-
_context2.next = 12;
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
return _context2.abrupt("break", 15);
|
|
71
|
-
case 12:
|
|
72
|
-
page += 1;
|
|
73
|
-
_context2.next = 3;
|
|
42
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
43
|
+
case 0:
|
|
44
|
+
projects = [];
|
|
45
|
+
SAFETY_MAX_PAGE = 10;
|
|
46
|
+
page = 1;
|
|
47
|
+
case 3:
|
|
48
|
+
if (!(page <= SAFETY_MAX_PAGE)) {
|
|
49
|
+
_context2.next = 15;
|
|
74
50
|
break;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
51
|
+
}
|
|
52
|
+
_context2.next = 6;
|
|
53
|
+
return (0, _client.gitlabRequest)('/projects', {
|
|
54
|
+
page,
|
|
55
|
+
per_page: 100,
|
|
56
|
+
membership: true
|
|
57
|
+
}, gitlab);
|
|
58
|
+
case 6:
|
|
59
|
+
_yield$gitlabRequest = _context2.sent;
|
|
60
|
+
data = _yield$gitlabRequest.data;
|
|
61
|
+
headers = _yield$gitlabRequest.headers;
|
|
62
|
+
projects.push(data);
|
|
63
|
+
if (!(data.length === 0 || !headers['x-next-page'])) {
|
|
64
|
+
_context2.next = 12;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
return _context2.abrupt("break", 15);
|
|
68
|
+
case 12:
|
|
69
|
+
page += 1;
|
|
70
|
+
_context2.next = 3;
|
|
71
|
+
break;
|
|
72
|
+
case 15:
|
|
73
|
+
return _context2.abrupt("return", projects.flat());
|
|
74
|
+
case 16:
|
|
75
|
+
case "end":
|
|
76
|
+
return _context2.stop();
|
|
81
77
|
}
|
|
82
78
|
}, _callee2);
|
|
83
79
|
}));
|
package/src/gitlab/runners.js
CHANGED
|
@@ -15,22 +15,20 @@ function _fetchOfflineRunners() {
|
|
|
15
15
|
_fetchOfflineRunners = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(gitlab) {
|
|
16
16
|
var runners, offline;
|
|
17
17
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
18
|
-
while (1) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return _context.stop();
|
|
33
|
-
}
|
|
18
|
+
while (1) switch (_context.prev = _context.next) {
|
|
19
|
+
case 0:
|
|
20
|
+
_context.next = 2;
|
|
21
|
+
return fetchRunners(gitlab);
|
|
22
|
+
case 2:
|
|
23
|
+
runners = _context.sent;
|
|
24
|
+
offline = runners.filter(r => r.status === 'offline');
|
|
25
|
+
return _context.abrupt("return", {
|
|
26
|
+
offline,
|
|
27
|
+
totalCount: runners.length
|
|
28
|
+
});
|
|
29
|
+
case 5:
|
|
30
|
+
case "end":
|
|
31
|
+
return _context.stop();
|
|
34
32
|
}
|
|
35
33
|
}, _callee);
|
|
36
34
|
}));
|
|
@@ -43,22 +41,20 @@ function _fetchRunners() {
|
|
|
43
41
|
_fetchRunners = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(gitlab) {
|
|
44
42
|
var _yield$gitlabRequest, runners;
|
|
45
43
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
46
|
-
while (1) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return _context2.stop();
|
|
61
|
-
}
|
|
44
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
45
|
+
case 0:
|
|
46
|
+
_context2.next = 2;
|
|
47
|
+
return (0, _client.gitlabRequest)('/runners', {}, gitlab);
|
|
48
|
+
case 2:
|
|
49
|
+
_yield$gitlabRequest = _context2.sent;
|
|
50
|
+
runners = _yield$gitlabRequest.data;
|
|
51
|
+
return _context2.abrupt("return", runners.map(r => ({
|
|
52
|
+
name: r.description || r.id,
|
|
53
|
+
status: r.status
|
|
54
|
+
})));
|
|
55
|
+
case 5:
|
|
56
|
+
case "end":
|
|
57
|
+
return _context2.stop();
|
|
62
58
|
}
|
|
63
59
|
}, _callee2);
|
|
64
60
|
}));
|