-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile-dev
80 lines (59 loc) · 2.75 KB
/
Jenkinsfile-dev
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
73
74
75
76
77
78
79
80
node {
def app
def appName='App1'
def snapName=''
def deployName = 'PROD-US'
def exportFormat ='json'
def fileNamePrefix ='exported_file_'
def fullFileName="${appName}-${deployName}-${currentBuild.number}.${exportFormat}"
def changeSetId=""
def snapshotName=""
stage('Clone repository') {
echo "checkout scm"
checkout scm
}
stage('Build image') {
snDevOpsStep(enabled:true)
app = docker.build("santoshnrao/demo-training-studio")
}
stage('Test image') {
app.inside {
sh 'echo "Tests passed"'
}
}
// stage('Push image') {
// sh 'ls -a'
// docker.withRegistry('https://registry.hub.docker.com', 'santoshnrao-dockerhub') {
// app.push("${env.BUILD_NUMBER}")
// app.push("latest")
// }
// }
stage('Validate Configurtion file'){
sh 'echo validating configuration file'
changeSetId = snDevOpsConfigUpload(applicationName:"${appName}",target:'component',namePath:'paymentservice.v1.1', fileName:'paymentService', autoCommit:'true',autoValidate:'true',dataFormat:'json')
echo "validation result $changeSetId"
}
stage("register change set to pipeline"){
echo "Change set registration for ${changeSetId}"
changeSetRegResult = snDevOpsConfigRegisterChangeSet(changesetId:"${changeSetId}")
}
step("Get snapshots created"){
echo "Triggering Get snapshots for applicationName:${appName},deployableName:${deployName},changeSetId:${changeSetId}"
changeSetResults = snDevOpsConfigGetSnapshots(applicationName:"${appName}",deployableName:"${deployName}",changeSetId:"${changeSetId}")
echo "ChangeSet Result : ${changeSetResults}"
}
stage('Publish the snapshot'){
echo "Step to publish snapshot applicationName:${appName},deployableName:${deployName} snapshotName:${snapshotName}"
publishSnapShotResult(applicationName:"${appName}",,deployableName:"${deployName}",snapshotName: "${snapshotName}")
}
stage("deploy to system") {
sh ' echo deployment done'
//sh "docker run -it --rm -d -p 80:80 --name web santoshnrao/demo-training-studio:${env.BUILD_NUMBER}"
// withKubeConfig([credentialsId: 'santosh-devops-config-k8s']) {
// sh 'kubectl apply -f k8s/'
// }
// kubernetesDeploy(kubeconfigId: 'devops-config-demo-1', // REQUIRED
// configs: 'k8s/', // REQUIRED
// )
}
}