diff --git a/Jenkinsfile b/Jenkinsfile index fc9c6c2..3725dc4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,7 +24,7 @@ def performBuild(String project){ try { stage 'Cleanup & Setup' sh "rm -rf output-${project}-*" - sh "rm -rf \"~/VirtualBox VMs/${project}-appliance-*\"" + sh "bin/remove-${project}.sh" sh 'rm -rf builds' sh 'mkdir -p builds' @@ -75,14 +75,19 @@ def performBuild(String project){ } catch (err) { - handleError("BUILD ERROR: There was a problem with ${project} Appliance. ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL} |Open>) \n\n ${err}") + handleError("BUILD ERROR: There was a problem with ${project} Appliance. ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL} |Open>) \n\n ${err}", "${project}-appliance-centos7-xfs") } } -def handleError(String message){ +def handleError(String message, String appliance_name){ echo "${message}" currentBuild.setResult("FAILED") slackSend color: 'danger', message: "${message}" //step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'chris.bynum@levvel.io', sendToIndividuals: true]) + + sh "VBoxManage controlvm ${appliance_name} poweroff" + + sh "VboxManage unregistervm ${appliance_name} --delete" + sh 'exit 1' } diff --git a/bin/perms.sh b/bin/perms.sh index 0b378a6..cf3b5d4 100755 --- a/bin/perms.sh +++ b/bin/perms.sh @@ -10,17 +10,20 @@ aws s3api put-object-acl --bucket $bucket --key $vagrant_key --acl public-read echo "(https://s3-us-west-1.amazonaws.com/$bucket/$vagrant_key)" -echo $(md5 builds/$vagrant_key) +echo $(md5sum builds/$vagrant_key) echo "Found $ova_key" aws s3api put-object-acl --bucket $bucket --key $ova_key --acl public-read echo "(https://s3-us-west-1.amazonaws.com/$bucket/$ova_key)" -echo $(md5 builds/$ova_key) +echo $(md5sum builds/$ova_key) ami_id=$(aws ec2 describe-images --owners $aws_acct_id --query 'reverse(sort_by(Images[?starts_with(Name, `import-ami`)], &CreationDate))[0].[ImageId]' --output text | tr -d '\n' ) echo "Publishing $ami_id to $aws_acct_id" +ami_image_description=$(aws ec2 describe-images --image-ids $ami_id --query 'Images[0].{Description:Tags[0].Value}') +echo $ami_image_description + aws ec2 modify-image-attribute --image-id $ami_id --launch-permission "{\"Add\":[{\"UserId\":\"$aws_acct_id\"}]}" diff --git a/bin/remove-comanage.sh b/bin/remove-comanage.sh new file mode 100755 index 0000000..e56368b --- /dev/null +++ b/bin/remove-comanage.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +rm -rf $HOME/VirtualBox\ VMs/comanage-appliance-centos7-xfs/ diff --git a/bin/remove-grouper.sh b/bin/remove-grouper.sh new file mode 100755 index 0000000..4bbf6da --- /dev/null +++ b/bin/remove-grouper.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +rm -rf $HOME/VirtualBox\ VMs/grouper-appliance-centos7-xfs/ diff --git a/bin/remove-shibboleth.sh b/bin/remove-shibboleth.sh new file mode 100755 index 0000000..a106560 --- /dev/null +++ b/bin/remove-shibboleth.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +rm -rf $HOME/VirtualBox\ VMs/shibboleth-appliance-centos7-xfs/ diff --git a/comanage-appliance.json b/comanage-appliance.json index a61d24d..28a30cc 100644 --- a/comanage-appliance.json +++ b/comanage-appliance.json @@ -3,7 +3,7 @@ "description": "Comanage appliance ", "variables": { "profile": "xfs", - "disk_size": "8192", + "disk_size": "20000", "memory": "6122", "cpus": "2", "ssh_username": "centos", diff --git a/grouper-appliance.json b/grouper-appliance.json index bd84099..e4418e4 100644 --- a/grouper-appliance.json +++ b/grouper-appliance.json @@ -3,7 +3,7 @@ "description": "Grouper appliance ", "variables": { "profile": "xfs", - "disk_size": "8192", + "disk_size": "20000", "memory": "2048", "cpus": "1", "guest_os_type": "RedHat_64",