Skip to content

Commit

Permalink
bug: 质量红线审核通知未成功发送 TencentBlueKing#5658 红线卡审核时不刷新状态
Browse files Browse the repository at this point in the history
  • Loading branch information
royalhuang committed Jan 12, 2022
1 parent 944f4fb commit e6049e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,16 @@ class PipelineBuildStageDao {
projectId: String,
buildId: String,
stageId: String,
buildStatus: BuildStatus,
buildStatus: BuildStatus?,
controlOption: PipelineBuildStageControlOption? = null,
checkIn: StagePauseCheck? = null,
checkOut: StagePauseCheck? = null,
initStartTime: Boolean? = false
): Int {
return with(T_PIPELINE_BUILD_STAGE) {
val update = dslContext.update(this).set(STATUS, buildStatus.ordinal)
val update = dslContext.update(this).set(STAGE_ID, stageId)
// 根据状态来设置字段
if (buildStatus.isFinish() || buildStatus == BuildStatus.STAGE_SUCCESS) {
if (buildStatus?.isFinish() == true || buildStatus == BuildStatus.STAGE_SUCCESS) {
update.set(END_TIME, LocalDateTime.now())
update.set(
COST, COST + JooqUtils.timestampDiff(
Expand All @@ -251,12 +251,13 @@ class PipelineBuildStageDao {
END_TIME.cast(java.sql.Timestamp::class.java)
)
)
} else if (buildStatus.isRunning() || initStartTime == true) {
} else if (buildStatus?.isRunning() == true || initStartTime == true) {
update.set(START_TIME, LocalDateTime.now())
}
if (controlOption != null) update.set(CONDITIONS, JsonUtil.toJson(controlOption, formatted = false))
if (checkIn != null) update.set(CHECK_IN, JsonUtil.toJson(checkIn, formatted = false))
if (checkOut != null) update.set(CHECK_OUT, JsonUtil.toJson(checkOut, formatted = false))
buildStatus?.let { update.set(STATUS, it.ordinal) }
controlOption?.let { update.set(CONDITIONS, JsonUtil.toJson(it, formatted = false)) }
checkIn?.let { update.set(CHECK_IN, JsonUtil.toJson(it, formatted = false)) }
checkOut?.let { update.set(CHECK_OUT, JsonUtil.toJson(it, formatted = false)) }
update.where(BUILD_ID.eq(buildId)).and(STAGE_ID.eq(stageId)).and(PROJECT_ID.eq(projectId)).execute()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class PipelineStageService @Autowired constructor(
dslContext = context, projectId = projectId, buildId = buildId,
stageId = stageId, controlOption = controlOption!!,
// #5246 所有质量红线检查都不影响stage原构建状态
buildStatus = buildStage.status, initStartTime = true,
buildStatus = null, initStartTime = true,
checkIn = checkIn, checkOut = checkOut
)
pipelineBuildDao.updateBuildStageStatus(
Expand Down

0 comments on commit e6049e7

Please sign in to comment.