-
Notifications
You must be signed in to change notification settings - Fork 2
/
flow.groovy
64 lines (49 loc) · 2 KB
/
flow.groovy
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
node('master') {
sh 'rm -rf chefconf-2015'
stage "Dev"
dir('chefconf-2015') {
ROOT=pwd()
git 'https://github.com/uaarkoti/chefconf-2015.git'
dir('chef-ci-tools') {
git 'https://github.com/woohgit/chef-ci-tools.git'
}
sh './chef-ci-tools/bin/chef-foodcritic-publisher.sh -X spec -f any -t "~FC003"'
step([$class: 'JUnitResultArchiver', testResults: 'junit_reports/foodcritic-*.xml'])
//archive 'junit_reports/foodcritic-*.xml'
stage "QA"
sh 'rm -rf rspec_results'
sh 'mkdir rspec_results'
sh 'for cbname in `find cookbooks -maxdepth 1 -mindepth 1 -type d` ; do rspec $cbname --format RspecJunitFormatter --out rspec_results/${cbname}-results.xml; done;'
// Archive RSpec results
step([$class: 'JUnitResultArchiver', testResults: 'rspec_results/*/*.xml'])
//archive 'rspec_results/*/*.xml'
dir('cookbooks') {
sh 'git submodule init'
sh 'git submodule update'
}
stage "Integration"
dir('tests/webserver') {
sh 'vagrant destroy -f'
sh 'vagrant up'
//sh 'OPTIONS=`vagrant ssh-config | awk -v ORS=\' \' \'{print "-o " $1 "=" $2}\'`'
sh 'vagrant ssh-config | awk -v ORS=\' \' \'{print "-o " $1 "=" $2}\' > result'
def OPTIONS = readFile('result')
echo "${OPTIONS}"
// get stactrace
sh "ssh ${OPTIONS} [email protected] \"sudo chmod -R a+r /var/chef/\""
echo "copy strace out.. if any... to ${ROOT}"
//sh "scp ${OPTIONS} [email protected]:/var/chef/cache/chef-stacktrace.out ${ROOT}/chef-stacktrace.out"
echo 'copy chef-solo-ci-reports...'
sh 'scp -r ' + OPTIONS + ' vagrant@$127.0.0.1:/tmp/chef-solo-ci-reports ' + ROOT + '/'
sh 'vagrant destroy -f'
}
step([$class: 'JUnitResultArchiver', testResults: 'chef-solo-ci-reports/*.xml'])
try {
checkpoint('Before pre-prod')
} catch (NoSuchMethodError _) {
echo 'Checkpoint feature available in Jenkins Enterprise by CloudBees.'
}
stage "Pre Prod"
echo "Preparing for staging"
}
}