-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
61 lines (50 loc) · 2.57 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
56
57
58
59
60
61
properties([
parameters([
choice(choices: 'tb-alpha-api-testbook\ncore\nengage\ntests', description: 'Select the environment that you want to deploy the script', name: 'environment')
])
])
//node {
//sh("echo Testbook")
//String ssh_config="gcloud compute ssh tb-alpha-api-testbook --zone asia-south1-c --internal-ip --command"
//if(env.environment == "tb-alpha-api-testbook"){
// ssh_config="gcloud compute ssh " + env.environment + " --zone asia-south1-c --internal-ip --command"
// sh("echo ${ssh_config}")
//}
//else {
// ssh_config="gcloud compute ssh tb-prod-mongo-" + env.environment + "-primary-new-01 --zone asia-south1-c --internal-ip --command"
// sh("echo ${ssh_config}")
//}
//String app_workspace="/root/mongo-fix-backend"
//sh ("echo ${ssh_config}")
//stage ('Get Latest Code'){
// sh ("echo \"Getting Code on ${env.environment} environment and the ssh_config is ${inputTest}\"")
// sh ("${ssh_config} \"sudo chmod +x ${app_workspace}/get_latest_code.sh && sudo bash ${app_workspace}/get_latest_code.sh ${env.BRANCH_NAME} \" ")
//}
//stage ('Run Service'){
// sh ("${ssh_config} \"sudo chmod +x ${app_workspace}/${env.Path} && sudo bash ${app_workspace}/${env.Path} \" ")
//}
//}
node {
stage ("Prompt for input") {
env.PATH = input message: 'Please enter the full Path',
parameters: [string(defaultValue: '',
description: '',
name: 'Path')]
}
echo "PATH: ${env.Path}"
String ssh_config=""
if(env.environment == "tb-alpha-api-testbook"){
ssh_config="gcloud compute ssh " + env.environment + " --zone asia-south1-c --internal-ip --command"
}
else {
ssh_config="gcloud compute ssh tb-prod-mongo-" + env.environment + "-primary-new-01 --zone asia-south1-c --internal-ip --command"
sh("echo ${ssh_config}")
}
String app_workspace="/root/mongo-fix-backend"
echo "ssh_config: ${ssh_config}"
//stage ('GEt latest code') {
echo "Getting Code on ${env.environment} environment and the ssh_config is ${ssh_config}"
sh("${ssh_config} \"sudo chmod +x ${app_workspace}/get_latest_code.sh && sudo bash ${app_workspace}/get_latest_code.sh ${env.BRANCH_NAME}\"")
sh("${ssh_config} \"sudo chmod +x ${app_workspace}/${env.Path} && sudo bash ${app_workspace}/${env.Path}\"")
// }
}