Search code examples
google-cloud-platformgoogle-cloud-storagegsutilgoogle-workflows

Can you run gsutil in Google Cloud Workflows?


Looking for an easy way to run gsutil command line arguments in Google Cloud Workflows.

The specific problem I'm trying to solve is dynamically remove all objects in a Cloud Storage Bucket so that the bucket can then be deleted. Trying to do this as part of a Workflows project. gsutil can remove files with this command gsutil rm -a gs://bucket/** and if I could run that in a Workflows step that would be great.


Solution

  • Cloud Workflow call only API. So, you have to call API, as gsutil do. I wrote an article to list all the file and to call a "compose" operation on the file. You can customize the code to call the delete API


    If you really want to use GSUTIL, you can use Cloud Run Job for instance. And execute it with an API call with Workflows