Skip to content

Commit

Permalink
feature: Job 支持容器执行 - 脚本任务 TencentBlueKing#2631
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyu096 committed Feb 19, 2024
1 parent b930a84 commit 4e217ce
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ private TaskInstanceExecuteObjects processExecuteObjects(TaskInstanceDTO taskIns
acquireAndSetHosts(taskInstanceExecuteObjects, taskInstance, stepInstanceList, variables);
acquireAndSetContainers(taskInstanceExecuteObjects, taskInstance, stepInstanceList);
boolean isSupportExecuteObjectFeature = isSupportExecuteObjectFeature(taskInstance);
stepInstanceList.forEach(stepInstance ->
stepInstance.buildStepFinalExecuteObjects(isSupportExecuteObjectFeature));
mergeExecuteObjects(stepInstanceList, variables, isSupportExecuteObjectFeature);
checkExecuteObjectExist(taskInstanceExecuteObjects);
watch.stop();

Expand Down Expand Up @@ -381,6 +380,21 @@ private TaskInstanceExecuteObjects processExecuteObjects(TaskInstanceDTO taskIns
}
}

private void mergeExecuteObjects(List<StepInstanceDTO> stepInstanceList,
Collection<TaskVariableDTO> variables,
boolean isSupportExecuteObjectFeature) {
stepInstanceList.forEach(stepInstance ->
stepInstance.buildStepFinalExecuteObjects(isSupportExecuteObjectFeature));
if (CollectionUtils.isNotEmpty(variables)) {
variables.forEach(variable -> {
if (TaskVariableTypeEnum.HOST_LIST.getType() == variable.getType()
&& variable.getTargetServers() != null) {
variable.getTargetServers().buildMergedExecuteObjects(isSupportExecuteObjectFeature);
}
});
}
}

private boolean isSupportExecuteObjectFeature(TaskInstanceDTO taskInstance) {
FeatureExecutionContext featureExecutionContext =
FeatureExecutionContext.builder()
Expand Down

0 comments on commit 4e217ce

Please sign in to comment.