Skip to content

Commit

Permalink
Improving syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Van Fleet committed Sep 6, 2016
1 parent c45fced commit af9eb3c
Showing 1 changed file with 7 additions and 68 deletions.
75 changes: 7 additions & 68 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
node('packer') {
currentBuild.result = "SUCCESS"

stage 'Checkout'

checkout scm

stage 'Appliance build'
echo "My Branch is: ${env.BRANCH_NAME}"

Expand Down Expand Up @@ -38,25 +42,21 @@ def performBuild(String project){
}
}

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: "{{project}}-production", credentialsId: "jenkins-github-access-token" ])
branch: "${project}-production", credentialsId: "jenkins-github-access-token" ])
}

stage 'Validate'

sh "/usr/local/bin/packer validate {{project}}-appliance.json"
sh "/usr/local/bin/packer validate ${project}-appliance.json"

stage 'Build Appliance'

sh "/usr/local/bin/packer build {{project}}-appliance.json"
sh "/usr/local/bin/packer build ${project}-appliance.json"

stage 'Sync appliances to S3 bucket'

Expand All @@ -77,67 +77,6 @@ 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}")
}
} else if (BRANCH_TEST=="grouper-production") {
node('packer') {
currentBuild.result = "SUCCESS"

try {
stage 'Cleanup & Setup '
sh 'rm -rf output-grouper-*'
sh 'rm -rf "/Users/levvel/VirtualBox VMs/grouper-appliance-*"'
sh 'rm -rf builds'
sh 'mkdir -p builds'

withCredentials([[$class: 'FileBinding', credentialsId: 'our-aws-config', variable: 'FILE']]) {
ws {
sh 'mkdir -p ~/.aws'
sh 'cp $FILE ~/.aws/config'
}
}

withCredentials([[$class: 'FileBinding', credentialsId: 'our-aws-credentials', variable: 'FILE']]) {
ws {
sh 'mkdir -p ~/.aws'
sh 'cp $FILE ~/.aws/credentials'
}
}

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: "grouper-production", credentialsId: "jenkins-github-access-token" ])
}

stage 'Validate'

sh '/usr/local/bin/packer validate grouper-appliance.json'

stage 'Build Appliance - Grouper'

sh '/usr/local/bin/packer build grouper-appliance.json'

stage 'Sync appliances to S3 bucket'

sh 'aws s3 sync builds s3://internet2-appliance-us-west-1'

slackSend color: 'good', message: "BUILD SUCCESS: Comanage Appliance build success. ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL} |Open>)"

}

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}"

throw err
}
}
}

def handleError(String message){
Expand Down

0 comments on commit af9eb3c

Please sign in to comment.