kk1957
kk1957

Reputation: 8824

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

  1. I am using CloudBuild to update the Composer environment if there is any update to requirements.txt. My cloudbuild.yaml looks like
- 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

However, if there is no change in the requirements.txt, the cloudbuild fails with the following error

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

How can I make the build not fail?

  1. Even if the build is successful, I do not see anything in the cloudbuild logs, how can I fix that?

Upvotes: 0

Views: 799

Answers (1)

kk1957
kk1957

Reputation: 8824

This works

- 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

Upvotes: 1

Related Questions