Skip to content
Permalink
Newer
Older
100644 98 lines (65 sloc) 2.5 KB
Mason Packard
Aug 19, 2016
1
#!groovy
Mason Packard
Aug 24, 2016
2
// pipeline file for building appliances
Mason Packard
Aug 19, 2016
3
4
echo "My Branch is: ${env.BRANCH_NAME}"
Mason Packard
Aug 19, 2016
5
6
BRANCH_TEST = "${env.BRANCH_NAME}"
Mason Packard
Aug 19, 2016
7
8
if (BRANCH_TEST=="shibboleth-production"){
9
node('packer') {
10
currentBuild.result = "SUCCESS"
Mason Packard
Aug 19, 2016
11
13
stage 'Cleanup & Setup'
14
sh 'rm -rf output-*'
15
sh 'rm -rf "/Users/levvel/VirtualBox VMs/"'
Mason Packard
Aug 31, 2016
16
sh 'rm -rf builds'
17
sh 'mkdir -p builds'
21
checkout scm
22
23
stage 'Acquire ansible-playbooks'
24
25
sh 'mkdir -p ansible-playbooks'
26
dir('ansible-playbooks'){
27
git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git",
28
branch: "shibboleth-production", credentialsId: "jenkins-github-access-token" ])
29
}
30
31
stage 'Validate'
32
33
sh '/usr/local/bin/packer validate shibboleth-appliance.json'
34
35
stage 'Build Appliance - Shibboleth'
36
37
sh '/usr/local/bin/packer build shibboleth-appliance.json'
38
39
stage 'Sync appliances to S3 bucket'
40
41
sh 'aws s3 sync /builds s3://internet2-appliance-us-west-1'
42
43
}
44
45
catch (err) {
46
currentBuild.result = "FAILURE"
47
48
slackSend color: 'danger', message: "BUILD ERROR: There was a problem with Shibboleth Appliance. ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL} |Open>) \n\n ${err}"
49
50
throw err
51
}
52
}
53
} else if (BRANCH_TEST=="comanage-production"){
54
node('packer') {
55
currentBuild.result = "SUCCESS"
56
57
try {
58
stage 'Cleanup & Setup '
59
sh 'rm -rf output-*'
60
sh 'rm -rf "/Users/levvel/VirtualBox VMs"'
Mason Packard
Aug 31, 2016
61
sh 'rm -rf builds'
62
sh 'mkdir -p builds'
66
checkout scm
67
68
stage 'Acquire ansible-playbooks'
69
70
sh 'mkdir -p ansible-playbooks'
71
dir('ansible-playbooks'){
72
git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git",
73
branch: "comanage-production", credentialsId: "jenkins-github-access-token" ])
74
}
Mason Packard
Aug 19, 2016
75
Mason Packard
Aug 19, 2016
77
78
sh '/usr/local/bin/packer validate comange-appliance.json'
Mason Packard
Aug 19, 2016
79
80
stage 'Build Appliance - Comanage'
Mason Packard
Aug 20, 2016
81
82
sh '/usr/local/bin/packer build comanage-appliance.json'
Mason Packard
Aug 20, 2016
83
84
stage 'Sync appliances to S3 bucket'
85
86
sh 'aws s3 sync /builds s3://internet2-appliance-us-west-1'
87
88
}
89
90
catch (err) {
91
currentBuild.result = "FAILURE"
92
93
slackSend color: 'danger', message: "BUILD ERROR: There was a problem with Comanage Appliance. ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL} |Open>) \n\n ${err}"
94
95
throw err
96
}
97
}
Mason Packard
Aug 19, 2016
98
}
You can’t perform that action at this time.