Skip to content
Permalink
Newer
Older
100644 130 lines (91 sloc) 3.74 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-shibboleth-*'
15
sh 'rm -rf "/Users/levvel/VirtualBox VMs/shibboleth-appliance-*"'
Mason Packard
Aug 31, 2016
16
sh 'rm -rf builds'
17
sh 'mkdir -p builds'
19
withCredentials([[$class: 'FileBinding', credentialsId: 'tier-aws-config', variable: 'FILE']]) {
20
ws {
21
sh 'mkdir -p ~/.aws'
22
sh 'cp $FILE ~/.aws/config'
23
}
24
}
25
26
withCredentials([[$class: 'FileBinding', credentialsId: 'tier-aws-credentials', variable: 'FILE']]) {
27
ws {
28
sh 'mkdir -p ~/.aws'
29
sh 'cp $FILE ~/.aws/credentials'
30
}
31
}
32
35
checkout scm
36
37
stage 'Acquire ansible-playbooks'
38
39
sh 'mkdir -p ansible-playbooks'
40
dir('ansible-playbooks'){
41
git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git",
42
branch: "shibboleth-production", credentialsId: "jenkins-github-access-token" ])
43
}
44
45
stage 'Validate'
46
47
sh '/usr/local/bin/packer validate shibboleth-appliance.json'
48
49
stage 'Build Appliance - Shibboleth'
50
51
sh '/usr/local/bin/packer build shibboleth-appliance.json'
52
53
stage 'Sync appliances to S3 bucket'
54
55
sh 'aws s3 sync builds s3://internet2-tier-appliance-us-west-1'
57
slackSend color: 'good', message: "BUILD SUCCESS: Shibboleth Appliance build success. ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL} |Open>)"
58
59
}
60
61
catch (err) {
62
currentBuild.result = "FAILURE"
63
64
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}"
65
66
throw err
67
}
68
}
69
} else if (BRANCH_TEST=="comanage-production"){
70
node('packer') {
71
currentBuild.result = "SUCCESS"
72
73
try {
74
stage 'Cleanup & Setup '
75
sh 'rm -rf output-comanage-*'
76
sh 'rm -rf "/Users/levvel/VirtualBox VMs/comange-appliance-*"'
Mason Packard
Aug 31, 2016
77
sh 'rm -rf builds'
78
sh 'mkdir -p builds'
80
withCredentials([[$class: 'FileBinding', credentialsId: 'tier-aws-config', variable: 'FILE']]) {
81
ws {
82
sh 'mkdir -p ~/.aws'
83
sh 'cp $FILE ~/.aws/config'
84
}
85
}
86
87
withCredentials([[$class: 'FileBinding', credentialsId: 'tier-aws-credentials', variable: 'FILE']]) {
88
ws {
89
sh 'mkdir -p ~/.aws'
90
sh 'cp $FILE ~/.aws/credentials'
91
}
92
}
93
96
checkout scm
97
98
stage 'Acquire ansible-playbooks'
99
100
sh 'mkdir -p ansible-playbooks'
101
dir('ansible-playbooks'){
102
git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git",
103
branch: "comanage-production", credentialsId: "jenkins-github-access-token" ])
104
}
Mason Packard
Aug 19, 2016
105
Mason Packard
Aug 19, 2016
107
108
sh '/usr/local/bin/packer validate comange-appliance.json'
Mason Packard
Aug 19, 2016
109
110
stage 'Build Appliance - Comanage'
Mason Packard
Aug 20, 2016
111
112
sh '/usr/local/bin/packer build comanage-appliance.json'
Mason Packard
Aug 20, 2016
113
114
stage 'Sync appliances to S3 bucket'
115
116
sh 'aws s3 sync builds s3://internet2-tier-appliance-us-west-1'
118
slackSend color: 'good', message: "BUILD SUCCESS: Comanage Appliance build success. ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL} |Open>)"
119
120
}
121
122
catch (err) {
123
currentBuild.result = "FAILURE"
124
125
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}"
126
127
throw err
128
}
129
}
Mason Packard
Aug 19, 2016
130
}
You can’t perform that action at this time.