Added Bash Execution for Airship Build workflow 71/271/2
authorNarendervemula <nv537j@att.com>
Tue, 25 Sep 2018 02:58:57 +0000 (02:58 +0000)
committernarender vemu <nv537j@att.com>
Fri, 28 Sep 2018 04:27:26 +0000 (04:27 +0000)
Change-Id: I9d5d6296610ec2a556490ade7ebfc4af9454a837
Signed-off-by: Narendervemula <nv537j@att.com>
akraino/src/main/java/com/akraino/bpm/delegate/ScriptExecutorTaskDelegate.java
akraino/src/main/java/com/akraino/bpm/service/impl/AsyncProcessExecutorServiceImpl.java
akraino/src/main/java/com/akraino/bpm/service/impl/ScriptExecutionServiceImpl.java

index 59beee8..822b56d 100644 (file)
@@ -40,8 +40,18 @@ public class ScriptExecutorTaskDelegate implements JavaDelegate {
        
        public void execute(DelegateExecution ctx) throws Exception {
                String  filepath=(String)ctx.getVariable("filepath");
-               logger.debug("task execution started  :"+filepath);
-               scriptExecutionService.executeScript(filepath);
+               String fileparams=(String)ctx.getVariable("fileparams");
+               logger.debug("task execution started {} :",filepath);
+               
+               
+               int lastindex=filepath.lastIndexOf("/");
+               String srcdir=filepath.substring(0,lastindex);
+               String filename=filepath.substring(lastindex+1,filepath.length());
+               String task= filename+"  "+(fileparams!=null?fileparams.replaceAll(",", "  "):" ");
+               
+               logger.debug("task execution started  command: {} , src dir  :{}",task,srcdir);
+               
+               scriptExecutionService.executeCDBashScript(srcdir,task);
        }
 
 }
index d2e303b..4dcc92a 100644 (file)
@@ -95,9 +95,8 @@ public class AsyncProcessExecutorServiceImpl implements AsyncProcessExecutorServ
        
        private ProcessInstance executeBuildService(Build build) {
                
-               String filepath=build.getFilepath()+"  "+(build.getFileparams()!=null?build.getFileparams().replaceAll(",", "  "):" ");
                return camunda.getRuntimeService().startProcessInstanceByKey("build",
-                               Variables.putValue("filepath", filepath).putValue("targetfolder", build.getTargetfolder()));
+                               Variables.putValue("filepath", build.getFilepath()).putValue("fileparams", build.getFileparams()).putValue("targetfolder", build.getTargetfolder()));
        }
        
        @Async
index 3cc853b..36842d3 100644 (file)
@@ -100,7 +100,7 @@ public class ScriptExecutionServiceImpl implements ScriptExecutionService{
                    }
                    logger.debug("Script exit code :"+p.exitValue());
                    if(p.exitValue()!=0) {
-                       throw new TaskExecutorException("problem while executing the script . exist code :"+p.exitValue());
+                       throw new TaskExecutorException("problem while executing the script . exit code :"+p.exitValue());
                    }