-
Notifications
You must be signed in to change notification settings - Fork 47
/
jenkins.js
35 lines (32 loc) · 937 Bytes
/
jenkins.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
import { head } from "../lib/git.js";
// https://wiki.jenkins.io/display/JENKINS/Building+a+software+project
export default {
detect({ env }) {
return Boolean(env.JENKINS_URL);
},
configuration({ env, cwd }) {
const pr = env.ghprbPullId || env.gitlabMergeRequestId || env.CHANGE_ID;
const isPr = Boolean(pr);
const localBranch =
env.GIT_LOCAL_BRANCH ||
env.GIT_BRANCH ||
env.gitlabBranch ||
env.BRANCH_NAME;
return {
name: "Jenkins",
service: "jenkins",
commit: env.ghprbActualCommit || env.GIT_COMMIT || head({ env, cwd }),
branch: isPr
? env.ghprbTargetBranch || env.gitlabTargetBranch
: localBranch,
build: env.BUILD_NUMBER,
buildUrl: env.BUILD_URL,
root: env.WORKSPACE,
pr,
isPr,
prBranch: isPr
? env.ghprbSourceBranch || env.gitlabSourceBranch || localBranch
: undefined,
};
},
};