-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add branch logic for appliance builds and basic notification.
- Loading branch information
Mason Packard
committed
Aug 22, 2016
1 parent
0e77e9b
commit ae6676e
Showing
1 changed file
with
67 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,79 @@ | ||
| #!groovy | ||
|
|
||
| node('packer') { | ||
| stage 'Checkout' | ||
| echo "My Branch is: ${env.BRANCH_NAME}" | ||
|
|
||
| checkout scm | ||
| BRANCH_TEST = "${env.BRANCH_NAME}" | ||
|
|
||
| stage 'Acquire ansible-playbooks' | ||
| if (BRANCH_TEST=="shibboleth-production"){ | ||
| node('packer') { | ||
| currentBuild.result = "SUCCESS" | ||
|
|
||
| sh 'mkdir -p ansible-playbooks' | ||
| dir('ansible-playbooks'){ | ||
| git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", | ||
| branch: "shibboleth-production", credentialsId: "jenkins-github-access-token" ]) | ||
| try { | ||
| stage 'Checkout' | ||
|
|
||
| checkout scm | ||
|
|
||
| stage 'Acquire ansible-playbooks' | ||
|
|
||
| sh 'mkdir -p ansible-playbooks' | ||
| dir('ansible-playbooks'){ | ||
| git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", | ||
| branch: "shibboleth-production", credentialsId: "jenkins-github-access-token" ]) | ||
| } | ||
|
|
||
| stage 'Validate' | ||
|
|
||
| sh '/usr/local/bin/packer validate shibboleth-appliance.json' | ||
|
|
||
| stage 'Build Appliance - Shibboleth' | ||
|
|
||
| sh '/usr/local/bin/packer build shibboleth-appliance.json' | ||
|
|
||
| } | ||
|
|
||
| catch (err) { | ||
| currentBuild.result = "FAILURE" | ||
|
|
||
| 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}" | ||
| step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "$email-error-id", sendToIndividuals: true]) | ||
|
|
||
| throw err | ||
| } | ||
| } | ||
| } else if (BRANCH_TEST=="comanage-production"){ | ||
| node('packer') { | ||
| currentBuild.result = "SUCCESS" | ||
|
|
||
| try { | ||
| stage 'Checkout' | ||
|
|
||
| checkout scm | ||
|
|
||
| stage 'Acquire ansible-playbooks' | ||
|
|
||
| sh 'mkdir -p ansible-playbooks' | ||
| dir('ansible-playbooks'){ | ||
| git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", | ||
| branch: "comanage-production", credentialsId: "jenkins-github-access-token" ]) | ||
| } | ||
|
|
||
| stage 'Validate' | ||
| stage 'Validate' | ||
|
|
||
| sh '/usr/local/bin/packer validate shibboleth-appliance.json' | ||
| sh '/usr/local/bin/packer validate comange-appliance.json' | ||
|
|
||
| stage 'Build Appliance' | ||
| stage 'Build Appliance - Shibboleth' | ||
|
|
||
| sh '/usr/local/bin/packer build shibboleth-appliance.json' | ||
| sh '/usr/local/bin/packer build comanage-appliance.json' | ||
|
|
||
| } | ||
|
|
||
| catch (err) { | ||
| currentBuild.result = "FAILURE" | ||
|
|
||
| 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}" | ||
| step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "$email-error-id", sendToIndividuals: true]) | ||
|
|
||
| throw err | ||
| } | ||
| } | ||
| } |