This commit is contained in:
string 2025-04-26 11:15:31 +05:30
parent 3a07d5a501
commit ab1237419c
3 changed files with 30 additions and 23 deletions

View File

@ -116,6 +116,19 @@ public class SureOpsController {
} }
@GetMapping("/run")
public ResponseEntity<?> runWorkflow(@RequestParam Integer projId, @RequestParam String workflowId)
throws IOException, InterruptedException {
int status_code = 500;
long Deployment_profile = 2l;
// NOW MAKE SHELLSCRIPT THAT CLONE FROM REPOSITORY
ResponseEntity<?> get = script_serviceMaking.CreateFiles(projId, workflowId, Deployment_profile);
return new ResponseEntity<>(new EntityResponse(get.getBody().toString()), HttpStatus.BAD_REQUEST);
}
@PostMapping("/createFile") @PostMapping("/createFile")
public void createHtmlFiles(@RequestParam Integer projId, @RequestBody Map<String, String> pageHtmlMap) public void createHtmlFiles(@RequestParam Integer projId, @RequestBody Map<String, String> pageHtmlMap)
throws IOException { throws IOException {

View File

@ -50,6 +50,11 @@ public class ScriptSrvice {
JsonObject obj = ar.getAsJsonObject(); JsonObject obj = ar.getAsJsonObject();
JsonElement workflowvalue = obj.get("workflow"); JsonElement workflowvalue = obj.get("workflow");
if (workflowvalue == null) {
continue;
}
String value = workflowvalue.getAsString(); String value = workflowvalue.getAsString();
String tableid_url = PortConstant.BACKEND_PORTAL_DOMAIN String tableid_url = PortConstant.BACKEND_PORTAL_DOMAIN
@ -94,7 +99,8 @@ public class ScriptSrvice {
String value = entry.getValue().getAsString(); String value = entry.getValue().getAsString();
keys.add(value); keys.add(value);
if (value.equalsIgnoreCase("Shell Script")) { if (value.equalsIgnoreCase("Shell Script") || value.equalsIgnoreCase("Others")
|| value.equals("Yamel File") || (value.equalsIgnoreCase("Docker File"))) {
System.out.println("script data"); System.out.println("script data");
script(prj_id, workflow_model, PRJ_NAME, gitea_url, Deployment_profile); script(prj_id, workflow_model, PRJ_NAME, gitea_url, Deployment_profile);
i++; i++;

View File

@ -35,25 +35,20 @@ public class Script_Making {
// Creating files like yaml, shell SCript ,docker File // Creating files like yaml, shell SCript ,docker File
public ResponseEntity<?> CreateFiles(Integer prj_id,String workflow_id,long Deployment_profile) public ResponseEntity<?> CreateFiles(Integer prj_id, String workflow_id, long Deployment_profile)
throws IOException { throws IOException {
// String table_name = tble.replaceAll(" ", "_").toLowerCase(); // String table_name = tble.replaceAll(" ", "_").toLowerCase();
String prj_url = PortConstant.BACKEND_PORTAL_DOMAIN + "/token/fnd1/callingsureops/getproject/" + prj_id;
String prj_url = PortConstant.BACKEND_PORTAL_DOMAIN
+ "/token/fnd1/callingsureops/getproject/" + prj_id;
// get project // get project
ResponseEntity<Object> prj = GET(prj_url); ResponseEntity<Object> prj = GET(prj_url);
Object prj_body = prj.getBody(); Object prj_body = prj.getBody();
List<String> lineList = callforproject(prj_body); List<String> lineList = callforproject(prj_body);
// get workflowline // get workflowline
String line_url = PortConstant.BACKEND_PORTAL_DOMAIN String line_url = PortConstant.BACKEND_PORTAL_DOMAIN + "/token/fnd1/callingsureops/workflowline/" + workflow_id;
+ "/token/fnd1/callingsureops/workflowline/" + workflow_id;
ResponseEntity<Object> get = GET(line_url); ResponseEntity<Object> get = GET(line_url);
Object body = get.getBody(); Object body = get.getBody();
String workflow_model = callforline(body); String workflow_model = callforline(body);
@ -61,7 +56,6 @@ public class Script_Making {
String PRJ_NAME = lineList.get(0); String PRJ_NAME = lineList.get(0);
String gitea_url = lineList.get(1); String gitea_url = lineList.get(1);
// Parsing Json data // Parsing Json data
JsonParser parser1 = new JsonParser(); JsonParser parser1 = new JsonParser();
@ -77,10 +71,10 @@ public class Script_Making {
String key = entry.getKey(); String key = entry.getKey();
String value1 = entry.getValue().getAsString(); String value1 = entry.getValue().getAsString();
if (value1.equalsIgnoreCase("Shell Script")) { if (value1.equalsIgnoreCase("Shell Script") || value1.equalsIgnoreCase("Others")
|| value1.equals("Yamel File") || (value1.equalsIgnoreCase("Docker File"))) {
System.out.println("script data"); System.out.println("script data");
sureservice.script(prj_id, workflow_model, PRJ_NAME, gitea_url, sureservice.script(prj_id, workflow_model, PRJ_NAME, gitea_url, Deployment_profile);
Deployment_profile);
i++; i++;
} }
} }
@ -90,16 +84,10 @@ public class Script_Making {
sureservice.Createonefile(prj_id, lineList, workflow_model, Deployment_profile); sureservice.Createonefile(prj_id, lineList, workflow_model, Deployment_profile);
} }
return new ResponseEntity<>(new EntityResponse("script file created"), HttpStatus.CREATED); return new ResponseEntity<>(new EntityResponse("script file created"), HttpStatus.CREATED);
} }
public List<String> callforproject(Object object) throws JsonProcessingException { public List<String> callforproject(Object object) throws JsonProcessingException {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();