【问题标题】:Azure DevOps condition on sources paths源路径上的 Azure DevOps 条件
【发布时间】:2020-07-27 12:58:01
【问题描述】:

我有以下回购结构:

/
  /dir1
    /file
  /dir2
    /file

是否可以构建 Azure DevOps 条件以在 ./dir1/file 更改时执行特定作业,而在 ./dir2/file 更改时执行其他作业?

【问题讨论】:

    标签: azure-devops


    【解决方案1】:

    我们确实有一个条件来控制是否应该运行作业。但它不是基于路径过滤器。

    您可以指定每个作业运行的条件。默认情况下,如果作业不依赖于任何其他作业,或者如果所有 它所依赖的作业已完成并成功。你可以 通过强制作业运行来自定义此行为,即使之前的作业也是如此 失败或通过指定自定义条件。

    您不必根据源路径运行作业。作为一种解决方法,您可以创建两个管道来分隔作业,并在触发器中确定哪个将在使用路径过滤器时运行:

    在“触发器”选项卡上,有一个选项可以指定要构建的项目的源路径。指定该源路径后,只有包含与包含/排除规则匹配的修改的提交才会触发构建。

    【讨论】:

      【解决方案2】:

      据我所知,这对于特定的工作来说是不可能的。文档只解释了如何为整个管道完成。

      此处以作业的语法为例,没有触发选项,您将不会在此处找到触发选项:

      - job: string  # name of the job, A-Z, a-z, 0-9, and underscore
        displayName: string  # friendly name to display in the UI
        dependsOn: string | [ string ]
        condition: string
        strategy:
          parallel: # parallel strategy
          matrix: # matrix strategy
          maxParallel: number # maximum number simultaneous matrix legs to run
          # note: `parallel` and `matrix` are mutually exclusive
          # you may specify one or the other; including both is an error
          # `maxParallel` is only valid with `matrix`
        continueOnError: boolean  # 'true' if future jobs should run even if this job fails; defaults to 'false'
        pool: pool # see pool schema
        workspace:
          clean: outputs | resources | all # what to clean up before the job runs
        container: containerReference # container to run this job inside
        timeoutInMinutes: number # how long to run the job before automatically cancelling
        cancelTimeoutInMinutes: number # how much time to give 'run always even if cancelled tasks' before killing them
        variables: { string: string } | [ variable | variableReference ] 
        steps: [ script | bash | pwsh | powershell | checkout | task | templateReference ]
        services: { string: string | container } # container resources to run as a service container
      

      这里是documentatiom 工作。

      【讨论】:

        【解决方案3】:

        我们有相同的场景,但我们不能使用单独的管道,因为 gatekeepers 必须为不同的管道(API、DB、UI 等)多次批准同一个版本。 )

        我们使用找到的解决方案解决了它here

        【讨论】:

          猜你喜欢
          • 2021-02-18
          • 1970-01-01
          • 1970-01-01
          • 2021-06-18
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-02-15
          • 1970-01-01
          相关资源
          最近更新 更多