-
Notifications
You must be signed in to change notification settings - Fork 1
/
JenkinsfileProd
executable file
·46 lines (46 loc) · 1.51 KB
/
JenkinsfileProd
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
#!/usr/bin/env groovy
pipeline {
agent any
stages {
stage("Git Checkout") {
steps {
git changelog: false, credentialsId: 'gitlab-secret', poll: false, branch: 'master', url: 'https://sfxs-gitlab.github.com/java/cloud-web.git'
}
}
stage('Node Build') {
steps {
sh '''
echo 开始构建项目
npm config set registry https://registry.npmmirror.com
npm install
npm run build
echo 完成构建项目
'''
}
}
stage('Docker Build') {
steps {
script {
dir("") {
withDockerRegistry(credentialsId: 'docker-nexus', url: 'https://harbor.sfxsgroup.com') {
sh "docker build -t harbor.sfxsgroup.com/sfxs/cloud-web:prod ."
sh "docker push harbor.sfxsgroup.com/sfxs/cloud-web:prod"
}
}
}
}
}
stage('K8SPROD Deploy') {
steps {
script {
dir("builds/k8sprod") {
withKubeConfig([credentialsId: 'sfxs-prod-k8s']) {
sh "sed -i 's/latest/v_${env.BUILD_ID}/' dms.yaml"
sh "kubectl apply -f dms.yaml"
}
}
}
}
}
}
}