-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
48 lines (44 loc) · 1.72 KB
/
Jenkinsfile
File metadata and controls
48 lines (44 loc) · 1.72 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
properties([
buildDiscarder(logRotator(numToKeepStr: '10')),
])
def label = "worker-${UUID.randomUUID().toString()}"
podTemplate(label: label, containers: [], volumes: [
hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock')
]) { node (label) {
if (env.BRANCH_NAME == 'deployment' || env.BRANCH_NAME == 'JenkinsSetup') {
stage('Checkout') {
checkout(
[
$class : 'GitSCM',
branches : [
[name: env.BRANCH_NAME]
],
doGenerateSubmoduleConfigurations: false,
extensions : [],
submoduleCfg : [],
userRemoteConfigs : [
[
credentialsId: 'github',
url : 'https://github.com/SDU-eScience/Type3-Docs.git'
]
]
]
)
}
def latestTag = sh(script: 'git describe --abbrev=0 --tags', returnStdout: true)
println(latestTag)
if (latestTag.startsWith("doc-")) {
def commitNumber = latestTag.split("-")[1]
println(commitNumber)
sendAlert("deploy documentation. Image: dreg.cloud.sdu.dk/type3-docs/user-guide:$commitNumber")
}
}
}
}
def sendAlert(String alertMessage) {
withCredentials(
[string(credentialsId: "slackToken", variable: "slackToken")]
) {
slackSend(channel: "docs", message: alertMessage, tokenCredentialId: 'slackToken')
}
}