Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCS DeleteBucket expects the bucket to be empty to be deleted #321

Open
shrutimantri opened this issue Jan 29, 2024 · 1 comment
Open

GCS DeleteBucket expects the bucket to be empty to be deleted #321

shrutimantri opened this issue Jan 29, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@shrutimantri
Copy link
Contributor

Expected Behavior

The given bucket should be deleted. We can provide an option to delete non-empty bucket, or explicitly mention that only empty buckets will be deleted.

Actual Behaviour

The non-empty bucket does not get deleted. The task fails with the following error:

2024-01-29 16:09:11.283Deleting bucket 'smantri-gcs-kestra-test-bucket'
2024-01-29 16:09:12.910The bucket you tried to delete is not empty.
2024-01-29 16:09:12.910409 Conflict
DELETE https://storage.googleapis.com/storage/v1/b/smantri-gcs-kestra-test-bucket
{
  "code" : 409,
  "errors" : [ {
    "domain" : "global",
    "message" : "The bucket you tried to delete is not empty.",
    "reason" : "conflict"
  } ],
  "message" : "The bucket you tried to delete is not empty."
}
2024-01-29 16:09:12.910com.google.cloud.storage.StorageException: The bucket you tried to delete is not empty.
	at com.google.cloud.storage.StorageException.translate(StorageException.java:165)
	at com.google.cloud.storage.spi.v1.HttpStorageRpc.translate(HttpStorageRpc.java:313)
	at com.google.cloud.storage.spi.v1.HttpStorageRpc.delete(HttpStorageRpc.java:642)
	at com.google.cloud.storage.StorageImpl.lambda$delete$14(StorageImpl.java:516)
	at com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:103)
	at com.google.cloud.RetryHelper.run(RetryHelper.java:76)
	at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:50)
	at com.google.cloud.storage.Retrying.run(Retrying.java:65)
	at com.google.cloud.storage.StorageImpl.run(StorageImpl.java:1515)
	at com.google.cloud.storage.StorageImpl.delete(StorageImpl.java:516)
	at io.kestra.plugin.gcp.gcs.DeleteBucket.run(DeleteBucket.java:54)
	at io.kestra.plugin.gcp.gcs.DeleteBucket.run(DeleteBucket.java:19)
	at io.kestra.core.runners.Worker$WorkerThread.run(Worker.java:684)
Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 409 Conflict
DELETE https://storage.googleapis.com/storage/v1/b/smantri-gcs-kestra-test-bucket
{
  "code" : 409,
  "errors" : [ {
    "domain" : "global",
    "message" : "The bucket you tried to delete is not empty.",
    "reason" : "conflict"
  } ],
  "message" : "The bucket you tried to delete is not empty."
}
	at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:146)
	at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:118)
	at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:37)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$3.interceptResponse(AbstractGoogleClientRequest.java:466)
	at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1111)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:552)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:493)
	at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:603)
	at com.google.cloud.storage.spi.v1.HttpStorageRpc.delete(HttpStorageRpc.java:638)
	... 10 more

Steps To Reproduce

in the DeleteBucket task, provide a non0-empty bucket to be deleted.

Environment Information

  • Kestra Version: 0.13.8
  • Plugin version: 0.13.8
  • Operating System (OS / Docker / Kubernetes): Docker
  • Java Version (If not docker):

Example flow

id: gcp-gcs-delete-bucket
namespace: company.team
tasks:
  - id: "delete"
    type: "io.kestra.plugin.gcp.gcs.DeleteBucket"
    serviceAccount: "{{ secret('GCP_SERVICE_ACCOUNT_JSON') }}"
    projectId: "<project-name>"
    name: "<bucket-name>"
@shrutimantri shrutimantri added the bug Something isn't working label Jan 29, 2024
@anna-geller
Copy link
Member

this seems expected, I know it from S3 that this is the default behavior

initially this seems safer than deleting a non empty bucket

we could introduce an option to force delete in the style of gsutil -m rm -r gs://my-bucket

@anna-geller anna-geller added this to the v0.20.0 milestone Jan 29, 2024
@github-project-automation github-project-automation bot moved this to Backlog in Issues Jun 10, 2024
@anna-geller anna-geller removed this from the v0.20.0 milestone Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

2 participants