Repository navigation
Expand file tree
/
Copy pathJenkinsfile
More file actions
63 lines (59 loc) · 2.88 KB
/
Copy pathJenkinsfile
File metadata and controls
63 lines (59 loc) · 2.88 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
node {
def nodeBuilder = docker.image("danlynn/ember-cli:3.0.0")
nodeBuilder.pull()
try {
stage('Checkout') {
checkout scm
}
stage('Test') {
// try {
// sh 'yarn run coverage'
// junit 'coverage/test-results.xml'
// cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage/cobertura-coverage.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
// } catch (e) {
// junit 'coverage/test-results.xml'
// cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage/cobertura-coverage.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
// slackSend color: 'bad', channel: '#codebot', message: "Failed testing ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|View>)"
// sh 'yarn run postcoverage'
// throw e
// }
}
} catch (e) {
slackSend color: 'bad', channel: '#codebot', message: "Failed testing ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|View>)"
throw e
}
try {
stage('Yarn Production Install') {
nodeBuilder.inside("-v ${env.WORKSPACE}:/app -u 0:0") {
sh 'yarn install'
sh 'ember build --environment=production'
sh 'rm -rf node_modules bower_components tmp'
}
}
} catch (e) {
slackSend color: 'bad', message: "Failed building ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|View>)"
process.exit(1)
}
if (!env.BRANCH_NAME.contains('PR-')) {
try {
docker.withRegistry('https://664537616798.dkr.ecr.us-east-1.amazonaws.com', 'ecr:us-east-1:aws-jenkins-login') {
stage('Build Container') {
myDocker = docker.build("hydra-app:v${env.BUILD_NUMBER}", '.')
}
stage('Push Container') {
myDocker.push("latest");
myDocker.push("v${env.BUILD_NUMBER}");
}
}
stage('Upgrade Container') {
rancher confirm: true, credentialId: 'rancher', endpoint: 'https://rancher.as3.io/v2-beta', environmentId: '1a18', image: "664537616798.dkr.ecr.us-east-1.amazonaws.com/hydra-app:v${env.BUILD_NUMBER}", service: 'hydra/app', environments: '', ports: '', timeout: 60
}
stage('Notify Upgrade') {
slackSend color: 'good', message: "Finished deploying ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|View>)"
}
} catch (e) {
slackSend color: 'bad', message: "Failed deploying ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|View>)"
process.exit(1)
}
}
}