diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index bb20b2bc7c..8ba7f2bd82 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -7,4 +7,10 @@ assignees: '' --- +**版本/分支/tag** +**问题描述** + +**如何复现** + +**预期结果** diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 4f92e912cb..88adcbc190 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -23,5 +23,5 @@ jobs: - name: build run: | export JOB_VERSION=3.latest - npm i && npm run build + npm i --legacy-peer-deps && npm run build working-directory: src/frontend diff --git a/.gitignore b/.gitignore index 9e9a9f0926..72e96c54e4 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,6 @@ out/ ### application ### **/*.log support-files/dependJarLists/ -**/*.DS_Store \ No newline at end of file +**/*.DS_Store +.codecc +build.yml diff --git a/src/backend/.gitignore b/src/backend/.gitignore index b265a41ed1..3f6ec1862d 100644 --- a/src/backend/.gitignore +++ b/src/backend/.gitignore @@ -5,4 +5,7 @@ build release -**/bin \ No newline at end of file +**/bin + +.codecc +build.yml \ No newline at end of file diff --git a/src/backend/commons/artifactory-sdk/src/main/java/com/tencent/bk/job/common/artifactory/sdk/ArtifactoryClient.java b/src/backend/commons/artifactory-sdk/src/main/java/com/tencent/bk/job/common/artifactory/sdk/ArtifactoryClient.java index 928fb1341f..a6164dab2c 100644 --- a/src/backend/commons/artifactory-sdk/src/main/java/com/tencent/bk/job/common/artifactory/sdk/ArtifactoryClient.java +++ b/src/backend/commons/artifactory-sdk/src/main/java/com/tencent/bk/job/common/artifactory/sdk/ArtifactoryClient.java @@ -61,6 +61,7 @@ import io.micrometer.core.instrument.MeterRegistry; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.Pair; import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; @@ -385,12 +386,12 @@ public NodeDTO getFileNode(String filePath) { return nodeDTO; } - public InputStream getFileInputStream(String filePath) throws ServiceException { + public Pair getFileInputStream(String filePath) throws ServiceException { List pathList = parsePath(filePath); return getFileInputStream(pathList.get(0), pathList.get(1), pathList.get(2)); } - public InputStream getFileInputStream(String projectId, String repoName, String filePath) throws ServiceException { + public Pair getFileInputStream(String projectId, String repoName, String filePath) throws ServiceException { DownloadGenericFileReq req = new DownloadGenericFileReq(); req.setProject(projectId); req.setRepo(repoName); @@ -400,7 +401,20 @@ public InputStream getFileInputStream(String projectId, String repoName, String CloseableHttpResponse resp; try { resp = longHttpHelper.getRawResp(false, url, getJsonHeaders()); - return resp.getEntity().getContent(); + Header contentLengthHeader = resp.getFirstHeader("Content-Length"); + Long contentLength = null; + if (contentLengthHeader != null && StringUtils.isNotBlank(contentLengthHeader.getValue())) { + contentLength = Long.parseLong(contentLengthHeader.getValue()); + log.debug("Content-Length from header:{}", contentLengthHeader.getValue()); + } else { + log.debug("Content-Length from header is null or blank"); + } + if (resp.getStatusLine() != null && resp.getStatusLine().getStatusCode() == 200) { + return Pair.of(resp.getEntity().getContent(), contentLength); + } else { + log.info("resp.statusLine={},resp.entity={}", resp.getStatusLine(), resp.getEntity()); + throw new InternalException(ErrorCode.FAIL_TO_REQUEST_THIRD_FILE_SOURCE_DOWNLOAD_GENERIC_FILE); + } } catch (IOException e) { log.error("Fail to getFileInputStream", e); throw new InternalException(ErrorCode.FAIL_TO_REQUEST_THIRD_FILE_SOURCE_DOWNLOAD_GENERIC_FILE); diff --git a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message.properties b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message.properties index 2f8bc9c85a..c9c3495b4f 100644 --- a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message.properties +++ b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message.properties @@ -104,6 +104,35 @@ 1243013=默认通知策略未配置,请联系管理员 1243014=账号被引用,禁止删除 1243015=文件大小超过上限{0} +1243016=创建 Tag 失败 +1243017=引用的脚本未上线或被删除 +1243018=新建模版失败 +1243019=更新模版失败 +1243020=保存模版发生未知错误 +1243021=标签已存在 +1243022=错误的变量类型 +1243023=新建执行方案失败 +1243024=更新执行方案失败 +1243025=保存执行方案发生未知错误 +1243026=模版不存在 +1243027=创建调试模版失败 +1243028=同步执行方案失败 +1243029=不支持的步骤类型 +1243030=批量操作失败 +1243031=不支持的任务类型 +1243032=新建步骤失败 +1243033=更新步骤失败 +1243034=删除步骤失败 +1243035=更新文件信息失败 +1243036=脚本版本已存在 +1243037=删除失败!存在关联的定时任务 +1243038=删除失败!执行方案存在关联的定时任务 +1243039=脚本版本Id已存在 +1243040=作业模板名称已存在 +1243041=更新模版失败!并发冲突,请不要多次点击保存 +1243045=同步脚本失败 +1243047=脚本版本不存在 +1243048=凭证不存在 ##业务错误-作业执行(job-execute) 1244001=主机为空 @@ -129,10 +158,17 @@ 1244021=文件任务数量超过限制:{0} 1244022=脚本任务目标服务器数量超过限制:{0} 1244023=本地文件{0}在后台不存在 + +## 业务错误-定时任务(job-crontab) +1245006=定时任务执行时间已失效 +1245007=定时任务结束时间或通知时间已失效 +1245005=更新定时任务获取锁失败 + ##业务错误-日志服务(job-logsvr) 1246001=获取作业执行日志失败 1246002=保存作业执行日志失败 1246003=删除作业执行日志失败 + ##业务错误-文件网关服务(job-file-gateway) 1260001=文件源不存在:{0} 1260002=接入点响应异常:ListFileNode,详情:{0} @@ -147,6 +183,7 @@ 1260012=无法根据标识{0}找到文件源 1260013=文件源服务异常 1260014=通过[{0}]找不到file-worker + ##业务错误-文件Worker服务(job-file-worker) 1262001=第三方文件源响应异常:ListBucket,详情:{0} 1262002=第三方文件源响应异常:ListObjects,详情:{0} @@ -157,37 +194,8 @@ ##业务错误-用户服务、登录服务 1247001=用户不存在或者未登录 -1243016=创建 Tag 失败 -1243017=引用的脚本未上线或被删除 -1243018=新建模版失败 -1243019=更新模版失败 -1243020=保存模版发生未知错误 -1243021=标签已存在 -1243022=错误的变量类型 -1243023=新建执行方案失败 -1243024=更新执行方案失败 -1243025=保存执行方案发生未知错误 -1243026=模版不存在 -1243027=创建调试模版失败 -1243028=同步执行方案失败 -1243029=不支持的步骤类型 -1243030=批量操作失败 -1243031=不支持的任务类型 -1243032=新建步骤失败 -1243033=更新步骤失败 -1243034=删除步骤失败 -1243035=更新文件信息失败 -1243036=脚本版本已存在 -1243037=删除失败!存在关联的定时任务 -1243038=删除失败!执行方案存在关联的定时任务 -1243039=脚本版本Id已存在 -1243045=同步脚本失败 -1243047=脚本版本不存在 -1243048=凭证不存在 -1245006=定时任务执行时间已失效 -1245007=定时任务结束时间或通知时间已失效 -1245005=更新定时任务获取锁失败 -1243041=更新模版失败!并发冲突,请不要多次点击保存。 + + ##业务错误-备份服务 1249001=从制品库获取节点信息失败 diff --git a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_en.properties b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_en.properties index 7ebbf7d502..7d76480be3 100644 --- a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_en.properties +++ b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_en.properties @@ -104,7 +104,35 @@ 1243013=Default notify policies not configed, please contact system administrator 1243014=Account is referenced and cannot be deleted 1243015=File size exceeds maximum {0} - +1243016=Create tag failed +1243017=Script version not online or deleted +1243018=Create job template failed +1243019=Update job template failed +1243020=Unknown error while saving job template +1243021=Tag already exist +1243022=Wrong variable type +1243023=Create job plan failed +1243024=Update job plan failed +1243025=Unknown error while saving job plan +1243026=Job template not exist +1243027=Error while creating debug plan +1243028=Sync job plan failed +1243029=Unsupported step type +1243030=Batch insert failed +1243031=Unsupported task type +1243032=Create step failed +1243033=Update step failed +1243034=Delete step failed +1243035=Update file info failed +1243036=Script version already exist +1243037=Delete failed! Plan is using by cron job(s) +1243038=Delete failed! Some plan(s) is(are) using by cron job(s) +1243039=Script version id already exist +1243040=Job template name already exist +1243041=Update template acquire lock failed! Please do not click save multiple times! +1243045=Sync script failed +1243047=Script version does not exist +1243048=Credential not exist ## Business error - job-execute 1244001=Host is empty @@ -130,10 +158,17 @@ 1244021=The number of file tasks exceeds the limit:{0} 1244022=The number of script task target servers exceeds the limit: {0} 1244023=The local file {0} not exists in backend + +## Business error - job-crontab +1245006=Cron job execution time already passed +1245007=Cron job end time or notify time already passed +1245005=Acquire lock failed while update cron job + ## Business error - job-logsvr 1246001=Failed to get execution log 1246002=Failed to save execution log 1246003=Failed to delete execution log + ## Business error (job-file-gateway) 1260001=FileSource does not exist:{0} 1260002=FileWorker response error:ListFileNode, Detail:{0} @@ -148,6 +183,7 @@ 1260012=Cannot find file source by code:{0} 1260013=File source service invalid 1260014=Cannot find file-worker by {0} + ## Business error (job-file-worker) 1262001=Third file source response error:ListBucket, Detail:{0} 1262002=Third file source response error:ListObjects, Detail:{0} @@ -158,37 +194,6 @@ ## Business error - User/Login 1247001=User does not exist or is not logged in -1243016=Create tag failed -1243017=Script version not online or deleted -1243018=Create job template failed -1243019=Update job template failed -1243020=Unknown error while saving job template -1243021=Tag already exist -1243022=Wrong variable type -1243023=Create job plan failed -1243024=Update job plan failed -1243025=Unknown error while saving job plan -1243026=Job template not exist -1243027=Error while creating debug plan -1243028=Sync job plan failed -1243029=Unsupported step type -1243030=Batch insert failed -1243031=Unsupported task type -1243032=Create step failed -1243033=Update step failed -1243034=Delete step failed -1243035=Update file info failed -1243036=Script version already exist -1243037=Delete failed! Plan is using by cron job(s) -1243038=Delete failed! Some plan(s) is(are) using by cron job(s) -1243039=Script version id already exist -1243045=Sync script failed -1243047=Script version does not exist -1243048=Credential not exist -1245006=Cron job execution time already passed -1245007=Cron job end time or notify time already passed -1245005=Acquire lock failed while update cron job -1243041=Update template acquire lock failed! Please do not click save multiple times! ## Business error - Backup 1249001=Fail to get node info from artifactory diff --git a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_en_US.properties b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_en_US.properties index 7ebbf7d502..7d76480be3 100644 --- a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_en_US.properties +++ b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_en_US.properties @@ -104,7 +104,35 @@ 1243013=Default notify policies not configed, please contact system administrator 1243014=Account is referenced and cannot be deleted 1243015=File size exceeds maximum {0} - +1243016=Create tag failed +1243017=Script version not online or deleted +1243018=Create job template failed +1243019=Update job template failed +1243020=Unknown error while saving job template +1243021=Tag already exist +1243022=Wrong variable type +1243023=Create job plan failed +1243024=Update job plan failed +1243025=Unknown error while saving job plan +1243026=Job template not exist +1243027=Error while creating debug plan +1243028=Sync job plan failed +1243029=Unsupported step type +1243030=Batch insert failed +1243031=Unsupported task type +1243032=Create step failed +1243033=Update step failed +1243034=Delete step failed +1243035=Update file info failed +1243036=Script version already exist +1243037=Delete failed! Plan is using by cron job(s) +1243038=Delete failed! Some plan(s) is(are) using by cron job(s) +1243039=Script version id already exist +1243040=Job template name already exist +1243041=Update template acquire lock failed! Please do not click save multiple times! +1243045=Sync script failed +1243047=Script version does not exist +1243048=Credential not exist ## Business error - job-execute 1244001=Host is empty @@ -130,10 +158,17 @@ 1244021=The number of file tasks exceeds the limit:{0} 1244022=The number of script task target servers exceeds the limit: {0} 1244023=The local file {0} not exists in backend + +## Business error - job-crontab +1245006=Cron job execution time already passed +1245007=Cron job end time or notify time already passed +1245005=Acquire lock failed while update cron job + ## Business error - job-logsvr 1246001=Failed to get execution log 1246002=Failed to save execution log 1246003=Failed to delete execution log + ## Business error (job-file-gateway) 1260001=FileSource does not exist:{0} 1260002=FileWorker response error:ListFileNode, Detail:{0} @@ -148,6 +183,7 @@ 1260012=Cannot find file source by code:{0} 1260013=File source service invalid 1260014=Cannot find file-worker by {0} + ## Business error (job-file-worker) 1262001=Third file source response error:ListBucket, Detail:{0} 1262002=Third file source response error:ListObjects, Detail:{0} @@ -158,37 +194,6 @@ ## Business error - User/Login 1247001=User does not exist or is not logged in -1243016=Create tag failed -1243017=Script version not online or deleted -1243018=Create job template failed -1243019=Update job template failed -1243020=Unknown error while saving job template -1243021=Tag already exist -1243022=Wrong variable type -1243023=Create job plan failed -1243024=Update job plan failed -1243025=Unknown error while saving job plan -1243026=Job template not exist -1243027=Error while creating debug plan -1243028=Sync job plan failed -1243029=Unsupported step type -1243030=Batch insert failed -1243031=Unsupported task type -1243032=Create step failed -1243033=Update step failed -1243034=Delete step failed -1243035=Update file info failed -1243036=Script version already exist -1243037=Delete failed! Plan is using by cron job(s) -1243038=Delete failed! Some plan(s) is(are) using by cron job(s) -1243039=Script version id already exist -1243045=Sync script failed -1243047=Script version does not exist -1243048=Credential not exist -1245006=Cron job execution time already passed -1245007=Cron job end time or notify time already passed -1245005=Acquire lock failed while update cron job -1243041=Update template acquire lock failed! Please do not click save multiple times! ## Business error - Backup 1249001=Fail to get node info from artifactory diff --git a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_zh.properties b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_zh.properties index 2f8bc9c85a..c9c3495b4f 100644 --- a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_zh.properties +++ b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_zh.properties @@ -104,6 +104,35 @@ 1243013=默认通知策略未配置,请联系管理员 1243014=账号被引用,禁止删除 1243015=文件大小超过上限{0} +1243016=创建 Tag 失败 +1243017=引用的脚本未上线或被删除 +1243018=新建模版失败 +1243019=更新模版失败 +1243020=保存模版发生未知错误 +1243021=标签已存在 +1243022=错误的变量类型 +1243023=新建执行方案失败 +1243024=更新执行方案失败 +1243025=保存执行方案发生未知错误 +1243026=模版不存在 +1243027=创建调试模版失败 +1243028=同步执行方案失败 +1243029=不支持的步骤类型 +1243030=批量操作失败 +1243031=不支持的任务类型 +1243032=新建步骤失败 +1243033=更新步骤失败 +1243034=删除步骤失败 +1243035=更新文件信息失败 +1243036=脚本版本已存在 +1243037=删除失败!存在关联的定时任务 +1243038=删除失败!执行方案存在关联的定时任务 +1243039=脚本版本Id已存在 +1243040=作业模板名称已存在 +1243041=更新模版失败!并发冲突,请不要多次点击保存 +1243045=同步脚本失败 +1243047=脚本版本不存在 +1243048=凭证不存在 ##业务错误-作业执行(job-execute) 1244001=主机为空 @@ -129,10 +158,17 @@ 1244021=文件任务数量超过限制:{0} 1244022=脚本任务目标服务器数量超过限制:{0} 1244023=本地文件{0}在后台不存在 + +## 业务错误-定时任务(job-crontab) +1245006=定时任务执行时间已失效 +1245007=定时任务结束时间或通知时间已失效 +1245005=更新定时任务获取锁失败 + ##业务错误-日志服务(job-logsvr) 1246001=获取作业执行日志失败 1246002=保存作业执行日志失败 1246003=删除作业执行日志失败 + ##业务错误-文件网关服务(job-file-gateway) 1260001=文件源不存在:{0} 1260002=接入点响应异常:ListFileNode,详情:{0} @@ -147,6 +183,7 @@ 1260012=无法根据标识{0}找到文件源 1260013=文件源服务异常 1260014=通过[{0}]找不到file-worker + ##业务错误-文件Worker服务(job-file-worker) 1262001=第三方文件源响应异常:ListBucket,详情:{0} 1262002=第三方文件源响应异常:ListObjects,详情:{0} @@ -157,37 +194,8 @@ ##业务错误-用户服务、登录服务 1247001=用户不存在或者未登录 -1243016=创建 Tag 失败 -1243017=引用的脚本未上线或被删除 -1243018=新建模版失败 -1243019=更新模版失败 -1243020=保存模版发生未知错误 -1243021=标签已存在 -1243022=错误的变量类型 -1243023=新建执行方案失败 -1243024=更新执行方案失败 -1243025=保存执行方案发生未知错误 -1243026=模版不存在 -1243027=创建调试模版失败 -1243028=同步执行方案失败 -1243029=不支持的步骤类型 -1243030=批量操作失败 -1243031=不支持的任务类型 -1243032=新建步骤失败 -1243033=更新步骤失败 -1243034=删除步骤失败 -1243035=更新文件信息失败 -1243036=脚本版本已存在 -1243037=删除失败!存在关联的定时任务 -1243038=删除失败!执行方案存在关联的定时任务 -1243039=脚本版本Id已存在 -1243045=同步脚本失败 -1243047=脚本版本不存在 -1243048=凭证不存在 -1245006=定时任务执行时间已失效 -1245007=定时任务结束时间或通知时间已失效 -1245005=更新定时任务获取锁失败 -1243041=更新模版失败!并发冲突,请不要多次点击保存。 + + ##业务错误-备份服务 1249001=从制品库获取节点信息失败 diff --git a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_zh_CN.properties b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_zh_CN.properties index 2f8bc9c85a..c9c3495b4f 100644 --- a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_zh_CN.properties +++ b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_zh_CN.properties @@ -104,6 +104,35 @@ 1243013=默认通知策略未配置,请联系管理员 1243014=账号被引用,禁止删除 1243015=文件大小超过上限{0} +1243016=创建 Tag 失败 +1243017=引用的脚本未上线或被删除 +1243018=新建模版失败 +1243019=更新模版失败 +1243020=保存模版发生未知错误 +1243021=标签已存在 +1243022=错误的变量类型 +1243023=新建执行方案失败 +1243024=更新执行方案失败 +1243025=保存执行方案发生未知错误 +1243026=模版不存在 +1243027=创建调试模版失败 +1243028=同步执行方案失败 +1243029=不支持的步骤类型 +1243030=批量操作失败 +1243031=不支持的任务类型 +1243032=新建步骤失败 +1243033=更新步骤失败 +1243034=删除步骤失败 +1243035=更新文件信息失败 +1243036=脚本版本已存在 +1243037=删除失败!存在关联的定时任务 +1243038=删除失败!执行方案存在关联的定时任务 +1243039=脚本版本Id已存在 +1243040=作业模板名称已存在 +1243041=更新模版失败!并发冲突,请不要多次点击保存 +1243045=同步脚本失败 +1243047=脚本版本不存在 +1243048=凭证不存在 ##业务错误-作业执行(job-execute) 1244001=主机为空 @@ -129,10 +158,17 @@ 1244021=文件任务数量超过限制:{0} 1244022=脚本任务目标服务器数量超过限制:{0} 1244023=本地文件{0}在后台不存在 + +## 业务错误-定时任务(job-crontab) +1245006=定时任务执行时间已失效 +1245007=定时任务结束时间或通知时间已失效 +1245005=更新定时任务获取锁失败 + ##业务错误-日志服务(job-logsvr) 1246001=获取作业执行日志失败 1246002=保存作业执行日志失败 1246003=删除作业执行日志失败 + ##业务错误-文件网关服务(job-file-gateway) 1260001=文件源不存在:{0} 1260002=接入点响应异常:ListFileNode,详情:{0} @@ -147,6 +183,7 @@ 1260012=无法根据标识{0}找到文件源 1260013=文件源服务异常 1260014=通过[{0}]找不到file-worker + ##业务错误-文件Worker服务(job-file-worker) 1262001=第三方文件源响应异常:ListBucket,详情:{0} 1262002=第三方文件源响应异常:ListObjects,详情:{0} @@ -157,37 +194,8 @@ ##业务错误-用户服务、登录服务 1247001=用户不存在或者未登录 -1243016=创建 Tag 失败 -1243017=引用的脚本未上线或被删除 -1243018=新建模版失败 -1243019=更新模版失败 -1243020=保存模版发生未知错误 -1243021=标签已存在 -1243022=错误的变量类型 -1243023=新建执行方案失败 -1243024=更新执行方案失败 -1243025=保存执行方案发生未知错误 -1243026=模版不存在 -1243027=创建调试模版失败 -1243028=同步执行方案失败 -1243029=不支持的步骤类型 -1243030=批量操作失败 -1243031=不支持的任务类型 -1243032=新建步骤失败 -1243033=更新步骤失败 -1243034=删除步骤失败 -1243035=更新文件信息失败 -1243036=脚本版本已存在 -1243037=删除失败!存在关联的定时任务 -1243038=删除失败!执行方案存在关联的定时任务 -1243039=脚本版本Id已存在 -1243045=同步脚本失败 -1243047=脚本版本不存在 -1243048=凭证不存在 -1245006=定时任务执行时间已失效 -1245007=定时任务结束时间或通知时间已失效 -1245005=更新定时任务获取锁失败 -1243041=更新模版失败!并发冲突,请不要多次点击保存。 + + ##业务错误-备份服务 1249001=从制品库获取节点信息失败 diff --git a/src/backend/commons/common-utils/src/main/java/com/tencent/bk/job/common/util/FileUtil.java b/src/backend/commons/common-utils/src/main/java/com/tencent/bk/job/common/util/FileUtil.java index 9259f233bc..ca0229e851 100644 --- a/src/backend/commons/common-utils/src/main/java/com/tencent/bk/job/common/util/FileUtil.java +++ b/src/backend/commons/common-utils/src/main/java/com/tencent/bk/job/common/util/FileUtil.java @@ -77,6 +77,7 @@ public static String writeInsToFile(InputStream ins, String targetPath) throws I fos.write(content, 0, length); Thread.sleep(0); } + closeFos(fos); fis = new FileInputStream(targetPath); return DigestUtils.md5Hex(fis); } catch (FileNotFoundException e) { @@ -89,7 +90,7 @@ public static String writeInsToFile(InputStream ins, String targetPath) throws I log.info("Download interrupted, targetPath:{}", targetPath); throw e; } finally { - closeStreams(ins, fos, fis); + closeStreams(ins, fis); } } @@ -139,6 +140,8 @@ public static String writeInsToFile(InputStream ins, String targetPath, Long fil } Thread.sleep(0); } + closeFos(fos); + log.info("targetPath:{},totalLength={},fileSize={}", targetPath, totalLength, fileSize); currentSpeedWatchTime = System.currentTimeMillis(); timeDelta = currentSpeedWatchTime - lastSpeedWatchTime; long fileSizeDelta = totalLength - lastSpeedWatchFileSize; @@ -158,13 +161,23 @@ public static String writeInsToFile(InputStream ins, String targetPath, Long fil log.info("Download interrupted, targetPath:{}", targetPath); throw e; } finally { - closeStreams(ins, fos, fis); + closeStreams(ins, fis); + } + } + + private static void closeFos(FileOutputStream fos) { + if (fos != null) { + try { + fos.flush(); + fos.close(); + } catch (IOException e) { + log.error("Fail to close fos", e); + } } } private static void closeStreams( InputStream ins, - FileOutputStream fos, FileInputStream fis ) { if (fis != null) { @@ -181,14 +194,6 @@ private static void closeStreams( log.error("Fail to close ins", e); } } - if (fos != null) { - try { - fos.flush(); - fos.close(); - } catch (IOException e) { - log.error("Fail to close fos", e); - } - } } /** diff --git a/src/backend/job-backup/service-job-backup/src/main/java/com/tencent/bk/job/backup/api/web/impl/WebBackupResourceImpl.java b/src/backend/job-backup/service-job-backup/src/main/java/com/tencent/bk/job/backup/api/web/impl/WebBackupResourceImpl.java index c22498606e..8a64d14124 100644 --- a/src/backend/job-backup/service-job-backup/src/main/java/com/tencent/bk/job/backup/api/web/impl/WebBackupResourceImpl.java +++ b/src/backend/job-backup/service-job-backup/src/main/java/com/tencent/bk/job/backup/api/web/impl/WebBackupResourceImpl.java @@ -184,11 +184,12 @@ private Pair getFileSizeAndStreamFromArtifactory(St throw new InternalException(ErrorCode.FAIL_TO_GET_NODE_INFO_FROM_ARTIFACTORY); } try { - ins = artifactoryClient.getFileInputStream( + Pair pair = artifactoryClient.getFileInputStream( artifactoryConfig.getArtifactoryJobProject(), backupStorageConfig.getBackupRepo(), fileName ); + ins = pair.getLeft(); } catch (Exception e) { throw new InternalException(ErrorCode.FAIL_TO_DOWNLOAD_NODE_FROM_ARTIFACTORY); } diff --git a/src/backend/job-backup/service-job-backup/src/main/java/com/tencent/bk/job/backup/executor/ImportJobExecutor.java b/src/backend/job-backup/service-job-backup/src/main/java/com/tencent/bk/job/backup/executor/ImportJobExecutor.java index 7d66dfa0c8..d48538ef83 100644 --- a/src/backend/job-backup/service-job-backup/src/main/java/com/tencent/bk/job/backup/executor/ImportJobExecutor.java +++ b/src/backend/job-backup/service-job-backup/src/main/java/com/tencent/bk/job/backup/executor/ImportJobExecutor.java @@ -72,6 +72,7 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.tuple.Pair; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Service; @@ -201,11 +202,12 @@ private void processImportJob(String jobId) { // 下载文件 if (!importFileDirectory.exists()) { log.debug("begin to download from artifactory:{}", importJob.getFileName()); - InputStream ins = artifactoryClient.getFileInputStream( + Pair pair = artifactoryClient.getFileInputStream( artifactoryConfig.getArtifactoryJobProject(), backupStorageConfig.getBackupRepo(), importJob.getFileName() ); + InputStream ins = pair.getLeft(); String localPath = PathUtil.joinFilePath( storageService.getStoragePath(), importJob.getFileName() diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/web/impl/WebTaskLogResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/web/impl/WebTaskLogResourceImpl.java index ef1176d897..f9f4dd7da3 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/web/impl/WebTaskLogResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/web/impl/WebTaskLogResourceImpl.java @@ -218,11 +218,12 @@ private Pair getFileSizeAndStreamFromArtifactory( } try { log.debug("get {} fileInputStream from artifactory", exportInfo.getZipFileName()); - ins = artifactoryClient.getFileInputStream( + Pair pair = artifactoryClient.getFileInputStream( artifactoryConfig.getArtifactoryJobProject(), logExportConfig.getLogExportRepo(), exportInfo.getZipFileName() ); + ins = pair.getLeft(); } catch (Exception e) { throw new InternalException(ErrorCode.FAIL_TO_DOWNLOAD_NODE_FROM_ARTIFACTORY); } diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/engine/prepare/local/ArtifactoryLocalFilePrepareTask.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/engine/prepare/local/ArtifactoryLocalFilePrepareTask.java index c2020275f0..8572f5a904 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/engine/prepare/local/ArtifactoryLocalFilePrepareTask.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/engine/prepare/local/ArtifactoryLocalFilePrepareTask.java @@ -37,6 +37,7 @@ import com.tencent.bk.job.logsvr.model.service.ServiceIpLogDTO; import com.tencent.bk.job.manage.common.consts.task.TaskFileTypeEnum; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.tuple.Pair; import java.io.File; import java.io.InputStream; @@ -217,13 +218,22 @@ public Void call() throws Exception { // 制品库的完整路径 String fullFilePath = PathUtil.joinFilePath(jobLocalUploadRootPath, filePath); NodeDTO nodeDTO = artifactoryClient.getFileNode(fullFilePath); - InputStream ins = artifactoryClient.getFileInputStream(fullFilePath); + Pair pair = artifactoryClient.getFileInputStream(fullFilePath); + InputStream ins = pair.getLeft(); + Long length = pair.getRight(); + Long fileSize = nodeDTO.getSize(); + if (fileSize != null && !fileSize.equals(length)) { + log.warn("{},ins length={},node.size={}", filePath, length, nodeDTO.getSize()); + } + if (fileSize == null || fileSize <= 0) { + fileSize = length; + } // 保存到本地临时目录 AtomicInteger speed = new AtomicInteger(0); AtomicInteger process = new AtomicInteger(0); try { log.debug("Download {} to {}", fullFilePath, localPath); - FileUtil.writeInsToFile(ins, localPath, nodeDTO.getSize(), speed, process); + FileUtil.writeInsToFile(ins, localPath, fileSize, speed, process); } catch (InterruptedException e) { log.warn("Interrupted:Download {} to {}", fullFilePath, localPath); } catch (Exception e) { diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/service/impl/TaskExecuteServiceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/service/impl/TaskExecuteServiceImpl.java index e724ed15d7..747a134693 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/service/impl/TaskExecuteServiceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/service/impl/TaskExecuteServiceImpl.java @@ -59,6 +59,7 @@ import com.tencent.bk.job.execute.constants.UserOperationEnum; import com.tencent.bk.job.execute.engine.TaskExecuteControlMsgSender; import com.tencent.bk.job.execute.engine.model.TaskVariableDTO; +import com.tencent.bk.job.execute.engine.util.TimeoutUtils; import com.tencent.bk.job.execute.model.AccountDTO; import com.tencent.bk.job.execute.model.DynamicServerGroupDTO; import com.tencent.bk.job.execute.model.DynamicServerTopoNodeDTO; @@ -220,6 +221,7 @@ public Long createTaskInstanceFast(TaskInstanceDTO taskInstance, taskInstance, stepInstance); StopWatch watch = new StopWatch("createTaskInstanceFast"); standardizeStepDynamicGroupId(Collections.singletonList(stepInstance)); + adjustStepTimeout(stepInstance); try { // 设置脚本信息 watch.start("checkAndSetScriptInfoIfScriptTask"); @@ -271,7 +273,15 @@ public Long createTaskInstanceFast(TaskInstanceDTO taskInstance, log.warn("CreateTaskInstanceFast is slow, statistics: {}", watch.prettyPrint()); } } + } + /** + * 调整任务超时时间 + * + * @param stepInstance 步骤 + */ + private void adjustStepTimeout(StepInstanceDTO stepInstance) { + stepInstance.setTimeout(TimeoutUtils.adjustTaskTimeout(stepInstance.getTimeout())); } private void checkAndSetAccountInfo(StepInstanceDTO stepInstance, @@ -920,6 +930,9 @@ public TaskInstanceDTO createTaskInstanceForTask(TaskExecuteParam executeParam) Map finalVariableValueMap = taskInfo.getVariables(); ServiceTaskPlanDTO jobPlan = taskInfo.getJobPlan(); + // 调整超时时间 + stepInstanceList.forEach(this::adjustStepTimeout); + // 检查高危脚本 watch.start("checkDangerousScript"); batchCheckScriptMatchDangerousRule(taskInstance, stepInstanceList); diff --git a/src/backend/job-file-worker-sdk/service-job-file-worker-sdk/src/main/java/com/tencent/bk/job/file/worker/cos/service/DownloadFileTask.java b/src/backend/job-file-worker-sdk/service-job-file-worker-sdk/src/main/java/com/tencent/bk/job/file/worker/cos/service/DownloadFileTask.java index 7baee5a982..b04cef08f4 100644 --- a/src/backend/job-file-worker-sdk/service-job-file-worker-sdk/src/main/java/com/tencent/bk/job/file/worker/cos/service/DownloadFileTask.java +++ b/src/backend/job-file-worker-sdk/service-job-file-worker-sdk/src/main/java/com/tencent/bk/job/file/worker/cos/service/DownloadFileTask.java @@ -32,6 +32,7 @@ import com.tencent.bk.job.file.worker.model.FileMetaData; import com.tencent.bk.job.file_gateway.consts.TaskCommandEnum; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.tuple.Pair; import java.io.File; import java.io.IOException; @@ -53,6 +54,7 @@ class DownloadFileTask extends Thread { TaskReporter taskReporter; DownloadFileTaskEventListener taskEventListener; FileProgressWatchingTask watchingTask; + public DownloadFileTask(RemoteClient remoteClient, String taskId, String filePath, String downloadFileDir, String filePrefix, AtomicLong fileSize, AtomicInteger speed, AtomicInteger process, FileProgressWatchingTask watchingTask, @@ -100,7 +102,12 @@ public void downloadFileToLocal( long fileSize = metaData.getSize(); fileMd5 = metaData.getMd5(); fileSizeWrapper.set(fileSize); - ins = remoteClient.getFileInputStream(filePath); + Pair pair = remoteClient.getFileInputStream(filePath); + ins = pair.getLeft(); + Long length = pair.getRight(); + if (length != null && length != fileSize) { + log.warn("{},fileSize={},ins length={}", filePath, fileSize, length); + } currentMd5 = FileUtil.writeInsToFile(ins, targetPath, fileSize, speed, process); if (fileMd5 == null) { log.warn("No Md5 in metadata, do not check,key={},targetPath={},fileMd5={},currentMd5={}", diff --git a/src/backend/job-file-worker-sdk/service-job-file-worker-sdk/src/main/java/com/tencent/bk/job/file/worker/cos/service/RemoteClient.java b/src/backend/job-file-worker-sdk/service-job-file-worker-sdk/src/main/java/com/tencent/bk/job/file/worker/cos/service/RemoteClient.java index 1d9f650eb1..99e1d7d24c 100644 --- a/src/backend/job-file-worker-sdk/service-job-file-worker-sdk/src/main/java/com/tencent/bk/job/file/worker/cos/service/RemoteClient.java +++ b/src/backend/job-file-worker-sdk/service-job-file-worker-sdk/src/main/java/com/tencent/bk/job/file/worker/cos/service/RemoteClient.java @@ -26,6 +26,7 @@ import com.tencent.bk.job.common.exception.ServiceException; import com.tencent.bk.job.file.worker.model.FileMetaData; +import org.apache.commons.lang3.tuple.Pair; import java.io.InputStream; @@ -33,7 +34,7 @@ public interface RemoteClient { FileMetaData getFileMetaData(String filePath); - InputStream getFileInputStream(String filePath) throws ServiceException; + Pair getFileInputStream(String filePath) throws ServiceException; void shutdown(); diff --git a/src/backend/job-file-worker/service-job-file-worker/src/main/java/com/tencent/bk/job/file/worker/artifactory/service/ArtifactoryRemoteClient.java b/src/backend/job-file-worker/service-job-file-worker/src/main/java/com/tencent/bk/job/file/worker/artifactory/service/ArtifactoryRemoteClient.java index d530942e71..ba35eb0ad2 100644 --- a/src/backend/job-file-worker/service-job-file-worker/src/main/java/com/tencent/bk/job/file/worker/artifactory/service/ArtifactoryRemoteClient.java +++ b/src/backend/job-file-worker/service-job-file-worker/src/main/java/com/tencent/bk/job/file/worker/artifactory/service/ArtifactoryRemoteClient.java @@ -31,6 +31,7 @@ import com.tencent.bk.job.file.worker.model.FileMetaData; import io.micrometer.core.instrument.MeterRegistry; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.tuple.Pair; import java.io.InputStream; @@ -48,7 +49,7 @@ public FileMetaData getFileMetaData(String filePath) { } @Override - public InputStream getFileInputStream(String filePath) throws ServiceException { + public Pair getFileInputStream(String filePath) throws ServiceException { return super.getFileInputStream(filePath); } diff --git a/src/backend/job-file-worker/service-job-file-worker/src/main/java/com/tencent/bk/job/file/worker/cos/JobTencentInnerCOSClient.java b/src/backend/job-file-worker/service-job-file-worker/src/main/java/com/tencent/bk/job/file/worker/cos/JobTencentInnerCOSClient.java index a80b326bff..4395677e45 100644 --- a/src/backend/job-file-worker/service-job-file-worker/src/main/java/com/tencent/bk/job/file/worker/cos/JobTencentInnerCOSClient.java +++ b/src/backend/job-file-worker/service-job-file-worker/src/main/java/com/tencent/bk/job/file/worker/cos/JobTencentInnerCOSClient.java @@ -28,6 +28,7 @@ import com.tencent.cos.model.Bucket; import com.tencent.cos.model.COSObjectSummary; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.tuple.Pair; import java.io.File; import java.io.InputStream; @@ -105,7 +106,7 @@ public FileMetaData getFileMetaData(String bucketName, String key) { key); } - public InputStream getFileInputStream(String bucketName, String key) { + public Pair getFileInputStream(String bucketName, String key) { return TencentInnerCOSUtil.getFileInputStream(accessKey, secretKey, regionName, getRealBucketName(bucketName) , key); } diff --git a/src/backend/job-file-worker/service-job-file-worker/src/main/java/com/tencent/bk/job/file/worker/cos/TencentInnerCOSUtil.java b/src/backend/job-file-worker/service-job-file-worker/src/main/java/com/tencent/bk/job/file/worker/cos/TencentInnerCOSUtil.java index 9afcfcc6d1..170527fb59 100644 --- a/src/backend/job-file-worker/service-job-file-worker/src/main/java/com/tencent/bk/job/file/worker/cos/TencentInnerCOSUtil.java +++ b/src/backend/job-file-worker/service-job-file-worker/src/main/java/com/tencent/bk/job/file/worker/cos/TencentInnerCOSUtil.java @@ -44,6 +44,7 @@ import com.tencent.cos.region.Region; import com.tencent.cos.utils.DateUtils; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.tuple.Pair; import java.io.BufferedOutputStream; import java.io.File; @@ -136,15 +137,15 @@ public static List listAllObjects( } } - public static InputStream getFileInputStream(String accessKey, String secretKey, String regionName, - String bucketName, String key) { + public static Pair getFileInputStream(String accessKey, String secretKey, String regionName, + String bucketName, String key) { COSClient cosClient = getCOSClient(accessKey, secretKey, regionName); COSObject cosObject = cosClient.getObject(bucketName, key); if (cosObject == null) { throw new InternalException(ErrorCode.FAIL_TO_REQUEST_THIRD_FILE_SOURCE_DOWNLOAD_GENERIC_FILE, new String[]{String.format("Fail to getObject by bucketName %s key %s", bucketName, key)}); } - return cosObject.getObjectContent(); + return Pair.of(cosObject.getObjectContent(), cosObject.getObjectMetadata().getContentLength()); } public static FileMetaData getFileMetaData(String accessKey, String secretKey, String regionName, diff --git a/src/backend/job-file-worker/service-job-file-worker/src/main/java/com/tencent/bk/job/file/worker/cos/service/COSRemoteClient.java b/src/backend/job-file-worker/service-job-file-worker/src/main/java/com/tencent/bk/job/file/worker/cos/service/COSRemoteClient.java index e903a9e57f..ecc7503846 100644 --- a/src/backend/job-file-worker/service-job-file-worker/src/main/java/com/tencent/bk/job/file/worker/cos/service/COSRemoteClient.java +++ b/src/backend/job-file-worker/service-job-file-worker/src/main/java/com/tencent/bk/job/file/worker/cos/service/COSRemoteClient.java @@ -26,6 +26,7 @@ import com.tencent.bk.job.file.worker.cos.JobTencentInnerCOSClient; import com.tencent.bk.job.file.worker.model.FileMetaData; +import org.apache.commons.lang3.tuple.Pair; import java.io.InputStream; import java.util.ArrayList; @@ -56,7 +57,7 @@ public FileMetaData getFileMetaData(String filePath) { } @Override - public InputStream getFileInputStream(String filePath) { + public Pair getFileInputStream(String filePath) { List pathList = parsePath(filePath); return jobTencentInnerCOSClient.getFileInputStream(pathList.get(0), pathList.get(1)); } diff --git a/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message.properties b/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message.properties index a384b0e173..f76bb84e88 100644 --- a/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message.properties +++ b/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message.properties @@ -85,8 +85,8 @@ job.manage.globalsettings.defaultNameRules.description.database=由1~16个大小 job.manage.globalsettings.defaultTitleHead=作业平台 job.manage.globalsettings.contactBKHelper=联系BK助手 job.manage.globalsettings.BKDesktop=蓝鲸桌面 -job.manage.globalsettings.ee.footerLink=[QQ咨询(800802001)](tencent://message/?uin=800802001&site=qq&menu=yes) | [蓝鲸论坛](http://bk.tencent.com/s-mart/community) | [蓝鲸官网](http://bk.tencent.com) | [蓝鲸智云桌面]({PAAS_SERVER_URL}) -job.manage.globalsettings.ee.footerCopyRight=Copyright © 2012-2020 Tencent BlueKing. All Rights Reserved. +job.manage.globalsettings.ee.footerLink=[QQ群(495299374)](http://shang.qq.com/wpa/qunwpa?idkey=9b82d33fd1e5b405d6b920d1a4d6aa331a93e18e050addb66796e7d0db80b669) | [社区论坛](https://bk.tencent.com/s-mart/community) | [产品官网](https://bk.tencent.com/index) | [蓝鲸智云桌面]({PAAS_SERVER_URL}/desktop) | [关注我们]() +job.manage.globalsettings.ee.footerCopyRight=Copyright © 2012-{{current_year}} Tencent BlueKing. All Rights Reserved.{{current_ver}} job.custom.settings.script.template.variable.datetime.desc=当前日期时间 job.custom.settings.script.template.variable.username.desc=用户名 diff --git a/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message_en.properties b/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message_en.properties index 6f097dd48d..af142d8a20 100644 --- a/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message_en.properties +++ b/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message_en.properties @@ -85,8 +85,8 @@ job.manage.globalsettings.defaultNameRules.description.database=Composed of 1 to job.manage.globalsettings.defaultTitleHead=Job job.manage.globalsettings.contactBKHelper=Contact BK-Helper job.manage.globalsettings.BKDesktop=BlueKing Desktop -job.manage.globalsettings.ee.footerLink=[QQ(800802001)](tencent://message/?uin=800802001&site=qq&menu=yes) | [BlueKing Forum](http://bk.tencent.com/s-mart/community) | [BlueKing Official](http://bk.tencent.com) | [BlueKing Desktop]({PAAS_SERVER_URL}) -job.manage.globalsettings.ee.footerCopyRight=Copyright © 2012-2020 Tencent BlueKing. All Rights Reserved. +job.manage.globalsettings.ee.footerLink=[QQ Group(800802001)](http://shang.qq.com/wpa/qunwpa?idkey=9b82d33fd1e5b405d6b920d1a4d6aa331a93e18e050addb66796e7d0db80b669) | [Forum](https://bk.tencent.com/s-mart/community) | [Official](https://bk.tencent.com/index) | [Desktop]({PAAS_SERVER_URL}/desktop) | [Follow Us]() +job.manage.globalsettings.ee.footerCopyRight=Copyright © 2012-{{current_year}} Tencent BlueKing. All Rights Reserved.{{current_ver}} job.custom.settings.script.template.variable.datetime.desc=Current date and time job.custom.settings.script.template.variable.username.desc=Username diff --git a/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message_en_US.properties b/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message_en_US.properties index 6f097dd48d..af142d8a20 100644 --- a/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message_en_US.properties +++ b/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message_en_US.properties @@ -85,8 +85,8 @@ job.manage.globalsettings.defaultNameRules.description.database=Composed of 1 to job.manage.globalsettings.defaultTitleHead=Job job.manage.globalsettings.contactBKHelper=Contact BK-Helper job.manage.globalsettings.BKDesktop=BlueKing Desktop -job.manage.globalsettings.ee.footerLink=[QQ(800802001)](tencent://message/?uin=800802001&site=qq&menu=yes) | [BlueKing Forum](http://bk.tencent.com/s-mart/community) | [BlueKing Official](http://bk.tencent.com) | [BlueKing Desktop]({PAAS_SERVER_URL}) -job.manage.globalsettings.ee.footerCopyRight=Copyright © 2012-2020 Tencent BlueKing. All Rights Reserved. +job.manage.globalsettings.ee.footerLink=[QQ Group(800802001)](http://shang.qq.com/wpa/qunwpa?idkey=9b82d33fd1e5b405d6b920d1a4d6aa331a93e18e050addb66796e7d0db80b669) | [Forum](https://bk.tencent.com/s-mart/community) | [Official](https://bk.tencent.com/index) | [Desktop]({PAAS_SERVER_URL}/desktop) | [Follow Us]() +job.manage.globalsettings.ee.footerCopyRight=Copyright © 2012-{{current_year}} Tencent BlueKing. All Rights Reserved.{{current_ver}} job.custom.settings.script.template.variable.datetime.desc=Current date and time job.custom.settings.script.template.variable.username.desc=Username diff --git a/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message_zh.properties b/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message_zh.properties index a384b0e173..f76bb84e88 100644 --- a/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message_zh.properties +++ b/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message_zh.properties @@ -85,8 +85,8 @@ job.manage.globalsettings.defaultNameRules.description.database=由1~16个大小 job.manage.globalsettings.defaultTitleHead=作业平台 job.manage.globalsettings.contactBKHelper=联系BK助手 job.manage.globalsettings.BKDesktop=蓝鲸桌面 -job.manage.globalsettings.ee.footerLink=[QQ咨询(800802001)](tencent://message/?uin=800802001&site=qq&menu=yes) | [蓝鲸论坛](http://bk.tencent.com/s-mart/community) | [蓝鲸官网](http://bk.tencent.com) | [蓝鲸智云桌面]({PAAS_SERVER_URL}) -job.manage.globalsettings.ee.footerCopyRight=Copyright © 2012-2020 Tencent BlueKing. All Rights Reserved. +job.manage.globalsettings.ee.footerLink=[QQ群(495299374)](http://shang.qq.com/wpa/qunwpa?idkey=9b82d33fd1e5b405d6b920d1a4d6aa331a93e18e050addb66796e7d0db80b669) | [社区论坛](https://bk.tencent.com/s-mart/community) | [产品官网](https://bk.tencent.com/index) | [蓝鲸智云桌面]({PAAS_SERVER_URL}/desktop) | [关注我们]() +job.manage.globalsettings.ee.footerCopyRight=Copyright © 2012-{{current_year}} Tencent BlueKing. All Rights Reserved.{{current_ver}} job.custom.settings.script.template.variable.datetime.desc=当前日期时间 job.custom.settings.script.template.variable.username.desc=用户名 diff --git a/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message_zh_CN.properties b/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message_zh_CN.properties index a384b0e173..f76bb84e88 100644 --- a/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message_zh_CN.properties +++ b/src/backend/job-manage/boot-job-manage/src/main/resources/i18n/message_zh_CN.properties @@ -85,8 +85,8 @@ job.manage.globalsettings.defaultNameRules.description.database=由1~16个大小 job.manage.globalsettings.defaultTitleHead=作业平台 job.manage.globalsettings.contactBKHelper=联系BK助手 job.manage.globalsettings.BKDesktop=蓝鲸桌面 -job.manage.globalsettings.ee.footerLink=[QQ咨询(800802001)](tencent://message/?uin=800802001&site=qq&menu=yes) | [蓝鲸论坛](http://bk.tencent.com/s-mart/community) | [蓝鲸官网](http://bk.tencent.com) | [蓝鲸智云桌面]({PAAS_SERVER_URL}) -job.manage.globalsettings.ee.footerCopyRight=Copyright © 2012-2020 Tencent BlueKing. All Rights Reserved. +job.manage.globalsettings.ee.footerLink=[QQ群(495299374)](http://shang.qq.com/wpa/qunwpa?idkey=9b82d33fd1e5b405d6b920d1a4d6aa331a93e18e050addb66796e7d0db80b669) | [社区论坛](https://bk.tencent.com/s-mart/community) | [产品官网](https://bk.tencent.com/index) | [蓝鲸智云桌面]({PAAS_SERVER_URL}/desktop) | [关注我们]() +job.manage.globalsettings.ee.footerCopyRight=Copyright © 2012-{{current_year}} Tencent BlueKing. All Rights Reserved.{{current_ver}} job.custom.settings.script.template.variable.datetime.desc=当前日期时间 job.custom.settings.script.template.variable.username.desc=用户名 diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/GlobalSettingsServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/GlobalSettingsServiceImpl.java index 475c0d4c4f..feff804a11 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/GlobalSettingsServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/GlobalSettingsServiceImpl.java @@ -84,6 +84,7 @@ import org.jooq.DSLContext; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.info.BuildProperties; import org.springframework.stereotype.Service; import java.time.LocalDateTime; @@ -110,6 +111,8 @@ public class GlobalSettingsServiceImpl implements GlobalSettingsService { private static final Pattern PATTERN = Pattern.compile("^([+\\-]?\\d+)([a-zA-Z]{0,2})$"); + private static final String STRING_TPL_KEY_CURRENT_VERSION = "current_ver"; + private static final String STRING_TPL_KEY_CURRENT_YEAR = "current_year"; private DSLContext dslContext; private NotifyEsbChannelDAO notifyEsbChannelDAO; private AvailableEsbChannelDAO availableEsbChannelDAO; @@ -120,6 +123,7 @@ public class GlobalSettingsServiceImpl implements GlobalSettingsService { private JobManageConfig jobManageConfig; private LocalFileConfigForManage localFileConfigForManage; private NotifyTemplateConverter notifyTemplateConverter; + private BuildProperties buildProperties; @Value("${job.manage.upload.filesize.max:5GB}") private String configedMaxFileSize; @Value("${job.feature.file-manage.enabled:false}") @@ -132,8 +136,12 @@ public GlobalSettingsServiceImpl( , AvailableEsbChannelDAO availableEsbChannelDAO , NotifyService notifyService , GlobalSettingDAO globalSettingDAO - , NotifyTemplateDAO notifyTemplateDAO, MessageI18nService i18nService, JobManageConfig jobManageConfig, - LocalFileConfigForManage localFileConfigForManage, NotifyTemplateConverter notifyTemplateConverter) { + , NotifyTemplateDAO notifyTemplateDAO, + MessageI18nService i18nService, + JobManageConfig jobManageConfig, + LocalFileConfigForManage localFileConfigForManage, + NotifyTemplateConverter notifyTemplateConverter, + BuildProperties buildProperties) { this.dslContext = dslContext; this.notifyEsbChannelDAO = notifyEsbChannelDAO; this.availableEsbChannelDAO = availableEsbChannelDAO; @@ -144,6 +152,7 @@ public GlobalSettingsServiceImpl( this.jobManageConfig = jobManageConfig; this.localFileConfigForManage = localFileConfigForManage; this.notifyTemplateConverter = notifyTemplateConverter; + this.buildProperties = buildProperties; } private static String removeSuffixBackSlash(String rawStr) { @@ -246,7 +255,7 @@ public Integer setHistoryExpireTime(String username, HistoryExpireReq req) { Long days = req.getDays(); if (days == null || days <= 0) { throw new InvalidParamException(ErrorCode.ILLEGAL_PARAM_WITH_PARAM_NAME_AND_REASON, - new String[] {"days", "days must be positive"}); + new String[]{"days", "days must be positive"}); } GlobalSettingDTO globalSettingDTO = new GlobalSettingDTO(GlobalSettingKeys.KEY_HISTORY_EXPIRE_DAYS, days.toString(), String.format("执行记录保存天数(history expire days):%s,%s", username, @@ -510,7 +519,7 @@ private TitleFooterVO getEEDefaultTitleFooterVO() { ); } - private TitleFooterVO getDefaultTitleFooterVO() { + private TitleFooterVO getDefaultTitleFooterVOWithoutVersion() { String jobEdition = jobManageConfig.getJobEdition(); if (jobEdition.toLowerCase().equals("ee")) { return getEEDefaultTitleFooterVO(); @@ -534,11 +543,27 @@ private TitleFooterVO getInnerDefaultTitleFooterVO() { @Override public TitleFooterVO getTitleFooter() { + TitleFooterVO titleFooterVO = getTitleFooterWithoutVersion(); + // 渲染版本号 + Map valuesMap = new HashMap<>(); + String pattern = "(\\{\\{(.*?)\\}\\})"; + valuesMap.put(STRING_TPL_KEY_CURRENT_VERSION, "V" + buildProperties.getVersion()); + valuesMap.put(STRING_TPL_KEY_CURRENT_YEAR, DateUtils.getCurrentDateStr("yyyy")); + titleFooterVO.setFooterCopyRight( + StringUtil.replaceByRegex(titleFooterVO.getFooterCopyRight(), pattern, valuesMap) + ); + titleFooterVO.setFooterLink( + StringUtil.replaceByRegex(titleFooterVO.getFooterLink(), pattern, valuesMap) + ); + return titleFooterVO; + } + + public TitleFooterVO getTitleFooterWithoutVersion() { GlobalSettingDTO titleFooterSettingDTO = globalSettingDAO.getGlobalSetting(dslContext, GlobalSettingKeys.KEY_TITLE_FOOTER); if (titleFooterSettingDTO == null) { log.warn("Default titleFooter not configured, use system default, plz contact admin to set"); - return getDefaultTitleFooterVO(); + return getDefaultTitleFooterVOWithoutVersion(); } TitleFooterDTO titleFooterDTO = JsonUtils.fromJson(titleFooterSettingDTO.getValue(), new TypeReference() { @@ -555,20 +580,20 @@ public TitleFooterVO getTitleFooter() { titleFooter.getFooterLink(), copyRight); } else { log.warn("TitleFooter of language:{} not configured, use default:zh_CN", normalLang); - return getDefaultTitleFooterVO(); + return getDefaultTitleFooterVOWithoutVersion(); } } @Override public TitleFooterWithDefaultVO getTitleFooterWithDefault(String username) { - return new TitleFooterWithDefaultVO(getTitleFooter(), getDefaultTitleFooterVO()); + return new TitleFooterWithDefaultVO(getTitleFooterWithoutVersion(), getDefaultTitleFooterVOWithoutVersion()); } @Override public Integer saveChannelTemplate(String username, ChannelTemplateReq req) { if (StringUtils.isBlank(req.getChannelCode()) || StringUtils.isBlank(req.getMessageTypeCode())) { throw new InvalidParamException(ErrorCode.ILLEGAL_PARAM_WITH_PARAM_NAME_AND_REASON, - new String[] {"channelCode", "channelCode cannot be blank"}); + new String[]{"channelCode", "channelCode cannot be blank"}); } NotifyTemplateDTO notifyTemplateDTO = notifyTemplateDAO.getNotifyTemplate(dslContext, req.getChannelCode(), req.getMessageTypeCode(), false); diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/template/impl/TaskTemplateServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/template/impl/TaskTemplateServiceImpl.java index fe92e587d4..a6261f5ab3 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/template/impl/TaskTemplateServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/template/impl/TaskTemplateServiceImpl.java @@ -588,7 +588,7 @@ public Long saveTaskTemplateForMigration( TaskTemplateInfoDTO taskTemplateByName = taskTemplateDAO.getTaskTemplateByName(taskTemplateInfo.getAppId(), taskTemplateInfo.getName()); if (taskTemplateByName != null) { - throw new NotFoundException(ErrorCode.TEMPLATE_NAME_EXIST); + throw new AlreadyExistsException(ErrorCode.TEMPLATE_NAME_EXIST); } taskTemplateService.createNewTagForTemplateIfNotExist(taskTemplateInfo); diff --git a/src/backend/upgrader/build.gradle b/src/backend/upgrader/build.gradle index 0d0932d10a..6c6cd6b5e1 100644 --- a/src/backend/upgrader/build.gradle +++ b/src/backend/upgrader/build.gradle @@ -22,7 +22,7 @@ * IN THE SOFTWARE. */ plugins { - id "com.github.johnrengelman.shadow" version "5.1.0" + id "com.github.johnrengelman.shadow" version "7.1.1" } ext { if (System.getProperty("jobVersion")) { diff --git a/src/frontend/package.json b/src/frontend/package.json index 5c8143990a..bb20c2c9ea 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -19,7 +19,7 @@ "@vue/composition-api": "^1.0.0-beta.1", "ace-builds": "^1.4.12", "axios": "^0.24.0", - "bk-magic-vue": "2.4.0-beta.1", + "bk-magic-vue": "2.4.0", "core-js": "^3.18.1", "cron-parser-custom": "^2.13.0", "diff": "^5.0.0", diff --git a/src/frontend/src/components/choose-ip/components/render-business-topology.vue b/src/frontend/src/components/choose-ip/components/render-business-topology.vue index 68c3896a2a..00d6c40ff8 100644 --- a/src/frontend/src/components/choose-ip/components/render-business-topology.vue +++ b/src/frontend/src/components/choose-ip/components/render-business-topology.vue @@ -165,7 +165,6 @@ diff --git a/src/frontend/src/components/task-step/file/item-factory.vue b/src/frontend/src/components/task-step/file/item-factory.vue index 2d6bef18d8..177fa495b7 100644 --- a/src/frontend/src/components/task-step/file/item-factory.vue +++ b/src/frontend/src/components/task-step/file/item-factory.vue @@ -26,12 +26,16 @@ --> diff --git a/src/frontend/src/components/task-step/script/item-factory.vue b/src/frontend/src/components/task-step/script/item-factory.vue index 9ca05fd7bc..0a088946b8 100644 --- a/src/frontend/src/components/task-step/script/item-factory.vue +++ b/src/frontend/src/components/task-step/script/item-factory.vue @@ -26,17 +26,21 @@ --> diff --git a/src/frontend/src/i18n/local.js b/src/frontend/src/i18n/local.js index 28f26b3ee2..07dfcd429e 100644 --- a/src/frontend/src/i18n/local.js +++ b/src/frontend/src/i18n/local.js @@ -488,6 +488,7 @@ export default { 清空搜索条件: 'Empty it', 提交: 'Commit', '标签名已存在,请重新输入': 'Tag name is exists, please try another one', + '允许最小 1s,最大为 86400s': 'The minimum is 1s, the maximum is 86400s', 收起更多: 'Hide', 展开更多: 'More', 收起未引用的变量: 'unreferenced variables', diff --git a/src/frontend/src/views/task-manage/template-operation/index.vue b/src/frontend/src/views/task-manage/template-operation/index.vue index f73b9a3103..4038460a5e 100644 --- a/src/frontend/src/views/task-manage/template-operation/index.vue +++ b/src/frontend/src/views/task-manage/template-operation/index.vue @@ -488,9 +488,8 @@ } } this.planList = Object.freeze(planList); - const isPlanEmpty = planList.length < 1; if (this.isEdit) { - this.editSuccessCallback(taskId, planSync, isPlanEmpty); + this.editSuccessCallback(taskId, planSync); } else { this.createSuccessCallback(taskId); } @@ -590,9 +589,8 @@ * @desc 编辑作业模板成功 * @param {Number} taskId 作业模板id * @param {Boolean} planSync 执行方案是否需要同步 - * @param {Boolean} isPlanEmpty 作业模板关联的执行方案是否为空 */ - editSuccessCallback (taskId, planSync, isPlanEmpty) { + editSuccessCallback (taskId, planSync) { let confirmInfo = ''; let isClickClose = false; const handleGoTemplateDetail = () => { @@ -650,7 +648,6 @@ {I18n.t('template.查看方案')} diff --git a/support-files/kubernetes/charts/bk-job/Chart.yaml b/support-files/kubernetes/charts/bk-job/Chart.yaml index 8828bc665c..4af6d70736 100644 --- a/support-files/kubernetes/charts/bk-job/Chart.yaml +++ b/support-files/kubernetes/charts/bk-job/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: "bk-job" description: A Helm Chart for Blueking Job type: application -version: 0.1.27 -appVersion: "3.4.2-beta.6" +version: 0.1.28 +appVersion: "3.4.2-beta.7" dependencies: - name: common diff --git a/support-files/kubernetes/charts/bk-job/templates/bklog.yaml b/support-files/kubernetes/charts/bk-job/templates/bklog.yaml index 17265c9354..ad2191a846 100644 --- a/support-files/kubernetes/charts/bk-job/templates/bklog.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/bklog.yaml @@ -14,7 +14,7 @@ spec: app.kubernetes.io/name: {{ include "common.names.fullname" . }} {{ include "job.labelKeys.jobScope" . }}: {{ include "job.labelValues.jobScope.backend" . }} path: - - /data/logs/job/job-*/*.log + - /data/logs/job-*/*.log encoding: 'utf-8' multiline: pattern: '^\[(?P.*?)\]\s+?' diff --git a/support-files/kubernetes/charts/bk-job/templates/job-analysis/deployment.yaml b/support-files/kubernetes/charts/bk-job/templates/job-analysis/deployment.yaml index 0b38c78311..1c4351516f 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-analysis/deployment.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-analysis/deployment.yaml @@ -63,16 +63,14 @@ spec: image: {{ include "job-analysis.image" . }} imagePullPolicy: {{ .Values.analysisConfig.image.pullPolicy }} env: + - name: BK_JOB_APP_NAME + value: "job-analysis" - name: BK_JOB_JVM_OPTION value: {{ .Values.analysisConfig.jvmOptions | quote }} - name: BK_JOB_PROFILE value: {{ include "job.profile" . }} - name: BK_JOB_JAR value: job-analysis.jar - - name: BK_JOB_LOG_BASE_DIR - value: /data/logs/job - - name: BK_JOB_LOG_DIR - value: /data/logs/job/job-analysis - name: JOB_APPLICATION_CONFIGMAP_NAME value: {{ include "common.names.fullname" . }}-analysis - name: JOB_COMMON_CONFIGMAP_NAME @@ -83,6 +81,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + - name: BK_JOB_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name ports: - name: http containerPort: {{ .Values.analysisConfig.containerPort }} @@ -108,6 +110,8 @@ spec: resources: {{- toYaml .Values.analysisConfig.resources | nindent 12 }} volumeMounts: + - name: job-storage + mountPath: /data/job/storage - name: mariadb mountPath: /etc/secrets/mariadb readOnly: true @@ -118,6 +122,9 @@ spec: mountPath: /etc/secrets/redis readOnly: true volumes: + - name: job-storage + persistentVolumeClaim: + claimName: {{ include "common.names.fullname" . }}-pv-claim - name: mariadb secret: secretName: {{ include "job.mariadb.secretName" . }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-backup/deployment.yaml b/support-files/kubernetes/charts/bk-job/templates/job-backup/deployment.yaml index b89fb14a2e..2917cdbe06 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-backup/deployment.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-backup/deployment.yaml @@ -63,16 +63,14 @@ spec: image: {{ include "job-backup.image" . }} imagePullPolicy: {{ .Values.backupConfig.image.pullPolicy }} env: + - name: BK_JOB_APP_NAME + value: "job-backup" - name: BK_JOB_JVM_OPTION value: {{ .Values.backupConfig.jvmOptions | quote }} - name: BK_JOB_PROFILE value: {{ include "job.profile" . }} - name: BK_JOB_JAR value: job-backup.jar - - name: BK_JOB_LOG_BASE_DIR - value: /data/logs/job - - name: BK_JOB_LOG_DIR - value: /data/logs/job/job-backup - name: JOB_APPLICATION_CONFIGMAP_NAME value: {{ include "common.names.fullname" . }}-backup - name: JOB_COMMON_CONFIGMAP_NAME @@ -83,6 +81,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + - name: BK_JOB_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name ports: - name: http containerPort: {{ .Values.backupConfig.containerPort }} @@ -108,6 +110,8 @@ spec: resources: {{- toYaml .Values.backupConfig.resources | nindent 12 }} volumeMounts: + - name: job-storage + mountPath: /data/job/storage - name: mariadb mountPath: /etc/secrets/mariadb readOnly: true @@ -118,6 +122,9 @@ spec: mountPath: /etc/secrets/redis readOnly: true volumes: + - name: job-storage + persistentVolumeClaim: + claimName: {{ include "common.names.fullname" . }}-pv-claim - name: mariadb secret: secretName: {{ include "job.mariadb.secretName" . }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-crontab/deployment.yaml b/support-files/kubernetes/charts/bk-job/templates/job-crontab/deployment.yaml index 3704a5f6cc..64a3eba512 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-crontab/deployment.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-crontab/deployment.yaml @@ -64,16 +64,14 @@ spec: image: {{ include "job-crontab.image" . }} imagePullPolicy: {{ .Values.crontabConfig.image.pullPolicy }} env: + - name: BK_JOB_APP_NAME + value: "job-crontab" - name: BK_JOB_JVM_OPTION value: {{ .Values.crontabConfig.jvmOptions | quote }} - name: BK_JOB_PROFILE value: {{ include "job.profile" . }} - name: BK_JOB_JAR value: job-crontab.jar - - name: BK_JOB_LOG_BASE_DIR - value: /data/logs/job - - name: BK_JOB_LOG_DIR - value: /data/logs/job/job-crontab - name: JOB_APPLICATION_CONFIGMAP_NAME value: {{ include "common.names.fullname" . }}-crontab - name: JOB_COMMON_CONFIGMAP_NAME @@ -84,6 +82,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + - name: BK_JOB_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name ports: - name: http containerPort: {{ .Values.crontabConfig.containerPort }} @@ -109,6 +111,8 @@ spec: resources: {{- toYaml .Values.crontabConfig.resources | nindent 12 }} volumeMounts: + - name: job-storage + mountPath: /data/job/storage - name: mariadb mountPath: /etc/secrets/mariadb readOnly: true @@ -119,6 +123,9 @@ spec: mountPath: /etc/secrets/redis readOnly: true volumes: + - name: job-storage + persistentVolumeClaim: + claimName: {{ include "common.names.fullname" . }}-pv-claim - name: mariadb secret: secretName: {{ include "job.mariadb.secretName" . }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-execute/deployment.yaml b/support-files/kubernetes/charts/bk-job/templates/job-execute/deployment.yaml index 9b36a2da42..705ad1e6d9 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-execute/deployment.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-execute/deployment.yaml @@ -63,6 +63,8 @@ spec: image: {{ include "job-execute.image" . }} imagePullPolicy: {{ .Values.executeConfig.image.pullPolicy }} env: + - name: BK_JOB_APP_NAME + value: "job-execute" - name: BK_JOB_JVM_OPTION value: {{ .Values.executeConfig.jvmOptions | quote }} - name: BK_JOB_PROFILE @@ -73,10 +75,6 @@ spec: valueFrom: fieldRef: fieldPath: status.hostIP - - name: BK_JOB_LOG_BASE_DIR - value: /data/logs/job - - name: BK_JOB_LOG_DIR - value: /data/logs/job/job-execute - name: BK_JOB_STORAGE_ROOT_PATH value: {{ .Values.job.storage.rootPath }} - name: JOB_APPLICATION_CONFIGMAP_NAME @@ -89,6 +87,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + - name: BK_JOB_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name ports: - name: http containerPort: {{ .Values.executeConfig.containerPort }} @@ -114,6 +116,8 @@ spec: resources: {{- toYaml .Values.executeConfig.resources | nindent 12 }} volumeMounts: + - name: job-storage + mountPath: /data/job/storage - name: local-file-dir mountPath: {{ .Values.job.storage.rootPath }} - name: mariadb @@ -132,6 +136,9 @@ spec: mountPath: /etc/secrets readOnly: true volumes: + - name: job-storage + persistentVolumeClaim: + claimName: {{ include "common.names.fullname" . }}-pv-claim - name: local-file-dir hostPath: path: {{ .Values.job.storage.rootPath }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-file-gateway/deployment.yaml b/support-files/kubernetes/charts/bk-job/templates/job-file-gateway/deployment.yaml index f1abfd8a6f..ed4e983874 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-file-gateway/deployment.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-file-gateway/deployment.yaml @@ -63,16 +63,14 @@ spec: image: {{ include "job-file-gateway.image" . }} imagePullPolicy: {{ .Values.fileGatewayConfig.image.pullPolicy }} env: + - name: BK_JOB_APP_NAME + value: "job-file-gateway" - name: BK_JOB_JVM_OPTION value: {{ .Values.fileGatewayConfig.jvmOptions | quote }} - name: BK_JOB_PROFILE value: {{ include "job.profile" . }} - name: BK_JOB_JAR value: job-file-gateway.jar - - name: BK_JOB_LOG_BASE_DIR - value: /data/logs/job - - name: BK_JOB_LOG_DIR - value: /data/logs/job/job-file-gateway - name: JOB_APPLICATION_CONFIGMAP_NAME value: {{ include "common.names.fullname" . }}-file-gateway - name: JOB_COMMON_CONFIGMAP_NAME @@ -83,6 +81,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + - name: BK_JOB_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name ports: - name: http containerPort: {{ .Values.fileGatewayConfig.containerPort }} @@ -108,6 +110,8 @@ spec: resources: {{- toYaml .Values.fileGatewayConfig.resources | nindent 12 }} volumeMounts: + - name: job-storage + mountPath: /data/job/storage - name: mariadb mountPath: /etc/secrets/mariadb readOnly: true @@ -118,6 +122,9 @@ spec: mountPath: /etc/secrets/redis readOnly: true volumes: + - name: job-storage + persistentVolumeClaim: + claimName: {{ include "common.names.fullname" . }}-pv-claim - name: mariadb secret: secretName: {{ include "job.mariadb.secretName" . }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-file-worker/statefulset.yaml b/support-files/kubernetes/charts/bk-job/templates/job-file-worker/statefulset.yaml index f284962d4b..23ed28db7f 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-file-worker/statefulset.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-file-worker/statefulset.yaml @@ -62,16 +62,14 @@ spec: image: {{ include "job-file-worker.image" . }} imagePullPolicy: {{ .Values.fileWorkerConfig.image.pullPolicy }} env: + - name: BK_JOB_APP_NAME + value: "job-file-worker" - name: BK_JOB_JVM_OPTION value: {{ .Values.fileWorkerConfig.jvmOptions | quote }} - name: BK_JOB_PROFILE value: {{ include "job.profile" . }} - name: BK_JOB_JAR value: job-file-worker.jar - - name: BK_JOB_LOG_BASE_DIR - value: /data/logs/job - - name: BK_JOB_LOG_DIR - value: /data/logs/job/job-file-worker - name: BK_JOB_FILE_WORKER_WORKSPACE_DIR value: {{ .Values.fileWorkerConfig.downloadFile.dir }}/JobFileWorkerWorkspace - name: BK_JOB_NODE_IP @@ -94,6 +92,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + - name: BK_JOB_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name ports: - name: http containerPort: {{ .Values.fileWorkerConfig.containerPort }} @@ -119,9 +121,14 @@ spec: resources: {{- toYaml .Values.fileWorkerConfig.resources | nindent 12 }} volumeMounts: + - name: job-storage + mountPath: /data/job/storage - name: workspace mountPath: {{ .Values.fileWorkerConfig.downloadFile.dir }}/JobFileWorkerWorkspace volumes: + - name: job-storage + persistentVolumeClaim: + claimName: {{ include "common.names.fullname" . }}-pv-claim - name: workspace hostPath: path: {{ .Values.fileWorkerConfig.downloadFile.dir }}/JobFileWorkerWorkspace diff --git a/support-files/kubernetes/charts/bk-job/templates/job-gateway/deployment.yaml b/support-files/kubernetes/charts/bk-job/templates/job-gateway/deployment.yaml index 2517face0b..e19a7bf9cb 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-gateway/deployment.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-gateway/deployment.yaml @@ -61,16 +61,14 @@ spec: image: {{ include "job-gateway.image" . }} imagePullPolicy: {{ .Values.gatewayConfig.image.pullPolicy }} env: + - name: BK_JOB_APP_NAME + value: "job-gateway" - name: BK_JOB_JVM_OPTION value: {{ .Values.gatewayConfig.jvmOptions | quote }} - name: BK_JOB_PROFILE value: {{ include "job.profile" . }} - name: BK_JOB_JAR value: job-gateway.jar - - name: BK_JOB_LOG_BASE_DIR - value: /data/logs/job - - name: BK_JOB_LOG_DIR - value: /data/logs/job/job-gateway - name: JOB_APPLICATION_CONFIGMAP_NAME value: {{ include "common.names.fullname" . }}-gateway - name: JOB_COMMON_CONFIGMAP_NAME @@ -81,6 +79,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + - name: BK_JOB_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name ports: - name: http containerPort: {{ .Values.gatewayConfig.containerPort.http }} @@ -112,6 +114,8 @@ spec: resources: {{- toYaml .Values.gatewayConfig.resources | nindent 12 }} volumeMounts: + - name: job-storage + mountPath: /data/job/storage - name: job-gateway-tls-certs mountPath: /data/job/cert readOnly: true @@ -119,6 +123,9 @@ spec: mountPath: /etc/secrets readOnly: true volumes: + - name: job-storage + persistentVolumeClaim: + claimName: {{ include "common.names.fullname" . }}-pv-claim - name: job-gateway-tls-certs secret: secretName: {{ printf "%s-gateway-%s" (include "common.names.fullname" .) "tls-cert" }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-logsvr/deployment.yaml b/support-files/kubernetes/charts/bk-job/templates/job-logsvr/deployment.yaml index dd181edb78..9ab4b5498d 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-logsvr/deployment.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-logsvr/deployment.yaml @@ -61,16 +61,14 @@ spec: image: {{ include "job-logsvr.image" . }} imagePullPolicy: {{ .Values.logsvrConfig.image.pullPolicy }} env: + - name: BK_JOB_APP_NAME + value: "job-logsvr" - name: BK_JOB_JVM_OPTION value: {{ .Values.logsvrConfig.jvmOptions | quote }} - name: BK_JOB_PROFILE value: {{ include "job.profile" . }} - name: BK_JOB_JAR value: job-logsvr.jar - - name: BK_JOB_LOG_BASE_DIR - value: /data/logs/job - - name: BK_JOB_LOG_DIR - value: /data/logs/job/job-logsvr - name: JOB_APPLICATION_CONFIGMAP_NAME value: {{ include "common.names.fullname" . }}-logsvr - name: JOB_COMMON_CONFIGMAP_NAME @@ -81,6 +79,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + - name: BK_JOB_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name ports: - name: http containerPort: {{ .Values.logsvrConfig.containerPort }} @@ -106,10 +108,15 @@ spec: resources: {{- toYaml .Values.logsvrConfig.resources | nindent 12 }} volumeMounts: + - name: job-storage + mountPath: /data/job/storage - name: mongodb mountPath: /etc/secrets/mongodb readOnly: true volumes: + - name: job-storage + persistentVolumeClaim: + claimName: {{ include "common.names.fullname" . }}-pv-claim - name: mongodb secret: secretName: {{ include "job.mongodb.secretName" . }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-manage/deployment.yaml b/support-files/kubernetes/charts/bk-job/templates/job-manage/deployment.yaml index 52ff545c85..2254090f47 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-manage/deployment.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-manage/deployment.yaml @@ -63,6 +63,8 @@ spec: image: {{ include "job-manage.image" . }} imagePullPolicy: {{ .Values.manageConfig.image.pullPolicy }} env: + - name: BK_JOB_APP_NAME + value: "job-manage" - name: BK_JOB_EDITION value: {{ .Values.job.edition }} - name: BK_JOB_JVM_OPTION @@ -71,10 +73,6 @@ spec: value: {{ include "job.profile" . }} - name: BK_JOB_JAR value: job-manage.jar - - name: BK_JOB_LOG_BASE_DIR - value: "/data/logs/job" - - name: BK_JOB_LOG_DIR - value: "/data/logs/job/job-manage" - name: JOB_APPLICATION_CONFIGMAP_NAME value: {{ include "common.names.fullname" . }}-manage - name: JOB_COMMON_CONFIGMAP_NAME @@ -85,6 +83,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + - name: BK_JOB_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name ports: - name: http containerPort: {{ .Values.manageConfig.containerPort }} @@ -110,6 +112,8 @@ spec: resources: {{- toYaml .Values.manageConfig.resources | nindent 12 }} volumeMounts: + - name: job-storage + mountPath: /data/job/storage - name: mariadb mountPath: /etc/secrets/mariadb readOnly: true @@ -126,6 +130,9 @@ spec: mountPath: /etc/secrets readOnly: true volumes: + - name: job-storage + persistentVolumeClaim: + claimName: {{ include "common.names.fullname" . }}-pv-claim - name: mariadb secret: secretName: {{ include "job.mariadb.secretName" . }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-migration/job.yaml b/support-files/kubernetes/charts/bk-job/templates/job-migration/job.yaml index 961b4cc86c..5fa4bc323e 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-migration/job.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-migration/job.yaml @@ -33,7 +33,7 @@ spec: image: {{ include "job-migration.image" . }} imagePullPolicy: {{ .Values.migration.image.pullPolicy }} command: ["bash"] - args: ["/data/job/startup.sh"] + args: ["/data/job/exec/startup.sh"] env: - name: BK_JOB_MYSQL_HOST value: {{ include "job.mariadb.host" . | quote }} diff --git a/support-files/kubernetes/charts/bk-job/templates/pv-default.yaml b/support-files/kubernetes/charts/bk-job/templates/pv-default.yaml new file mode 100644 index 0000000000..7c17ee42b9 --- /dev/null +++ b/support-files/kubernetes/charts/bk-job/templates/pv-default.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: {{ include "common.names.fullname" . }}-local + labels: + {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + type: local + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + storageClassName: manual + capacity: + storage: {{ .Values.job.pv.storage }} + accessModes: + - ReadWriteMany + hostPath: + path: {{ .Values.job.pv.path }} diff --git a/support-files/kubernetes/charts/bk-job/templates/pvc-storage.yaml b/support-files/kubernetes/charts/bk-job/templates/pvc-storage.yaml new file mode 100644 index 0000000000..8c36b8aba6 --- /dev/null +++ b/support-files/kubernetes/charts/bk-job/templates/pvc-storage.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "common.names.fullname" . }}-pv-claim + labels: + {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + storageClassName: manual + accessModes: + - ReadWriteMany + resources: + requests: + storage: {{ .Values.job.pv.storage }} diff --git a/support-files/kubernetes/charts/bk-job/values.yaml b/support-files/kubernetes/charts/bk-job/values.yaml index 452984105e..bea5180c38 100644 --- a/support-files/kubernetes/charts/bk-job/values.yaml +++ b/support-files/kubernetes/charts/bk-job/values.yaml @@ -491,6 +491,10 @@ job: enabled: true # 各微服务Actuator监控端口 managePort: 19876 + # 存储分配 + pv: + path: "/data/bkjob" + storage: 100Gi ## @section job-gateway parameters gatewayConfig: @@ -500,7 +504,7 @@ gatewayConfig: image: registry: mirrors.tencent.com repository: bkce/job-gateway - tag: 3.4.2-beta.6 + tag: 3.4.2-beta.7 pullPolicy: IfNotPresent pullSecrets: [] replicaCount: 1 @@ -567,7 +571,7 @@ manageConfig: image: registry: mirrors.tencent.com repository: bkce/job-manage - tag: 3.4.2-beta.6 + tag: 3.4.2-beta.7 pullPolicy: IfNotPresent pullSecrets: [] replicaCount: 1 @@ -616,7 +620,7 @@ executeConfig: image: registry: mirrors.tencent.com repository: bkce/job-execute - tag: 3.4.2-beta.6 + tag: 3.4.2-beta.7 pullPolicy: IfNotPresent pullSecrets: [] replicaCount: 1 @@ -662,7 +666,7 @@ crontabConfig: image: registry: mirrors.tencent.com repository: bkce/job-crontab - tag: 3.4.2-beta.6 + tag: 3.4.2-beta.7 pullPolicy: IfNotPresent pullSecrets: [] replicaCount: 1 @@ -716,7 +720,7 @@ logsvrConfig: image: registry: mirrors.tencent.com repository: bkce/job-logsvr - tag: 3.4.2-beta.6 + tag: 3.4.2-beta.7 pullPolicy: IfNotPresent pullSecrets: [] replicaCount: 1 @@ -763,7 +767,7 @@ backupConfig: image: registry: mirrors.tencent.com repository: bkce/job-backup - tag: 3.4.2-beta.6 + tag: 3.4.2-beta.7 pullPolicy: IfNotPresent pullSecrets: [] replicaCount: 1 @@ -807,7 +811,7 @@ analysisConfig: image: registry: mirrors.tencent.com repository: bkce/job-analysis - tag: 3.4.2-beta.6 + tag: 3.4.2-beta.7 pullPolicy: IfNotPresent pullSecrets: [] replicaCount: 1 @@ -851,7 +855,7 @@ fileGatewayConfig: image: registry: mirrors.tencent.com repository: bkce/job-file-gateway - tag: 3.4.2-beta.6 + tag: 3.4.2-beta.7 pullPolicy: IfNotPresent pullSecrets: [] replicaCount: 1 @@ -895,7 +899,7 @@ fileWorkerConfig: image: registry: mirrors.tencent.com repository: bkce/job-file-worker - tag: 3.4.2-beta.6 + tag: 3.4.2-beta.7 pullPolicy: IfNotPresent pullSecrets: [] replicaCount: 1 @@ -951,7 +955,7 @@ frontendConfig: image: registry: mirrors.tencent.com repository: bkce/job-frontend - tag: 3.4.2-beta.6 + tag: 3.4.2-beta.7 pullPolicy: IfNotPresent pullSecrets: [] replicaCount: 1 @@ -1011,5 +1015,5 @@ migration: image: registry: "mirrors.tencent.com" repository: "bkce/job-migration" - tag: 3.4.2-beta.6 + tag: 3.4.2-beta.7 pullPolicy: IfNotPresent diff --git a/support-files/kubernetes/images/backend/backend.Dockerfile b/support-files/kubernetes/images/backend/backend.Dockerfile index 5af352a2ed..8add28f648 100644 --- a/support-files/kubernetes/images/backend/backend.Dockerfile +++ b/support-files/kubernetes/images/backend/backend.Dockerfile @@ -2,17 +2,17 @@ FROM blueking/jdk:0.0.1 LABEL maintainer="Tencent BlueKing Job" -ENV BK_JOB_HOME=/data/job \ - BK_JOB_LOGS_DIR=/data/job/logs +ENV BK_JOB_HOME=/data/job/exec \ + BK_JOB_LOGS_DIR=/data/job/storage/logs -COPY ./ /data/job/ +COPY ./ /data/job/exec/ RUN ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ echo 'Asia/Shanghai' > /etc/timezone && \ - chmod +x /data/job/startup.sh + chmod +x /data/job/exec/startup.sh ENV LANG en_US.utf8 ENV LANGUAGE en_US.utf8 ENV LC_ALL en_US.utf8 -WORKDIR /data/job -CMD /data/job/startup.sh +WORKDIR /data/job/exec +CMD /data/job/exec/startup.sh diff --git a/support-files/kubernetes/images/backend/startup.sh b/support-files/kubernetes/images/backend/startup.sh index 9ae1f94b52..42ff75fbe5 100644 --- a/support-files/kubernetes/images/backend/startup.sh +++ b/support-files/kubernetes/images/backend/startup.sh @@ -1,5 +1,16 @@ #! /bin/sh +BK_JOB_STORAGE_BASE_DIR="/data/job/storage" + +echo "BK_JOB_APP_NAME=$BK_JOB_APP_NAME" +echo "KUBERNETES_NAMESPACE=$KUBERNETES_NAMESPACE" +echo "BK_JOB_POD_NAME=$BK_JOB_POD_NAME" +echo "BK_JOB_STORAGE_BASE_DIR=$BK_JOB_STORAGE_BASE_DIR" + +# 拼接日志相关路径 +BK_JOB_LOG_BASE_DIR="$BK_JOB_STORAGE_BASE_DIR/$KUBERNETES_NAMESPACE/$BK_JOB_POD_NAME/logs" +BK_JOB_LOG_DIR="$BK_JOB_LOG_BASE_DIR/$BK_JOB_APP_NAME" + echo "BK_JOB_LOG_BASE_DIR=$BK_JOB_LOG_BASE_DIR" mkdir -p "$BK_JOB_LOG_BASE_DIR" chmod 777 "$BK_JOB_LOG_BASE_DIR" @@ -8,6 +19,8 @@ echo "BK_JOB_LOG_DIR=$BK_JOB_LOG_DIR" mkdir -p "$BK_JOB_LOG_DIR" chmod 777 "$BK_JOB_LOG_DIR" +# 创建软链接供容器内日志采集使用 +ln -s $BK_JOB_LOG_BASE_DIR /data/logs ls $BK_JOB_LOG_BASE_DIR java -server \ @@ -25,4 +38,4 @@ java -server \ -XX:ErrorFile=$BK_JOB_LOG_DIR/error_sys.log \ -Dspring.profiles.active=$BK_JOB_PROFILE \ $BK_JOB_JVM_OPTION \ - -jar /data/job/$BK_JOB_JAR + -jar /data/job/exec/$BK_JOB_JAR diff --git a/support-files/kubernetes/images/file-worker/fileWorker.Dockerfile b/support-files/kubernetes/images/file-worker/fileWorker.Dockerfile index 5af352a2ed..e4b9eb4360 100644 --- a/support-files/kubernetes/images/file-worker/fileWorker.Dockerfile +++ b/support-files/kubernetes/images/file-worker/fileWorker.Dockerfile @@ -2,17 +2,17 @@ FROM blueking/jdk:0.0.1 LABEL maintainer="Tencent BlueKing Job" -ENV BK_JOB_HOME=/data/job \ +ENV BK_JOB_HOME=/data/job/exec \ BK_JOB_LOGS_DIR=/data/job/logs -COPY ./ /data/job/ +COPY ./ /data/job/exec/ RUN ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ echo 'Asia/Shanghai' > /etc/timezone && \ - chmod +x /data/job/startup.sh + chmod +x /data/job/exec/startup.sh ENV LANG en_US.utf8 ENV LANGUAGE en_US.utf8 ENV LC_ALL en_US.utf8 -WORKDIR /data/job -CMD /data/job/startup.sh +WORKDIR /data/job/exec +CMD /data/job/exec/startup.sh diff --git a/support-files/kubernetes/images/file-worker/startup.sh b/support-files/kubernetes/images/file-worker/startup.sh index 4898ff0fb6..a40a02e926 100644 --- a/support-files/kubernetes/images/file-worker/startup.sh +++ b/support-files/kubernetes/images/file-worker/startup.sh @@ -1,5 +1,16 @@ #! /bin/sh +BK_JOB_STORAGE_BASE_DIR="/data/job/storage" + +echo "BK_JOB_APP_NAME=$BK_JOB_APP_NAME" +echo "KUBERNETES_NAMESPACE=$KUBERNETES_NAMESPACE" +echo "BK_JOB_POD_NAME=$BK_JOB_POD_NAME" +echo "BK_JOB_STORAGE_BASE_DIR=$BK_JOB_STORAGE_BASE_DIR" + +# 拼接日志相关路径 +BK_JOB_LOG_BASE_DIR="$BK_JOB_STORAGE_BASE_DIR/$KUBERNETES_NAMESPACE/$BK_JOB_POD_NAME/logs" +BK_JOB_LOG_DIR="$BK_JOB_LOG_BASE_DIR/$BK_JOB_APP_NAME" + echo "BK_JOB_LOG_BASE_DIR=$BK_JOB_LOG_BASE_DIR" mkdir -p "$BK_JOB_LOG_BASE_DIR" chmod 777 "$BK_JOB_LOG_BASE_DIR" @@ -14,6 +25,7 @@ chmod 777 "$BK_JOB_FILE_WORKER_WORKSPACE_DIR" echo "BK_JOB_NODE_IP=$BK_JOB_NODE_IP" +ln -s $BK_JOB_LOG_BASE_DIR /data/logs ls $BK_JOB_LOG_BASE_DIR java -server \ @@ -31,4 +43,4 @@ java -server \ -XX:ErrorFile=$BK_JOB_LOG_DIR/error_sys.log \ -Dspring.profiles.active=$BK_JOB_PROFILE \ $BK_JOB_JVM_OPTION \ - -jar /data/job/$BK_JOB_JAR + -jar /data/job/exec/$BK_JOB_JAR diff --git a/support-files/kubernetes/images/migration/migration.Dockerfile b/support-files/kubernetes/images/migration/migration.Dockerfile index 2580df9384..b89304848a 100644 --- a/support-files/kubernetes/images/migration/migration.Dockerfile +++ b/support-files/kubernetes/images/migration/migration.Dockerfile @@ -2,10 +2,10 @@ FROM blueking/jdk:0.0.1 LABEL maintainer="Tencent BlueKing Job" -ENV BK_JOB_HOME=/data/job \ - BK_JOB_LOGS_DIR=/data/job/logs +ENV BK_JOB_HOME=/data/job/exec \ + BK_JOB_LOGS_DIR=/data/job/storage/logs -COPY ./ /data/job/ +COPY ./ /data/job/exec/ RUN yum -y install mysql RUN yum install -y epel-release @@ -14,11 +14,11 @@ RUN pip install requests RUN ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ echo 'Asia/Shanghai' > /etc/timezone && \ - chmod +x /data/job/startup.sh + chmod +x /data/job/exec/startup.sh ENV LANG en_US.utf8 ENV LANGUAGE en_US.utf8 ENV LC_ALL en_US.utf8 -WORKDIR /data/job -CMD /data/job/startup.sh +WORKDIR /data/job/exec +CMD /data/job/exec/startup.sh