Skip to content

Commit

Permalink
feat : 当stage/job/step 因为不满足条件而跳过时,增加日志明确展示跳过的原因 #6366
Browse files Browse the repository at this point in the history
修正
  • Loading branch information
irwinsun committed Mar 22, 2022
1 parent 6a47b87 commit b7f66ee
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,20 @@ object ControlUtils {
JobRunCondition.CUSTOM_CONDITION_MATCH -> { // 满足以下自定义条件时运行
return !evalExpression(customCondition, buildId, variables, message)
}
else -> return false // 其它类型直接返回不跳过
else -> {
message.append(runCondition)
return false
} // 其它类型直接返回不跳过
}
for (names in conditions) {
val key = names.key
val value = names.value
val existValue = variables[key]
val env = EnvUtils.parseEnv(value, variables)
if (env != existValue) {
message.append("\nkey=$key, expect=$existValue, actual=$value, (expect != actual)=true, skip=$skip")
skip = !skip // 不满足则取反
logger.info("[$buildId]|JOB_CONDITION|$skip|$runCondition|key=$key|actual=$existValue|expect=$value")
message.append("\nkey=$key, expect=$env, actual=$existValue, (expect!=actual)=true, skip=$skip")
break
}
}
Expand Down

0 comments on commit b7f66ee

Please sign in to comment.