简体   繁体   English

您可以从 azure 管道构建 yml 中执行另一个构建 yml 吗?

[英]Can you execute another build yml from inside a azure pipeline build yml?

We would like to make our azure pipeline build.ymls modular.我们想让我们的 azure 管道 build.ymls 模块化。 For a full application build will include build.ymls for different components into a main.yml that will build them all together.对于完整的应用程序构建,会将不同组件的 build.ymls 包含在 main.yml 中,然后将它们一起构建。 For the components individually we will just call the single.yml to build that component.对于单独的组件,我们将只调用 single.yml 来构建该组件。 Can another build.yml be executed from within a build.yml?可以从 build.yml 中执行另一个 build.yml 吗?

Looks like we can use ymls modularly with template references .看起来我们可以通过模板引用模块化地使用 ymls 。

Yes you can.是的你可以。 Here is an example of how to do this with a predefined node template mixed with an inline yarn installer:这是一个如何使用预定义节点模板与内联纱线安装程序混合的示例:

- job: Build
  steps:
  - template: ../Tasks/node.yml

  - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
    displayName: 'use yarn 1.x'

    inputs:
      checkLatest: true

  - template: ../Tasks/yarn.yml
    parameters:
      projectDirectory: '$(Build.SourcesDirectory)'

node.yml:节点.yml:

steps:
- task: NodeTool@0
  displayName: 'Use Node 10.x'
  inputs:
    versionSpec: 10.x

yarn.yml:纱线.yml:

parameters:
- name: projectDirectory
  type: string
- name: arguments
  type: string
  default: 'install'

steps:
  - task: geeklearningio.gl-vsts-tasks-yarn.yarn-task.Yarn@2
    displayName: 'yarn ${{ parameters.arguments }} ${{ parameters.projectDirectory }}'

    inputs:
      ProjectDirectory: '${{ parameters.projectDirectory }}'
      Arguments: ${{ parameters.arguments }}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM