-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdangerfile.js
63 lines (50 loc) · 1.55 KB
/
dangerfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
'use strict';
const { danger, message, warn, fail, markdown } = require('danger');
const { MSK, Apply, K8S, Changelog, Common,
Infrastructure, Checks } = require("./src/models");
const
{ isInCollection } = require("./src/utils");
let msk = new MSK(danger);
let apply = new Apply(danger);
let k8s = new K8S(danger);
let chg = new Changelog(danger);
let infra = new Infrastructure(danger);
let checks = new Checks(danger);
const repoSlug = danger.gitlab.metadata.repoSlug.toLowerCase();
const web_url = danger.gitlab.mr.web_url;
if (process.env.DANGER_SKIP_REVIEW === "true" || !checks.skipReview()) {
console.log(`\tMR "${web_url}" review..`);
let cmn = new Common(danger);
cmn.run();
if (isInCollection(repoSlug, ['kafka/msk-topics'])) {
apply.addManualApplyMsg();
(async function () {
await msk.run();
})();
}
if (isInCollection(repoSlug, ['k8s-cluster-config'])) {
(async function () {
await chg.changelogNotPresent();
})();
}
if (isInCollection(repoSlug, ['k8s-deploy'])) {
k8s.k8sDeployTestsAdded();
chg.changelogNotPresent();
chg.changelogUnreleased();
}
if (isInCollection(repoSlug, ['platform-as-a-service/oauth2-proxy'])) {
apply.addPaasManualApplyMsg();
}
if (isInCollection(repoSlug, ['platform-as-a-service/infrastructure'])) {
apply.addManualApplyMsg();
(async function () {
await infra.run();
})();
}
if (process.env.IS_CI) {
cmn.welcomeMsg({ url: process.env.CI_JOB_URL });
(async function () {
await cmn.addLabels(['review-bot']);
})();
}
}