-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathredeploy.cs
65 lines (64 loc) · 2.31 KB
/
redeploy.cs
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
//@req(token, action)
if (token == "${TOKEN}") {
var targetEnv = "${TARGET_ENV}",
nodeGroup = "${NODE_GROUP}",
buildNodeId = "${BUILD_NODE_ID}",
envName = "${BUILD_ENV}",
envAppid = "${BUILD_ENV_APPID}",
projectName = "${PROJECT_NAME}",
delay = getParam("delay") || 30,
UID = ${UID},
certified = ${CERTIFIED},
build = ${BUILD},
context = "${CONTEXT}";
if (action == 'redeploy') {
if (certified) {
return {result:99, error: 'redeploy action triggers automatically for certified containers', type: 'warning'};
} else {
return jelastic.env.control.RestartContainersByGroup(targetEnv, signature, nodeGroup, delay);
}
} else if (action == 'rebuild') {
var buildEnv = "${BUILD_ENV}",
nodeId = "${BUILD_NODE_ID}",
projectId = "${PROJECT_ID}",
resp;
if (certified) {
if (build){
//resp = jelastic.env.build.BuildProject(buildEnv, signature, nodeId, projectId);
var params = {
envName: buildEnv,
session: signature,
nodeid: nodeId,
projectid: projectId,
delay: delay
}
resp = jelastic.env.build.BuildDeployProject(params);
} else {
var params = {
envName: targetEnv,
session: signature,
context: context,
delay: delay
}
resp = jelastic.env.vcs.Update(params);
}
} else {
if (build) {
resp = jelastic.env.build.BuildProject(buildEnv, signature, nodeId, projectId);
} else {
return {result: 99, error: 'deploy to non-certified containers is not implemented yet', type: 'warning'}
}
}
return resp;
} else {
return {
"result": 3,
"error": "unknown action [" + action + "]"
}
}
} else {
return {
"result": 8,
"error": "wrong token"
}
}