相关疑难解决方法(0)

根据计划将不同的参数值传递到 Azure DevOps Pipeline

我有一个长期运行的 DevOps 管道,每天早上都会设置一个复杂的环境。

它有一个参数;我们称之为“版本”。

我需要安排管道每天早上自动运行 3 次,版本值为 1、2 和 3。

查看触发器,调度触发器和管道触发器似乎都不允许传递参数值。

有没有办法做到这一点?重要的是它们彼此独立运行。每次执行需要 30 到 60 分钟。因此,一个接一个地循环运行它们并不是一种选择。


这是我的 YAML 代码当前的样子:

trigger: none
pr: none
schedules:
  - cron: 0,5,10 12 * * mon,tue,wed,fri
    displayName: Scheduled most mornings
    branches:
      include:
      - CIBranch
    always: true

parameters:
- name: Version
  type: string
  default: '3'
Run Code Online (Sandbox Code Playgroud)

azure-devops azure-pipelines

11
推荐指数
1
解决办法
1万
查看次数

动态设置自动管道的参数值

如果我创建一个参数,我可以在手动运行管道时设置其值。但是当管道自动运行时,它使用默认值。当管道自动运行时(例如响应推送到存储库)是否有任何方法可以向其传递参数值?

这是我正在使用的 yaml 文件。目标是能够控制在管道中运行哪些测试。

parameters:
  - name: testFiles
    type: string
    default: cypress/integration/first.spec.js

trigger:
  - azure-test

pool:
  vmImage: ubuntu-latest

steps:
  - task: NodeTool@0
    inputs:
      versionSpec: "10.x"
    displayName: "Install Node.js"

  - script: npm install
    displayName: "npm install"

  - script: npx cypress run --record --key [record key removed] --spec ${{ parameters.testFiles }}
    displayName: "run cypress"
Run Code Online (Sandbox Code Playgroud)

continuous-integration azure-devops azure-pipelines

6
推荐指数
1
解决办法
1万
查看次数