Skip to content

Commit

Permalink
feat:流水线变量语法支持两种风格 TencentBlueKing#10576
Browse files Browse the repository at this point in the history
  • Loading branch information
mingshewhe committed Aug 26, 2024
1 parent 1617e09 commit d333cc9
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ data class PipelineVersionWithModel(
@get:Schema(title = "更新操作人", required = true)
val updater: String?,
@get:Schema(title = "版本修改时间", required = true)
val updateTime: LocalDateTime?
val updateTime: Long?
)
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class PipelineBuildService(
val longVarNames = context.pipelineParamMap.filter {
it.value.value.toString().length >= PIPELINE_VARIABLES_STRING_LENGTH_MAX
}.map { it.key }
if (!pipelineDialect.supportLongVarValue()) {
if (longVarNames.isNotEmpty() && !pipelineDialect.supportLongVarValue()) {
throw ErrorCodeException(
errorCode = ProcessMessageCode.ERROR_PIPELINE_VARIABLES_OUT_OF_LENGTH,
params = arrayOf(longVarNames.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ class PipelineVersionFacadeService @Autowired constructor(
yamlSupported = yamlSupported,
yamlInvalidMsg = msg,
updater = resource.updater,
updateTime = resource.updateTime
updateTime = resource.updateTime?.timestampmilli()
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ open class MarketAtomTask : ITask() {
val dialect = PipelineDialectEnums.getDialect(asCodeSettings)
val atomParams = mutableMapOf<String, String>()
try {
if (asCodeEnabled || !dialect.supportSingleCurlyBracesVar()) {
if (!dialect.supportUseSingleCurlyBracesVar()) {
val customReplacement = EnvReplacementParser.getCustomExecutionContextByMap(
variables = variables,
extendNamedValueMap = listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ interface ICommand {
).toMutableMap()
// 增加上下文的替换
PipelineVarUtil.fillContextVarMap(contextMap)
val asCodeEnabled = asCodeSettings?.enable
val dialect = PipelineDialectEnums.getDialect(asCodeSettings)
return if (asCodeEnabled == true || !dialect.supportSingleCurlyBracesVar()) {
return if (!dialect.supportUseSingleCurlyBracesVar()) {
EnvReplacementParser.parse(
value = command,
contextMap = contextMap,
Expand Down

0 comments on commit d333cc9

Please sign in to comment.