我的构建触发器无法识别 glob 模式

问题描述

我的主目录中有两个文件夹,cloud_functions 和 cloudbuild:

├── cloud_functions
│   ├── batch_predict
│   │   ├── config.py
│       ├── main.py
│       ├── requirements.txt
│       └── utils.py
├── cloudbuild
│   ├── batch_predict_cloud_function
│   │   ├── config.yaml
│   │   ├── create_triggers.sh

在 Cloud 构建触发器中,我将 glob 模式指定为:

  • cloud_functions/batch_predict/**
  • cloudbuild/batch_predict_cloud_function/**

这是通过创建触发器的 gcloud 命令中的以下标志实现的:

--included-files="cloud_functions/batch_predict/**,cloudbuild/batch_predict_cloud_function/**" \

我验证了 glob 已在 UI 中注册,但 cloudbuild 文件夹中的更改不会触发构建,您知道为什么会发生这种情况吗?

解决方法

要在 gcloud 命令中指定多个 glob 模式,您必须使用以下语法将多个参数传递给 --included-files 选项:

--included-files "cloud_functions/batch_predict/**","cloudbuild/batch_predict_cloud_function/**"