Reputation: 8824
- 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?
Upvotes: 0
Views: 799
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