-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.k8s
72 lines (71 loc) · 2.64 KB
/
Jenkinsfile.k8s
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
69
70
71
72
podTemplate(inheritFrom: 'jenkins-agent', containers: [
containerTemplate(name: 'python', image: 'python:3.9.9-slim-buster', command: 'sleep', args: '99d'),
containerTemplate(name: 'node', image: 'node:14-alpine3.12', command: 'sleep', args: '99d'),
containerTemplate(name: 'ubuntu', image: 'ubuntu', command: 'sleep', args: '99d'),
]) {
node(POD_LABEL) {
container('python') {
stage('Git Checkout') {
git branch: "master",
credentialsId: 'github',
url: 'git@github.com:simonamdev/covid19-malta.git'
}
stage('Prepare Dependencies') {
sh 'pip install -r requirements.txt'
}
stage('Download Data') {
sh 'python download_latest.py'
sh 'python convert_latest.py'
stash(name: 'latest_data', includes: 'data/latest_data.json')
}
}
container('node') {
stage('Build Website') {
sh 'mkdir ./build'
sh 'chmod -R 777 ./build'
dir('./build') {
git branch: "master",
credentialsId: 'github',
url: 'git@github.com:simonamdev/covid19-malta.git'
dir('website') {
sh 'yarn install --network-timeout 100000'
sh 'yarn run build'
stash(name: 'website', includes: 'public/**/*')
}
}
}
}
container('ubuntu') {
stage('Deploy to VPS') {
steps {
unstash('website')
sshPublisher(
publishers: [
sshPublisherDesc(
configName: 'devvps',
transfers: [
sshTransfer(
cleanRemote: true,
excludes: '',
execCommand: '',
execTimeout: 120000,
flatten: false,
makeEmptyDirs: true,
noDefaultExcludes: false,
patternSeparator: '[, ]+',
remoteDirectory: '/home/covid19/website',
remoteDirectorySDF: false,
sourceFiles: 'public/**/*'
)
],
usePromotionTimestamp: false,
useWorkspaceInPromotion: false,
verbose: true
)
]
)
}
}
}
}
}