【问题标题】:How to create a toggle on yaml in the starting variables of the azur devops pipeline?如何在 azure devops 管道的起始变量中创建 yaml 切换?
【发布时间】:2021-10-21 17:43:18
【问题描述】:

我有一个使用可以采用多个硬编码值的变量的管道。此变量在管道启动屏幕上可用,用户必须填写它。结果,出现拼写错误,管道无法工作。我可以将此变量设为切换,以便用户无需输入值,而是从可用值列表中选择它吗?

【问题讨论】:

    标签: azure-devops yaml azure-pipelines


    【解决方案1】:

    您不能对变量执行此操作,但您可以将其用于 runtime parameters

    例如:

    parameters:
    - name: image
      displayName: Pool Image
      type: string
      default: ubuntu-latest
      values:
      - windows-latest
      - vs2017-win2016
      - ubuntu-latest
      - ubuntu-16.04
      - macOS-latest
      - macOS-10.14
    
    trigger: none
    
    jobs:
    - job: build
      displayName: build
      pool: 
        vmImage: ${{ parameters.image }}
      steps:
      - script: echo building $(Build.BuildNumber) with ${{ parameters.image }}
    
    

    产生:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-23
      • 1970-01-01
      • 2022-07-21
      • 1970-01-01
      • 2019-05-14
      • 2022-09-23
      • 2019-10-04
      • 1970-01-01
      相关资源
      最近更新 更多