/
Jenkinsfile
56 lines (49 loc) · 2.35 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
#!groovy
@Library('globalPipelineLibraryMarkEWaite') _
import com.markwaite.Assert
import com.markwaite.Build
/* Only keep the 10 most recent builds. */
properties([[$class: 'BuildDiscarderProperty',
strategy: [$class: 'LogRotator', numToKeepStr: '10']]])
def branch = 'JENKINS-56326'
node {
def scmVars
stage('Checkout') {
scmVars = checkout([$class: 'GitSCM',
branches: scm.branches,
extensions: [[$class: 'CloneOption', honorRefspec: true, noTags: true, reference: '/var/lib/git/mwaite/bugs/jenkins-bugs.git'],
[$class: 'LocalBranch', localBranch: branch]
],
gitTool: scm.gitTool,
userRemoteConfigs: [[url: 'https://github.com/MarkEWaite/jenkins-bugs',
refspec: "+refs/heads/${branch}:refs/remotes/origin/${branch}"]]])
}
stage('Build') {
/* Call the ant build. */
def my_step = new com.markwaite.Build()
my_step.ant 'info' /* Will intentionally delay the build */
}
def wsVars
stage('Delayed checkout') {
/* Use a separate workspace */
ws() {
wsVars = checkout([$class: 'GitSCM',
branches: scm.branches,
extensions: [[$class: 'CloneOption', honorRefspec: true, noTags: true, reference: '/var/lib/git/mwaite/bugs/jenkins-bugs.git'],
[$class: 'LocalBranch', localBranch: branch]
],
gitTool: scm.gitTool,
userRemoteConfigs: [[url: 'https://github.com/MarkEWaite/jenkins-bugs',
refspec: "+refs/heads/${branch}:refs/remotes/origin/${branch}"]]])
def my_step = new com.markwaite.Build()
my_step.ant 'info-sleepless'
}
}
stage('Verify') {
def my_check = new com.markwaite.Assert()
my_check.logContains(".*Sleeping git HEAD is ${scmVars.GIT_COMMIT}.*", "Missing scmVars GIT_COMMIT in sleeping log, expected SHA1 ${scmVars.GIT_COMMIT}")
my_check.logContains(".*Sleeping git HEAD is ${wsVars.GIT_COMMIT}.*", "Missing wsVars GIT_COMMIT in sleeping log, expected SHA1 ${wsVars.GIT_COMMIT}")
my_check.logContains(".*Sleepless git HEAD is ${scmVars.GIT_COMMIT}.*", "Missing scmVars GIT_COMMIT in sleepless log, expected SHA1 ${scmVars.GIT_COMMIT}")
my_check.logContains(".*Sleepless git HEAD is ${wsVars.GIT_COMMIT}.*", "Missing wsVars GIT_COMMIT in sleepless log, expected SHA1 ${wsVars.GIT_COMMIT}")
}
}