Skip to content

Commit

Permalink
feat: variable增加readOnly属性 TencentBlueKing#4682
Browse files Browse the repository at this point in the history
  • Loading branch information
huangjiao-heart committed Jul 16, 2021
1 parent cfc1517 commit 3af2293
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ class PipelineBuildVarDao @Autowired constructor() {
pipelineId: String,
buildId: String,
name: String,
value: Any,
readOnly: Boolean
value: Any
) {

with(T_PIPELINE_BUILD_VAR) {
Expand All @@ -60,10 +59,9 @@ class PipelineBuildVarDao @Autowired constructor() {
PIPELINE_ID,
BUILD_ID,
KEY,
VALUE,
READ_ONLY
VALUE
)
.values(projectId, pipelineId, buildId, name, value.toString(), readOnly)
.values(projectId, pipelineId, buildId, name, value.toString())
.onDuplicateKeyUpdate()
.set(PROJECT_ID, projectId)
.set(PIPELINE_ID, pipelineId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -606,17 +606,27 @@ class PipelineBuildFacadeService(
*/
val triggerContainer = model.stages[0].containers[0] as TriggerContainer

val startParams = mutableMapOf<String, Any>()
startParams.putAll(parameters)
val startParams = mutableListOf<BuildParameters>()
for (it in parameters) {
startParams.add(BuildParameters(it.key, it.value))
}
val paramsKeyList = startParams.map { it.key }
triggerContainer.params.forEach {
if (startParams.containsKey(it.id)) {
if (paramsKeyList.contains(it.id)) {
return@forEach
}
startParams[it.id] = it.defaultValue
startParams.add(BuildParameters(key = it.id, value = it.defaultValue, readOnly = it.readOnly))
}
// 子流水线的调用不受频率限制
val startParamsWithType = mutableListOf<BuildParameters>()
startParams.forEach { (key, value) -> startParamsWithType.add(BuildParameters(key, value)) }
startParams.forEach { (key, value, valueType, readOnly) ->
startParamsWithType.add(BuildParameters(
key,
value,
valueType,
readOnly
))
}

return pipelineBuildService.startPipeline(
userId = userId,
Expand Down

0 comments on commit 3af2293

Please sign in to comment.