-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjenkins_pipeline_job.sh
68 lines (63 loc) · 2.2 KB
/
jenkins_pipeline_job.sh
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
node {
stage("PreCheck") {
RequestPath=RequestPath.replace(" ","").toLowerCase()
ServiceName=ServiceName.replace(" ","").toLowerCase()
}
stage("Build") {
print "Checkout Source Code"
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/AchuthSankar/HelloWorld.git']]])
sh "mvn -DskipTests=true package"
}
stage("Unit Testing") {
build 'HelloWorldServiceTest'
}
stage("DEV Tool Checkout") {
print "Checkout Env Setup"
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'scripts']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/AchuthSankar/iaac.git']]])
sh """
echo $RequestPath
echo $ServiceName
echo $ServicePort
echo $StripRequestPath
"""
}
stage("Dev Containerizing") {
withEnv(["ServiceName=Test"]) {
sh returnStatus: true, script: """
export ServiceName=$ServiceName
data=`./scripts/docker_image_deploy.sh`
exit 0
"""
}
}
stage("Dev API configuration") {
sh """
curl -i -X DELETE \
--url http://localhost:8001/apis/${ServiceName}
data=`curl -i -X POST \
-o /dev/null \
-s -w "%{http_code}" \
--url http://localhost:8001/apis/ \
--data "name=${ServiceName}" \
--data "upstream_url=${ServicePort}" \
--data "request_path=${RequestPath}"`
if [ \$data != 201 ]; then
exit 1
fi
"""
}
stage("Integration Testing") {
}
stage("Stage Infrastructure") {
}
stage("Stage Deployment") {
}
input message: 'Do you want to deploy to production ???', ok: 'Deploy', submitterParameter: 'isDeployableReady'
stage("Production Deployment") {
if (${isDeployableReady}) {
echo "Deploy"
} else {
echo "Cancelled"
}
}
}