-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
41 lines (35 loc) · 1.03 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
pipeline {
agent { docker 'node:latest' }
environment {
PROD_USER = credentials('PROD_USER')
PROD_HOST_IP = credentials('PROD_HOST_IP')
PROD_SSH_KEY_PATH = credentials('PROD_SSH_KEY_PATH')
RELEASE_DOMAIN = 'parser.maartendev.me'
}
stages {
stage('Setup'){
steps {
sh 'npm install'
}
}
stage('Unit Tests'){
steps {
sh './node_modules/jest/bin/jest.js --coverage'
}
}
stage('build'){
steps {
sh 'npm run build'
}
}
stage('deploy'){
agent {
label 'master'
}
steps {
sh "ssh -o StrictHostKeyChecking=no ${PROD_USER}@${PROD_HOST_IP} -i ${PROD_SSH_KEY_PATH} 'rm -rf /var/www/${RELEASE_DOMAIN}/*'"
sh "scp -o StrictHostKeyChecking=no -r -i ${PROD_SSH_KEY_PATH} . ${PROD_USER}@${PROD_HOST_IP}:/var/www/${RELEASE_DOMAIN}/"
}
}
}
}