diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/engine/prepare/local/LocalFilePrepareService.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/engine/prepare/local/LocalFilePrepareService.java index fed803de72..557a16f31d 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/engine/prepare/local/LocalFilePrepareService.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/engine/prepare/local/LocalFilePrepareService.java @@ -31,6 +31,7 @@ import com.tencent.bk.job.execute.config.StorageSystemConfig; import com.tencent.bk.job.execute.engine.prepare.JobTaskContext; import com.tencent.bk.job.execute.model.FileSourceDTO; +import com.tencent.bk.job.execute.model.StepInstanceBaseDTO; import com.tencent.bk.job.execute.model.StepInstanceDTO; import com.tencent.bk.job.execute.service.AgentService; import com.tencent.bk.job.execute.service.TaskInstanceService; @@ -89,6 +90,8 @@ public void prepareLocalFilesAsync( List fileSourceList, LocalFilePrepareTaskResultHandler resultHandler ) { + fillLocalFileSourceHost(fileSourceList, stepInstance); + if (!JobConstants.FILE_STORAGE_BACKEND_ARTIFACTORY.equals( localFileConfigForExecute.getStorageBackend() )) { @@ -96,13 +99,6 @@ public void prepareLocalFilesAsync( resultHandler.onSuccess(new NFSLocalFilePrepareTask(false)); return; } - fileSourceList.forEach(fileSourceDTO -> { - if (fileSourceDTO.getFileType() == TaskFileTypeEnum.LOCAL.getType() || fileSourceDTO.isLocalUpload()) { - fileSourceDTO.setServers(agentService.getLocalServersDTO()); - } - }); - // 更新本地文件任务内容 - taskInstanceService.updateResolvedSourceFile(stepInstance.getId(), fileSourceList); ArtifactoryLocalFilePrepareTask task = new ArtifactoryLocalFilePrepareTask( stepInstance, false, @@ -118,6 +114,16 @@ public void prepareLocalFilesAsync( task.execute(); } + private void fillLocalFileSourceHost(List fileSourceList, StepInstanceBaseDTO stepInstance) { + fileSourceList.forEach(fileSourceDTO -> { + if (fileSourceDTO.getFileType() == TaskFileTypeEnum.LOCAL.getType() || fileSourceDTO.isLocalUpload()) { + fileSourceDTO.setServers(agentService.getLocalServersDTO()); + } + }); + // 更新本地文件任务内容 + taskInstanceService.updateResolvedSourceFile(stepInstance.getId(), fileSourceList); + } + public void clearPreparedTmpFile(long stepInstanceId) { // 本地文件暂不支持实时清理,依赖定时清理 }