Skip to content

Commit

Permalink
feat: 红线支持指定到具体的步骤插件 TencentBlueKing#5405. 区分一条流水线中多个bash插件
Browse files Browse the repository at this point in the history
  • Loading branch information
JamiKX1 committed Nov 18, 2021
1 parent 9543e7c commit d718623
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ data class QualityGateInElement(
var interceptTask: String? = null,
@ApiModelProperty("拦截原子名称", required = false)
var interceptTaskName: String? = null,
@ApiModelProperty("拦截原子id", required = false)
var interceptTaskId: String? = null,
@ApiModelProperty("审核人", required = false)
var reviewUsers: Set<String>? = null
) : Element(name, id, status) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ data class QualityGateOutElement(
var interceptTask: String? = null,
@ApiModelProperty("拦截原子名称", required = false)
var interceptTaskName: String? = null,
@ApiModelProperty("拦截原子id", required = false)
var interceptTaskId: String? = null,
@ApiModelProperty("审核人", required = false)
var reviewUsers: Set<String>? = null
) : Element(name, id, status) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ class PipelineBuildQualityService(
task: PipelineBuildTask,
interceptTaskName: String?,
interceptTask: String?,
interceptTaskId: String?,
runVariables: Map<String, String>,
buildLogPrinter: BuildLogPrinter,
position: String,
Expand Down Expand Up @@ -418,7 +419,7 @@ class PipelineBuildQualityService(
interceptTaskName = interceptTaskName ?: "",
startTime = LocalDateTime.now().timestamp(),
taskId = interceptTask,
elementId = elementId,
elementId = interceptTaskId,
position = position,
templateId = templateId,
runtimeVariable = runVariables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ object QualityUtils {
return if (gatewayIds.isEmpty() || gatewayIds.any { element.name.toLowerCase().contains(it.toLowerCase()) }) {
val id = "T-${UUIDUtil.generate()}"
if (isBefore) {
QualityGateInElement("质量红线(准入)", id, null, element.getAtomCode(), element.name)
QualityGateInElement("质量红线(准入)", id, null, element.getAtomCode(), element.name, element.id)
} else {
QualityGateOutElement("质量红线(准出)", id, null, element.getAtomCode(), element.name)
QualityGateOutElement("质量红线(准出)", id, null, element.getAtomCode(), element.name, element.id)
}
} else {
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class QualityGateInTaskAtom @Autowired constructor(
task = task,
interceptTaskName = param.interceptTaskName,
interceptTask = param.interceptTask,
interceptTaskId = param.interceptTaskId,
runVariables = runVariables,
buildLogPrinter = buildLogPrinter,
position = ControlPointPosition.BEFORE_POSITION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class QualityGateOutTaskAtom @Autowired constructor(
task = task,
interceptTaskName = param.interceptTaskName,
interceptTask = param.interceptTask,
interceptTaskId = param.interceptTaskId,
runVariables = runVariables,
buildLogPrinter = buildLogPrinter,
position = ControlPointPosition.AFTER_POSITION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ class QualityRuleCheckService @Autowired constructor(

logger.info("QUALITY|metadataList is|$metadataList")

metadataList.forEach { metadata ->
metadataList.forEach foreach@{ metadata ->
if (!ruleTaskSteps.isNullOrEmpty()) {
ruleTaskSteps.forEach { ruleTask ->
if ((ruleTask.indicatorEnName == metadata.enName) &&
Expand All @@ -448,6 +448,9 @@ class QualityRuleCheckService @Autowired constructor(
}
}
} else {
if (!elementId.isNullOrBlank() && metadata.taskId == elementId) {
return@foreach
}
checkMetaList.add(metadata)
}
}
Expand Down

0 comments on commit d718623

Please sign in to comment.