-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
69 lines (66 loc) · 1.74 KB
/
Jenkinsfile
File metadata and controls
69 lines (66 loc) · 1.74 KB
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
pipeline {
options {
disableConcurrentBuilds()
timeout(time: 2, unit: 'HOURS')
}
agent { label "docker" }
stages {
stage ("notify-start") {
steps {
this.notifyBB("INPROGRESS")
}
}
stage ("build") {
steps {
sh "/usr/bin/git fetch --tags"
sh "./build.sh -r"
}
}
stage ("git-tag-and-push") {
when {
branch "main"
}
steps {
// sh can only return values in a script step:
script {
tag = sh (script: "./build.sh -t",
returnStdout: true).trim()
}
sh "/usr/bin/git tag ${tag}"
sh "/usr/bin/git push --tags"
}
}
stage ("promote") {
when {
branch "main"
}
steps {
sh "./build.sh -p ${tag}"
}
}
}
post {
always {
this.notifyBB(currentBuild.result)
}
cleanup {
deleteDir()
}
}
}
def notifyBB(String state) {
// on success, result is null
state = state ?: "SUCCESS"
if (state == "SUCCESS" || state == "FAILURE") {
currentBuild.result = state
}
notifyBitbucket commitSha1: "${GIT_COMMIT}",
credentialsId: 'aea50792-dda8-40e4-a683-79e8c83e72a6',
disableInprogressNotification: false,
considerUnstableAsSuccess: true,
ignoreUnverifiedSSLPeer: false,
includeBuildNumberInKey: false,
prependParentProjectKey: false,
projectKey: 'SW',
stashServerBaseUrl: 'https://aicsbitbucket.corp.alleninstitute.org'
}