Permalink
Sep 6, 2016
Sep 6, 2016
Sep 6, 2016
Sep 6, 2016
Aug 19, 2016
Aug 19, 2016
Aug 19, 2016
Sep 6, 2016
Sep 6, 2016
Sep 6, 2016
Aug 19, 2016
Sep 6, 2016
Newer
100644
88 lines (63 sloc)
2.36 KB

8
stage 'Appliance build'
9
echo "My Branch is: ${env.BRANCH_NAME}"
10
11
BRANCH_TEST = "${env.BRANCH_NAME}"
12
13
if (BRANCH_TEST=="shibboleth-production"){
14
performBuild("shibboleth")
15
} else if (BRANCH_TEST=="grouper-production"){
16
performBuild("grouper")
17
} else if (BRANCH_TEST=="comanage-production"){
18
performBuild("comanage")
19
}
20
21
}

23
def performBuild(String project){
24
try {
25
stage 'Cleanup & Setup'
26
sh "rm -rf output-${project}-*"
27
sh "rm -rf \"/Users/levvel/VirtualBox VMs/${project}-appliance-*\""
28
sh 'rm -rf builds'
29
sh 'mkdir -p builds'
30
31
withCredentials([[$class: 'FileBinding', credentialsId: 'tier-aws-config', variable: 'FILE']]) {
32
ws {
33
sh 'mkdir -p ~/.aws'
34
sh 'cp $FILE ~/.aws/config'
35
}

38
withCredentials([[$class: 'FileBinding', credentialsId: 'tier-aws-credentials', variable: 'FILE']]) {
39
ws {
40
sh 'mkdir -p ~/.aws'
41
sh 'cp $FILE ~/.aws/credentials'
42
}

47
sh 'mkdir -p ansible-playbooks'
48
dir('ansible-playbooks'){
49
git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git",

52

54

56

63
sh "aws s3 sync builds s3://internet2-tier-appliance-us-west-1"
64
65
stage 'Publish results'
66
67
sh "bin/perms.sh > results.txt"

69
slackSend color: 'good', message: "BUILD SUCCESS: Shibboleth Appliance build success. ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL} |Open>)"
70
71
slackSend color: 'good', message: readFile('./results.txt')
72
73
sh "rm results.txt"

77
catch (err) {
78
handleError("BUILD ERROR: There was a problem with ${project} Appliance. ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL} |Open>) \n\n ${err}")

80
}

81
82
def handleError(String message){
83
echo "${message}"
84
currentBuild.setResult("FAILED")
85
slackSend color: 'danger', message: "${message}"
86
//step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'chris.bynum@levvel.io', sendToIndividuals: true])
87
sh 'exit 1'
88
}