Skip to content

Commit 354aaa8

Browse files
committed
Merge branch 'develop' of github.com:FlowCI/flow-platform into develop
2 parents b717d51 + e5416f1 commit 354aaa8

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

platform-api/src/main/java/com/flow/platform/api/consumer/CmdLoggingConsumer.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818

1919
import com.flow.platform.core.http.converter.RawGsonMessageConverter;
2020
import com.flow.platform.domain.CmdType;
21-
import com.flow.platform.domain.Jsonable;
2221
import com.flow.platform.util.Logger;
23-
import com.google.gson.annotations.JsonAdapter;
2422
import java.util.Map;
2523
import org.springframework.beans.factory.annotation.Autowired;
2624
import org.springframework.messaging.simp.SimpMessagingTemplate;
@@ -78,25 +76,19 @@ protected void handleTextMessage(WebSocketSession session, TextMessage message)
7876

7977
if (category.equals(CmdType.SYSTEM_INFO.toString())) {
8078
sendAgentSysInfo(content);
81-
return;
8279
}
8380
}
8481

8582
/**
8683
* send command log
87-
* @param cmdId
88-
* @param content
89-
* @param number
9084
*/
9185
private void sendCmdLog(String cmdId, String content, String number) {
92-
9386
String event = String.format("/topic/cmd/%s", cmdId);
9487
template.convertAndSend(event, "{\"number\": \"" + number + "\", \"content\": \"" + content + "\"}");
9588
}
9689

9790
/**
9891
* send agent sys info
99-
* @param content
10092
*/
10193
private void sendAgentSysInfo(String content) {
10294
Map<String, String> dic = jsonConverter.getGson().fromJson(content, Map.class);

platform-api/src/main/java/com/flow/platform/api/service/job/NodeResultServiceImpl.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ public class NodeResultServiceImpl extends ApplicationEventService implements No
5454

5555
private final static Logger LOGGER = new Logger(NodeResultService.class);
5656

57+
private final static char SPACE_REPLACE = '_';
58+
5759
@Autowired
5860
private NodeResultDao nodeResultDao;
5961

@@ -194,15 +196,24 @@ private NodeResult createNodeResult(Job job, NodeTree nodeTree, Node node) {
194196

195197
// generate cc agent cmd id if node is runnable
196198
if (nodeTree.canRun(node.getPath())) {
197-
String agentCmdId = nodeResult.getKey().getJobId() + "-" + nodeResult.getKey().getPath();
198-
nodeResult.setCmdId(agentCmdId);
199+
nodeResult.setCmdId(createAgentCmdId(nodeResult));
199200
}
200201

201202
nodeResult.setName(node.getName());
202203
nodeResult.setNodeTag(node instanceof Flow ? NodeTag.FLOW : NodeTag.STEP);
203204
return nodeResult;
204205
}
205206

207+
/**
208+
* Create anget cmd id by job id and node path
209+
* @param nodeResult
210+
* @return
211+
*/
212+
private String createAgentCmdId(NodeResult nodeResult) {
213+
NodeResultKey key = nodeResult.getKey();
214+
return key.getJobId() + "-" + key.getPath().replace(' ', SPACE_REPLACE);
215+
}
216+
206217
private NodeStatus updateCurrent(Node current, NodeResult currentResult, Cmd cmd, String errorMsg) {
207218
boolean isAllowFailure = false;
208219
if (current instanceof Step) {

0 commit comments

Comments
 (0)