命令修改

This commit is contained in:
even 2025-05-29 19:23:28 +08:00
parent 59cdbf7401
commit c249975546
6 changed files with 26 additions and 4 deletions

View File

@ -44,7 +44,7 @@ public class AFLWorker extends SshWorker {
//获取机器
MachineInfo machineInfoDO = this.getMachineInfoService().getById(machineId);
statusCode = shell(machineInfoDO, CryptogramUtil.doDecrypt(machineInfoDO.getPassword()), context,
statusCode = shell(machineInfoDO, null, context,
"echo \"自定义镜像执行命令\"",
commandScript
);
@ -56,8 +56,10 @@ public class AFLWorker extends SshWorker {
}
if (statusCode == 0) {
log.info("节点执行完成");
append(context,"节点执行完成");
} else {
log.error("节点执行失败");
append(context,"节点执行失败");
}
localVariables.put(DIYImageExecuteCommandConstant.STATUS_CODE, statusCode);
}

View File

@ -8,6 +8,7 @@ import cd.casic.ci.process.engine.worker.base.SshWorker;
import cd.casic.ci.process.process.dataObject.log.PipTaskLog;
import cd.casic.ci.process.process.dataObject.machine.MachineInfo;
import cd.casic.ci.process.process.dataObject.task.PipTask;
import cd.casic.ci.process.util.CryptogramUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@ -55,7 +56,8 @@ public class DIYImageExecuteCommandWorker extends SshWorker {
//获取机器
MachineInfo machineInfoDO = this.getMachineInfoService().getById(machineId);
statusCode = shell(machineInfoDO,"Hnidc@0626cn!@#zyx",context,
//TODO 得改一下
statusCode = shell(machineInfoDO, null,context,
"echo \"自定义镜像执行命令\"",
commandScript
);

View File

@ -43,7 +43,7 @@ public class TestCaseGenerationWorker extends SshWorker {
//获取机器
MachineInfo machineInfoDO = this.getMachineInfoService().getById(machineId);
statusCode = shell(machineInfoDO, CryptogramUtil.doDecrypt(machineInfoDO.getPassword()), context,
statusCode = shell(machineInfoDO, null, context,
"echo \"自定义镜像执行命令\"",
commandScript
);

View File

@ -190,7 +190,15 @@ public class SshCommand implements SshClient {
} else {
realCmd = cmd;
}
commander.append(realCmd).append(CommandConstant.ENTER);
for (String s : realCmd.split("\n")) {
commander.append(s).append(CommandConstant.ENTER);
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
commander.append("exit").append(CommandConstant.ENTER);

View File

@ -0,0 +1,6 @@
package cd.casic.server;
public class LogTest {
public static void main(String[] args) {
}
}

File diff suppressed because one or more lines are too long