forked from TencentBlueKing/bk-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:【PAC模板】流水线模板支持PAC特性 TencentBlueKing#11414
基本结构、类、方法设计
- Loading branch information
Showing
38 changed files
with
1,912 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...n/common-pipeline/src/main/kotlin/com/tencent/devops/common/pipeline/ITemplateFunction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. | ||
* | ||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. | ||
* | ||
* A copy of the MIT License is included in this file. | ||
* | ||
* | ||
* Terms of the MIT License: | ||
* --------------------------------------------------- | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of | ||
* the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT | ||
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
package com.tencent.devops.common.pipeline | ||
|
||
import com.tencent.devops.common.pipeline.pojo.BuildFormProperty | ||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
@Schema(title = "流水线模版函数") | ||
interface ITemplateFunction { | ||
@get:Schema(title = "来源于模版", required = false) | ||
var fromTemplate: Boolean? | ||
@get:Schema(title = "模板ID", required = false) | ||
var templateId: String? | ||
@get:Schema(title = "版本", required = false) | ||
var templateVersion: Int? | ||
@get:Schema(title = "模板参数构建", required = false) | ||
var templateParams: List<BuildFormProperty>? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
...line/src/main/kotlin/com/tencent/devops/common/pipeline/container/JobTemplateContainer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. | ||
* | ||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. | ||
* | ||
* A copy of the MIT License is included in this file. | ||
* | ||
* | ||
* Terms of the MIT License: | ||
* --------------------------------------------------- | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of | ||
* the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT | ||
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
package com.tencent.devops.common.pipeline.container | ||
|
||
import com.tencent.devops.common.pipeline.pojo.BuildFormProperty | ||
import com.tencent.devops.common.pipeline.pojo.element.Element | ||
import com.tencent.devops.common.pipeline.pojo.time.BuildRecordTimeCost | ||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
@Schema(title = "流水线模型-模版容器") | ||
data class JobTemplateContainer( | ||
@get:Schema(title = "构建容器序号id", required = false, readOnly = true) | ||
override var id: String? = null, | ||
@get:Schema(title = "容器名称", required = true) | ||
override var name: String = "", | ||
@get:Schema(title = "任务集合", required = true) | ||
override var elements: List<Element> = listOf(), | ||
@get:Schema(title = "状态", required = true, readOnly = true) | ||
override var status: String? = null, | ||
@get:Schema(title = "系统运行时间", required = false) | ||
@Deprecated("即将被timeCost代替") | ||
override var startEpoch: Long? = null, | ||
@get:Schema(title = "系统耗时(开机时间)", required = false, readOnly = true) | ||
@Deprecated("即将被timeCost代替") | ||
override var systemElapsed: Long? = null, | ||
@get:Schema(title = "插件执行耗时", required = false, readOnly = true) | ||
@Deprecated("即将被timeCost代替") | ||
override var elementElapsed: Long? = null, | ||
@get:Schema(title = | ||
"是否可重试-仅限于构建详情展示重试,目前未作为编排的选项,暂设置为null不存储", | ||
required = false, | ||
readOnly = true | ||
) | ||
override var canRetry: Boolean? = null, | ||
@get:Schema(title = "构建容器顺序ID(同id值)", required = false, readOnly = true) | ||
override var containerId: String? = null, | ||
@get:Schema(title = "容器唯一ID", required = false, readOnly = true) | ||
override var containerHashId: String? = null, | ||
@get:Schema(title = "构建环境启动状态", required = false, readOnly = true) | ||
override var startVMStatus: String? = null, | ||
@get:Schema(title = "容器运行次数", required = false, readOnly = true) | ||
override var executeCount: Int? = null, | ||
@get:Schema(title = "用户自定义ID", required = false, hidden = false) | ||
override var jobId: String? = null, | ||
@get:Schema(title = "是否包含post任务标识", required = false, readOnly = true) | ||
override var containPostTaskFlag: Boolean? = null, | ||
@get:Schema(title = "是否为构建矩阵", required = false, readOnly = true) | ||
override var matrixGroupFlag: Boolean? = false, | ||
@get:Schema(title = "各项耗时", required = true) | ||
override var timeCost: BuildRecordTimeCost? = null, | ||
@get:Schema(title = "开机任务序号", required = false, readOnly = true) | ||
override var startVMTaskSeq: Int? = null, | ||
@get:Schema(title = "来源于模版", required = false) | ||
override var fromTemplate: Boolean? = false, | ||
@get:Schema(title = "模板ID", required = false) | ||
override var templateId: String? = null, | ||
@get:Schema(title = "版本", required = false) | ||
override var templateVersion: Int? = null, | ||
@get:Schema(title = "模板参数构建", required = false) | ||
override var templateParams: List<BuildFormProperty>? = null | ||
) : Container { | ||
companion object { | ||
const val classType = "jobTemplate" | ||
} | ||
|
||
override fun getClassType() = classType | ||
|
||
override fun getContainerById(vmSeqId: String): Container? { | ||
return if (id == vmSeqId) this else null | ||
} | ||
|
||
override fun retryFreshMatrixOption() = Unit | ||
|
||
override fun fetchGroupContainers(): List<Container>? = null | ||
|
||
override fun fetchMatrixContext(): Map<String, String>? = null | ||
|
||
override fun containerEnabled(): Boolean { | ||
return true | ||
} | ||
|
||
override fun setContainerEnable(enable: Boolean) = Unit | ||
|
||
override fun transformCompatibility() { | ||
super.transformCompatibility() | ||
} | ||
|
||
override fun copyElements(elements: List<Element>): Container { | ||
return this.copy(elements = elements) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.