Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:流水线变量语法支持两种风格 #10576 #10961

Merged
merged 26 commits into from
Nov 4, 2024

Conversation

mingshewhe
Copy link
Collaborator

@mingshewhe mingshewhe commented Sep 13, 2024

#10576

方言设计:

  1. 流水线设置增加pipelineDialect字段,值放在pipelineAsSetting字段中
  2. 抽象方言对象com.tencent.devops.common.pipeline.dialect.IPipelineDialect,实现类ClassicPipelineDialect和ConstrainedPipelineDialect

引擎执行设计

  1. 在构建时,将方言值存储在var表中,key为BK_CI_PIPELINE_DIALECT
  2. 构建运行时,直接从var表中从方言取值,如果方言有改动,那么重试还应该继续保持构建时的值
  3. 变量引用方式:
    • 如果支持${}引用,那么在com.tencent.devops.process.engine.service.vmbuild.EngineVMBuildService#claim,领取任务是在服务端就会解析一次
    • worker领取到任务后,会再次解析,比如构建机上运行时才有的变量,如${workspace},解析完后,如果还有${{}}引用的变量,会运行表达式计算
  4. 变量不存在
    • 表达式引擎里面,通过传参判断当变量不存在时是否抛出异常,传参由方言控制
  5. 变量超长
    • 启动变量:
    • 运行时插件输出:
    • webhook触发时的变量,webhook触发的变量不影响构建,但是如果启动参数里面使用了与wenhook相同的变量,那么就会启动失败

# Conflicts:
#	src/backend/ci/core/common/common-pipeline-yaml/src/main/kotlin/com/tencent/devops/process/yaml/transfer/ModelTransfer.kt
#	src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/setting/PipelineSettingVersion.kt
#	src/backend/ci/core/process/biz-base/src/main/kotlin/com/tencent/devops/process/dao/PipelineSettingVersionDao.kt
#	src/backend/ci/core/process/biz-base/src/main/kotlin/com/tencent/devops/process/service/pipeline/PipelineBuildService.kt
#	src/backend/ci/core/process/biz-base/src/main/kotlin/com/tencent/devops/process/service/pipeline/PipelineSettingVersionService.kt
#	src/backend/ci/core/process/biz-engine/src/main/kotlin/com/tencent/devops/process/engine/control/command/stage/impl/CheckPauseReviewStageCmd.kt
#	src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/impl/AbsProjectServiceImpl.kt
# Conflicts:
#	src/backend/ci/core/process/biz-engine/src/main/kotlin/com/tencent/devops/process/engine/atom/vm/DispatchVMStartupTaskAtom.kt
#	src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/ProjectService.kt
#	src/backend/ci/core/project/biz-project/src/main/kotlin/com/tencent/devops/project/service/impl/AbsProjectServiceImpl.kt
@bkci-bot bkci-bot merged commit 5eed2f6 into TencentBlueKing:master Nov 4, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants