-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
55 lines (45 loc) · 1.85 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
cplxStrng = "";
nameSpaceFolder = "";
deplymentsYamlFolder = ""
pipeline {
//agent any //Use this for default
agent{
node{
label 'cd-jenkins'
}
}
environment {
CREDENTIALS_ID = 'wncp-k8s-service-accnt'
}
stages {
stage("Checkout code") {
steps {
echo "Start checkout"
checkout scm
}
}
stage('Creating name space') {
steps{
sh "ls ${projectfolder}/"
script {
nameSpaceFolder = projectfolder + '/' + projectfolder+ '-namespace.yaml'
}
echo "${projectfolder} ${projectid} ${clusterid} ${location}"
echo "nameSpaceFolder: ${nameSpaceFolder}"
step([$class: 'KubernetesEngineBuilder', projectId: projectid, clusterName: clusterid, location: location, manifestPattern: nameSpaceFolder, credentialsId: env.CREDENTIALS_ID, verifyDeployments: true])
}
}
stage('Applying all yaml to GKE') {
steps{
echo "${projectfolder} ${projectid} ${clusterid} ${location}"
script {
deplymentsYamlFolder = projectfolder + '/'
}
echo "deplymentsYamlFolder : ${deplymentsYamlFolder}"
sh "ls ${deplymentsYamlFolder}"
//step([$class: 'KubernetesEngineBuilder', projectId: env.PROJECT_ID, clusterName: env.CLUSTER_NAME, location: env.LOCATION, manifestPattern: projectfolder, credentialsId: env.CREDENTIALS_ID, verifyDeployments: true])
step([$class: 'KubernetesEngineBuilder', projectId: projectid, clusterName: clusterid, location: location, manifestPattern: deplymentsYamlFolder, credentialsId: env.CREDENTIALS_ID, verifyDeployments: true])
}
}
}
}