如何在 Cloud Build 的一个构建步骤中 运行 多个 dotnet 命令?

How to run multiple dotnet command within one build step in Cloud Build?

我正在尝试使用 Cloud Build 构建我的 .net 核心项目。解决方案中存在一些测试项目,我想 运行 在构建步骤中进行测试。在 cloudbuild.yaml 文件中,我尝试这样做,但 Cloud Build 似乎不喜欢它:

- name: "gcr.io/cloud-builders/dotnet"
  entrypoint: "dotnet"
  args:
    - |
        test --no-build -c ${_BUILD_CONFIG} $REPO_NAME.Tests
        test --no-build -c ${_BUILD_CONFIG} $REPO_NAME.Common.Tests

所以我想知道如何在一个构建步骤中组合多个 dotnet 命令?

- name: "gcr.io/cloud-builders/dotnet"
  entrypoint: 'bash'
  args:
    - '-c'
    - |
        dotnet test --no-build -c ${_BUILD_CONFIG} $REPO_NAME.Tests
        dotnet test --no-build -c ${_BUILD_CONFIG} $REPO_NAME.Common.Tests

试试这个