-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJenkins
More file actions
54 lines (44 loc) · 1.57 KB
/
Jenkins
File metadata and controls
54 lines (44 loc) · 1.57 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
pipeline {
agent any
environment {
GIT_BRANCH = 'master'
GIT_URL = 'git@github.com:stringeecom/techtalk2023-web.git'
IP = '35.240.157.99'
USER = 'centos'
}
stages {
stage('Git Checkout') {
steps {
git branch: "${GIT_BRANCH}", url: "${GIT_URL}", credentialsId: 'dautv-github-cred'
}
}
stage('Build') {
steps {
sh 'node -v'
sh 'npm -v'
sh "npm install"
sh "npm run build"
}
}
stage('Create Image') {
environment {
GIT_COMMIT_REV = sh(returnStdout: true, script: "git log -n 1 --pretty=format:'%h'").trim()
}
steps {
sh "sudo docker build -t hub-server.stringee.io/video-call-demo:${GIT_COMMIT_REV} ."
sh "sudo docker push hub-server.stringee.io/video-call-demo:${GIT_COMMIT_REV}"
}
}
stage('Deploy K8s') {
environment {
GIT_COMMIT_REV = sh(returnStdout: true, script: "git log -n 1 --pretty=format:'%h'").trim()
}
steps {
sshagent(credentials: ['k8s-master_test-master-3']) {
// Helm deploy
sh 'ssh -o StrictHostKeyChecking=no ${USER}@${IP} -T "cd /data/tech-talk/stringee-helm-chart && git pull && helm upgrade --install video-call-web ./tech-talk/video-demo-web --set image.tag=${GIT_COMMIT_REV} -n tech-talk"'
}
}
}
}
}