azure-devops - 推迟生产版本以在 azure devops yaml 管道中的自定义时间运行

标签 azure-devops azure-pipelines-yaml

我们拥有经典的管道设置和预部署批准,可以将生产发布推迟到决定发布的时间。像下面这样

这是 YAML 管道中需要的设置

最近公司采用了 azure devops yaml,所有管道现在都迁移到 Azure devops YAML。 我被要求在 YAML 管道中设置类似的结构,人们可以在其中批准发布并将其推迟到特定时间。

如何在 YAML 管道中实现类似的设置?

最佳答案

不幸的是,没有现成的选项。有解决方法,也许有适合您的东西:

1

关于this community request几种替代方案描述如下: 使用带有 defer 的经典管道,使用 powershell 启动 YAML 管道。

2

描述了另一种替代方案here ,管道中Sleep的使用,可以通过参数进行配置。

trigger:
- main

pool:
  vmImage: ubuntu-latest

parameters:
  - name: delay
    displayName: Defer deployment (in seconds)
    type: string
    default: 0

steps:
# Delay further execution of a workflow by a fixed time.
- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: 'Start-Sleep -s ${{ parameters.delay }}' 
- script: 'echo after ${{ parameters.delay }} minutes'

3

对于 agentless job您使用Delay task 。 使用此任务时,可以使用输入参数将延迟设置为变量值。

结论

所有替代方案听起来都很hacky

关于azure-devops - 推迟生产版本以在 azure devops yaml 管道中的自定义时间运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75244000/

相关文章:

azure-devops - 从 Azure DevOps 发布定义中的同一项目部署多个 Web 作业?

azure-devops - 将 TFS 2010 迁移到 Visual Studio Online

azure - 获取-AzResourceGroup : 'this.Client.SubscriptionId' cannot be null

azure - 如何从 Azure DevOps YAML 管道访问 AzureResourceManagerTemplateDeployment (@3) 任务中的 "deploymentOutputs"?

Azure yaml管道显示参数值并有另一个实际值

azure-devops - AzureDev Ops CI 构建未更新版本 (VersionPrefix)

azure - 有没有办法循环 Azure DevOps 中 stageDependency 的所有输出?

Azure DevOps如何在发布构建管道后获取输出(放置)文件夹中的文件名

azure - 在用于 .NET Core 应用程序构建的 Azure DevOps 管道模板中使用 'parameters' 部分时出现“预期映射”语法错误

azure - 通过 Visual Studio Online 执行 Azure 云服务 CI 构建时如何构建单元测试项目?