From 481d81c964f8d78274af09d46b6b115c7acbc685 Mon Sep 17 00:00:00 2001 From: royalhuang Date: Thu, 9 Jan 2025 12:09:09 +0800 Subject: [PATCH] =?UTF-8?q?pref:=20=E6=97=A5=E5=BF=97=E6=A8=A1=E5=9D=97ES?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E6=80=A7=E8=83=BD=E4=BC=98=E5=8C=96=20#7091?= =?UTF-8?q?=20=E5=8F=96=E6=B6=88=E5=AD=98=E5=82=A8=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=9A=84=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/log/api/print/ServiceLogPrintResource.kt | 2 +- .../com/tencent/devops/log/dao/LogStatusDao.kt | 13 +++++++------ .../com/tencent/devops/log/event/LogStatusEvent.kt | 2 +- .../tencent/devops/log/service/LogStatusService.kt | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/backend/ci/core/log/api-log/src/main/kotlin/com/tencent/devops/log/api/print/ServiceLogPrintResource.kt b/src/backend/ci/core/log/api-log/src/main/kotlin/com/tencent/devops/log/api/print/ServiceLogPrintResource.kt index d0332cd1afa..28f4142d9df 100644 --- a/src/backend/ci/core/log/api-log/src/main/kotlin/com/tencent/devops/log/api/print/ServiceLogPrintResource.kt +++ b/src/backend/ci/core/log/api-log/src/main/kotlin/com/tencent/devops/log/api/print/ServiceLogPrintResource.kt @@ -127,7 +127,7 @@ interface ServiceLogPrintResource { executeCount: Int?, @Parameter(description = "插件的存储模式", required = false) @QueryParam("logStorageMode") - logStorageMode: LogStorageMode? = LogStorageMode.UPLOAD, + logStorageMode: LogStorageMode? = null, @Parameter(description = "job id", required = false) @QueryParam("userJobId") jobId: String?, diff --git a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/dao/LogStatusDao.kt b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/dao/LogStatusDao.kt index b9e7835141b..e6c94a198d2 100644 --- a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/dao/LogStatusDao.kt +++ b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/dao/LogStatusDao.kt @@ -46,26 +46,27 @@ class LogStatusDao { subTags: String?, containerHashId: String?, executeCount: Int, - logStorageMode: LogStorageMode, + logStorageMode: LogStorageMode?, finish: Boolean, jobId: String?, stepId: String? ) { with(TLogStatus.T_LOG_STATUS) { - dslContext.insertInto(this) + val update = dslContext.insertInto(this) .set(BUILD_ID, buildId) .set(TAG, tag) .set(SUB_TAG, subTags) .set(EXECUTE_COUNT, executeCount) .set(JOB_ID, containerHashId) .set(FINISHED, finish) - .set(MODE, logStorageMode.name) + .set(USER_JOB_ID, jobId) .set(STEP_ID, stepId) - .onDuplicateKeyUpdate() + logStorageMode?.let { update.set(MODE, it.name) } + update.onDuplicateKeyUpdate() .set(FINISHED, finish) - .set(MODE, logStorageMode.name) - .execute() + logStorageMode?.let { update.set(MODE, it.name) } + update.execute() } } diff --git a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/event/LogStatusEvent.kt b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/event/LogStatusEvent.kt index 17e56c21fd3..3b0e6e63e6a 100644 --- a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/event/LogStatusEvent.kt +++ b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/event/LogStatusEvent.kt @@ -44,7 +44,7 @@ data class LogStatusEvent( val userJobId: String?, val stepId: String?, val executeCount: Int?, - val logStorageMode: LogStorageMode? = LogStorageMode.UPLOAD, + val logStorageMode: LogStorageMode?, override var retryTime: Int = 2, override var delayMills: Int = 0 ) : ILogEvent(buildId, retryTime, delayMills) diff --git a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/service/LogStatusService.kt b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/service/LogStatusService.kt index a7db4c0466f..db2e6098ef9 100644 --- a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/service/LogStatusService.kt +++ b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/service/LogStatusService.kt @@ -63,7 +63,7 @@ class LogStatusService @Autowired constructor( subTags = subTag ?: "", containerHashId = containerHashId ?: "", executeCount = executeCount ?: 1, - logStorageMode = logStorageMode ?: LogStorageMode.UPLOAD, + logStorageMode = logStorageMode, finish = finish, jobId = jobId, stepId = stepId