-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
45 lines (44 loc) · 1.42 KB
/
Jenkinsfile
File metadata and controls
45 lines (44 loc) · 1.42 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
pipeline {
agent any
stages {
stage('get source') {
steps {
echo "build id = v2.${env.BUILD_ID}"
echo 'downloading the source code from git'
git branch: 'master',
url: 'https://github.com/Deveshdvs/internal-demo.git'
sh 'ls -a'
}
}
stage('check versions') {
steps {
sh 'docker --version'
sh 'gcloud version'
sh 'nodejs -v'
sh 'npm -v'
}
}
stage('npm install and test') {
steps {
echo 'running npm install'
sh 'npm install'
echo 'running tests'
sh 'npm test'
}
}
stage('build') {
steps {
echo "build id = v2.${env.BUILD_ID}"
sh "gcloud builds submit --tag gcr.io/dtc-user13/internal:v2.${env.BUILD_ID} ."
}
}
stage('kubernets deploy') {
steps {
echo "connect to cluster"
sh 'gcloud container clusters get-credentials cluster-demo --zone asia-east1-a --project dtc-user13'
echo "setting new image"
sh "kubectl set image deployments/events-data events-data=gcr.io/dtc-user13/internal:v2.${env.BUILD_ID} --record"
}
}
}
}