我可以在CloudBuild.yaml中定义步骤的组合吗?

发布于 2025-01-31 04:43:30 字数 949 浏览 7 评论 0 原文

在github工作流程中,我可以定义策略键,并通过矩阵的所有组合循环。这是node.js应用程序的CI管道的示例。

name: CI

on:
  pull_request:

jobs:
  test:
    strategy:
      matrix:
        node: [16, 14]
        os: [ubuntu-latest, macos-latest, windows-latest]

    runs-on: ${{ matrix.os }}
    name: Test node@${{ matrix.node }} on ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node }}
      - run: npm ci
      - run: npm test

我可以在 cloudBuild.yaml 文件中实现同一件事吗?在文档中,我还没有在有关

我想我可以使用并多次调用相同的云构建配置文件,每次通过不同的替换...但是我想知道这是否是唯一可能的方法。我宁愿在该单个 CloudBuild.yaml 中定义所有配置。

In a GitHub Workflow I can define a strategy key and loop through all combinations of a matrix. Here is an example for a CI pipeline of a Node.js app.

name: CI

on:
  pull_request:

jobs:
  test:
    strategy:
      matrix:
        node: [16, 14]
        os: [ubuntu-latest, macos-latest, windows-latest]

    runs-on: ${{ matrix.os }}
    name: Test node@${{ matrix.node }} on ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node }}
      - run: npm ci
      - run: npm test

Can I achieve the same thing in a cloudbuild.yaml file? I haven't found any mention of this looping functionality in the documentation regarding the Build configuration file schema.

I guess I could achieve what I want using user-defined substitutions and calling the same Cloud Build config file multiple times, passing different substitutions each time... but I was wondering if this is the only possible approach. I would rather have all configuration defined in that single cloudbuild.yaml.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文