Skip to content

Commit

Permalink
feat: stage支持质量红线的准入准出 TencentBlueKing#4732 设置准入失败的stage为未执行
Browse files Browse the repository at this point in the history
  • Loading branch information
royalhuang committed Aug 9, 2021
1 parent f73a46d commit ad8c63e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,18 @@ class PipelineBuildStageDao {
buildId: String,
stageId: String,
controlOption: PipelineBuildStageControlOption,
buildStatus: BuildStatus?,
checkIn: StagePauseCheck? = null,
checkOut: StagePauseCheck? = null
): Int {
return with(T_PIPELINE_BUILD_STAGE) {
val update = dslContext.update(this)
.set(CONDITIONS, JsonUtil.toJson(controlOption))
if (buildStatus == null) {
update.setNull(STATUS)
} else {
update.set(STATUS, buildStatus.ordinal)
}
if (checkIn != null) update.set(CHECK_IN, JsonUtil.toJson(checkIn))
if (checkOut != null) update.set(CHECK_OUT, JsonUtil.toJson(checkOut))
update.where(BUILD_ID.eq(buildId)).and(STAGE_ID.eq(stageId)).execute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ class PipelineStageService @Autowired constructor(
)
dslContext.transaction { configuration ->
val context = DSL.using(configuration)
pipelineBuildStageDao.updateStatus(
pipelineBuildStageDao.updateOptions(
dslContext = context, buildId = buildId,
stageId = stageId, buildStatus = BuildStatus.UNEXEC,
controlOption = controlOption, checkIn = checkIn, checkOut = checkOut
stageId = stageId, buildStatus = null,
controlOption = controlOption!!, checkIn = checkIn, checkOut = checkOut
)

pipelineBuildDao.updateBuildStageStatus(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class StageBuildDetailService(
override fun onFindStage(stage: Stage, model: Model): Traverse {
if (stage.id == stageId) {
update = true
stage.status = ""
stage.status = null
stage.reviewStatus = BuildStatus.QUALITY_CHECK_FAIL.name
stage.stageControlOption = controlOption.stageControlOption
stage.checkIn = checkIn
Expand Down

0 comments on commit ad8c63e

Please sign in to comment.