This repository has been archived by the owner on Jun 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Jenkinsfile
49 lines (46 loc) · 2.07 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env groovy
@Library('cht-jenkins-pipeline') _
properties([
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '15']]
]);
if (env.BRANCH_NAME == 'master') {
properties([pipelineTriggers([cron('H H(8-10) * * 4')]),
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '15']]
]);
}
// NODE FOR RUBY2.3.3-RAILS3.2
node('management-testing') {
try {
timestamps {
stage('Setup_2.3.3-3.0') {
checkout scm
sh "docker build -f docker/Dockerfile -t pricing_image ."
sh "docker run -dit --name=pricing-app-${JOB_BASE_NAME}_${BUILD_NUMBER} -e RAILS_ENV=test -v ${WORKSPACE}/:/home/cloudhealth/amazon-pricing/ pricing_image /bin/bash"
}
}
timestamps {
stage('Run Bundle Install') {
sh "docker exec pricing-app-${JOB_BASE_NAME}_${BUILD_NUMBER} /bin/bash -c -l 'bundle install --no-deployment --binstubs=bin'"
}
}
try {
timestamps {
stage('Test_2.3.3-3.0') {
try {
sh 'docker exec pricing-app-${JOB_BASE_NAME}_${BUILD_NUMBER} /bin/bash -c -l "bundle exec rspec --format RspecJunitFormatter --out pricing_rspec_1-3_${JOB_BASE_NAME}_${BUILD_NUMBER}.xml"'
} finally {
junit(testResults: 'pricing_rspec_1-3_${JOB_BASE_NAME}_${BUILD_NUMBER}.xml')
}
}
}
sh "exit 0"
currentBuild.result = 'SUCCESS'
} catch (Exception e) {
// Exit 0 so that we can keep running other nodes (if we are to add more) if this one fails
sh "exit 0"
currentBuild.result = 'FAILURE'
}
} finally {
sh "docker stop pricing-app-${JOB_BASE_NAME}_${BUILD_NUMBER} && docker rm -f pricing-app-${JOB_BASE_NAME}_${BUILD_NUMBER}"
}
}