-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
64 lines (64 loc) · 1.95 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
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
pipeline {
agent any
environment {
version_prefix = "1.0.8"
is_release = "false"
found_tag = "false"
github_url = "https://github.com/robertpatrick/jenkins-tag-test.git"
github_creds = "fa369a2b-8c50-43ea-8956-71764cbcbe3d"
branch = sh(returnStdout: true, script: 'echo $GIT_BRANCH | sed --expression "s:origin/::"')
TAG_NAME = sh(returnStdout: true, script: 'git describe --abbrev=0 --tags').trim()
}
stages {
stage('Echo environment') {
steps {
sh 'env|sort'
}
}
stage('Checkout') {
steps {
git url: "${github_url}", credentialsId: "${github_creds}", branch: "${branch}"
}
}
// stage('Check for release tag') {
// environment {
// latest_tag = sh(returnStdout: true, script: 'git describe --abbrev=0 --tags').trim()
// release_tag = "v${version_prefix}"
// }
// steps {
// script {
// if (latest_tag.equals(release_tag)) {
// TAG_NAME=release_tag
// }
// }
// echo "TAG_NAME = ${TAG_NAME}"
// }
// }
stage('Look for tag') {
when {
tag pattern: "v1.0.8", comparator: "EQUALS"
}
steps {
script {
found_tag = "true"
}
}
}
stage('Look for release') {
when {
changelog '.*^\\[release\\].+$'
}
steps {
script {
is_release = "true"
}
}
}
stage('Echo is_release') {
steps {
echo "Found tag v1.0.0 is ${found_tag}"
echo "Found release marker is ${is_release}"
}
}
}
}