相关疑难解决方法(0)

Azure Devops Build:计划构建的参数

有什么方法可以在按计划触发时将参数传递给 azure devops 构建管道 (YAML)?例如,如果您想每晚构建一个发布构建,但又想每周构建一个调试构建?

必须将整个构建管道复制到 SomeBuild-Debug 才能创建默认为 configuration=debug 的构建,以便能够安排它,这似乎是不对的?

azure-devops azure-pipelines

9
推荐指数
2
解决办法
5689
查看次数

如何有条件地设置 Azure DevOps 参数的值?

我有一个用于轮换某些密钥的 Azure DevOps 管道。有两个主要要求 -

  • 一次只能旋转一个键。
  • 任何键都可以通过手动运行临时轮换。

为此,我计划使用在不同日期运行的 cron 计划。然后应该使用一个参数,默认设置为基于星期几的特定“密钥种类”。使用参数意味着用户还可以在手动运行管道时指定要轮换的键。

不幸的是,我想出的方法不起作用。参数中的四个表达式中的每一个都产生以下错误 -

A template expression is not allowed in this context
Run Code Online (Sandbox Code Playgroud)

根据文档...

编译时表达式可以在任何地方使用

……但这似乎不正确。我希望我遗漏了一些东西,而不是文档不正确,但无论哪种方式,我都不确定如何实现我的目标。

pr: none
trigger: none
schedules:
- cron: 0 2 * * 0-3,6
  displayName: Rotate a key
  branches:
    include:
    - develop
  always: true

parameters:
- name: keyKinds
  displayName: Key Kinds
  type: string
  ${{ if not(in(format('{0:dddd}', pipeline.startTime), 'Sunday', 'Monday', 'Tuesday')) }}:
    default: primary
  ${{ if eq(format('{0:dddd}', pipeline.startTime), 'Sunday') }}:
    default: secondary
  ${{ if eq(format('{0:dddd}', pipeline.startTime), 'Monday') …
Run Code Online (Sandbox Code Playgroud)

yaml expression azure-devops

5
推荐指数
1
解决办法
1745
查看次数

标签 统计

azure-devops ×2

azure-pipelines ×1

expression ×1

yaml ×1