Skip to content

Commit

Permalink
Merge pull request #6390 from irwinsun/issue_5806
Browse files Browse the repository at this point in the history
feat : 当stage/job/step 因为不满足条件而跳过时,增加日志明确展示跳过的原因 #6366
  • Loading branch information
irwinsun authored Mar 22, 2022
2 parents 00b2ca9 + b7f66ee commit 75e2b6c
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 75e2b6c

Please sign in to comment.