-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
68 lines (68 loc) · 1.72 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
pipeline {
agent {
docker {
image 'node:12-alpine'
args '-p 20001-20100:3000'
}
}
environment {
CI = 'false'
HOME = '.'
npm_config_cache = 'npm-cache'
}
tools {
git 'masterGit'
}
stages {
stage('Install Packages') {
steps {
// // sh 'git --version'
// sh 'node -v'
// sh 'npm -v'
sh 'npm install'
}
}
stage('Test and Build') {
parallel {
// stage('Run Tests') {
// steps {
// sh 'npm run test'
// }
// }
stage('Create Build Artifacts') {
steps {
sh 'npm run build'
}
}
}
}
stage('Deployment') {
parallel {
stage('Dev') {
when {
branch 'dev'
}
steps {
withAWS(region:'us-east-1',credentials:'AWS-Credential-Jenkins-ID') {
s3Delete(bucket: 'dev.cloudcops.io', path:'**/*')
s3Upload(bucket: 'dev.cloudcops.io', workingDir:'build', includePathPattern:'**/*');
}
mail(subject: 'Staging Build', body: 'New Deployment to Staging', to: '[email protected]')
}
}
stage('Production') {
when {
branch 'master'
}
steps {
withAWS(region:'us-east-1',credentials:'<AWS-Production-Jenkins-Credential-ID>') {
s3Delete(bucket: 'cloudcops.io', path:'**/*')
s3Upload(bucket: 'cloudcops.io', workingDir:'build', includePathPattern:'**/*');
}
mail(subject: 'Production Build', body: 'New Deployment to Production', to: '[email protected]')
}
}
}
}
}
}