This repository has been archived by the owner on Sep 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
/
ci_info.js
82 lines (81 loc) · 2.54 KB
/
ci_info.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
module.exports = {
getInfo: function() {
var env = process.env;
if (env.TRAVIS) {
return {
name: "travis-ci",
branch: env.TRAVIS_BRANCH,
build_identifier: env.TRAVIS_JOB_ID,
pull_request: env.TRAVIS_PULL_REQUEST
};
} else if (env.CIRCLECI) {
return {
name: "circleci",
build_identifier: env.CIRCLE_BUILD_NUM,
branch: env.CIRCLE_BRANCH,
commit_sha: env.CIRCLE_SHA1
};
} else if (env.SEMAPHORE) {
return {
name: "semaphore",
branch: env.BRANCH_NAME,
build_identifier: env.SEMAPHORE_BUILD_NUMBER
};
} else if (env.JENKINS_URL) {
return {
name: "jenkins",
build_identifier: env.BUILD_NUMBER,
build_url: env.BUILD_URL,
branch: env.GIT_BRANCH,
commit_sha: env.GIT_COMMIT
};
} else if (env.TDDIUM) {
return {
name: "tddium",
build_identifier: env.TDDIUM_SESSION_ID,
worker_id: env.TDDIUM_TID
};
} else if (env.WERCKER) {
return {
name: "wercker",
build_identifier: env.WERCKER_BUILD_ID,
build_url: env.WERCKER_BUILD_URL,
branch: env.WERCKER_GIT_BRANCH,
commit_sha: env.WERCKER_GIT_COMMIT
};
} else if (env.CI_NAME && env.CI_NAME.match(/codeship/i)) {
return {
name: "codeship",
build_identifier: env.CI_BUILD_NUMBER,
build_url: env.CI_BUILD_URL,
branch: env.CI_BRANCH,
commit_sha: env.CI_COMMIT_ID
};
} else if (env.APPVEYOR) {
return {
name: "appveyor",
build_identifier: env.APPVEYOR_BUILD_NUMBER,
branch: env.APPVEYOR_REPO_BRANCH,
commit_sha: env.APPVEYOR_REPO_COMMIT,
pull_request: env.APPVEYOR_PULL_REQUEST_NUMBER
};
} else if (env.BUILDKITE) {
return {
name: "buildkite",
build_identifier: env.BUILDKITE_BUILD_ID,
build_url: env.BUILDKITE_BUILD_URL,
branch: env.BUILDKITE_BRANCH,
commit_sha: env.BUILDKITE_COMMIT
};
} else if (env.GITLAB_CI) {
return {
name: "gitlab-ci",
build_identifier: env.CI_BUILD_ID,
branch: env.CI_BUILD_REF_NAME,
commit_sha: env.CI_BUILD_REF
};
} else {
return {};
}
}
};