-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
37 lines (33 loc) · 1.03 KB
/
Jenkinsfile
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
ios.prepareEnv(xcode: "/Applications/Xcode_10.2.app")
// Unlock Bitbucket Server credentials for Danger
def unlockBitbucketDangerCredentials(block) {
withCredentials([usernamePassword(credentialsId: 'pgs-software-bitbucket-server-danger_user', passwordVariable: 'DANGER_BITBUCKETSERVER_PASSWORD', usernameVariable: 'DANGER_BITBUCKETSERVER_USERNAME')]) {
block()
}
}
def unlockGitHubDangerCredentials(block) {
withCredentials([usernamePassword(credentialsId: 'pgs-github-PGSJenkins-token', passwordVariable: 'DANGER_GITHUB_API_TOKEN', usernameVariable: '')]) {
block()
}
}
// Repository detection
def job = env.JOB_NAME.tokenize("/")[-2]
def unlockDangerCredentials = this.&unlockBitbucketDangerCredentials
if (job =~ /.*github.*/) {
echo "Repo: GitHub"
unlockDangerCredentials = this.&unlockGitHubDangerCredentials
} else {
echo "Repo: Bitbucket"
}
// Node
ios.runOniOSNode(runBlock: {
unlockDangerCredentials() {
// Danger
stage("Danger") {
sh '''
# Danger
bundle exec danger
'''
}
}
})