CloudBuild Composer 配置没有变化。必须指定对 configuration.software_configuration.pypi_dependencies 的更改

CloudBuild Composer No change in configuration. Must specify a change to configuration.software_configuration.pypi_dependencies

  1. 如果 requirements.txt 有任何更新,我正在使用 CloudBuild 更新 Composer 环境。我的 cloudbuild.yaml 看起来像
- name: 'gcr.io/cloud-builders/gcloud'
  args: ["composer", "environments", "update",'$_COMPOSER_NAME', "--location" , "$_COMPOSER_REGION","--update-pypi-packages-from-file", "$_DAG_FOLDER/requirements.txt"]
  id: 'update-composer-env'
  timeout: 3600s

但是,如果 requirements.txt 中没有任何变化,cloudbuild 将失败并出现以下错误

ERROR: (gcloud.composer.environments.update) INVALID_ARGUMENT: No change in configuration. Must specify a change to configuration.software_configuration.pypi_dependencies

如何让构建不失败?

  1. 即使构建成功,我在 cloudbuild 日志中也看不到任何内容,我该如何解决?

这个有效

- name: 'gcr.io/cloud-builders/gcloud'
  entrypoint: 'bash'
  args:
    - '-c'
    - |
      custom_comm=$(gcloud composer environments update $_COMPOSER_NAME --update-pypi-packages-from-file $_DAG_FOLDER/requirements.txt --location $_COMPOSER_REGION --verbosity=debug 2>&1); \
      echo "$custom_comm"; \
      if [[ "$custom_comm" == *"ERROR: (gcloud.composer.environments.update) INVALID_ARGUMENT: No change in configuration. Must specify a change to configuration.software_configuration.pypi_dependencies"* ]]; then \
        echo "This failure is expected if there is no change to requirements.txt"; exit 0; \ 
      else exit 1; \
      fi
  id: 'update-composer-env'
  timeout: 3600s