Dav*_*ard 5 yaml expression 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') }}:
default: primaryReadonly
${{ if eq(format('{0:dddd}', pipeline.startTime), 'Tuesday') }}:
default: secondaryReadonly
values:
- primary
- secondary
- primaryReadonly
- secondaryReadonly
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1745 次 |
最近记录: |