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

chore: Nuke stale objects #2869

Merged
merged 4 commits into from
Jun 17, 2024
Merged

chore: Nuke stale objects #2869

merged 4 commits into from
Jun 17, 2024

Conversation

sfc-gh-asawicki
Copy link
Collaborator

Cleaning old test objects (warehouses and databases for now)

@sfc-gh-asawicki sfc-gh-asawicki marked this pull request as ready for review June 13, 2024 11:46
Copy link

Integration tests failure for e42890bfcc9beba3b3904ccd6e94681e139cdbab

Makefile Outdated Show resolved Hide resolved
Copy link

Integration tests success for 9ed1517fd13f264ff5d94154191f891ac2a5f0fd

log.Printf("[DEBUG] Found %d databases matching search criteria\n", len(dbs))
for idx, db := range dbs {
log.Printf("[DEBUG] Processing database [%d/%d]: %s...\n", idx+1, len(dbs), db.ID().FullyQualifiedName())
if db.Name != "SNOWFLAKE" && db.CreatedOn.Before(time.Now().Add(-4*time.Hour)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: max age of objects can be configurable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add to SNOW-955520.

if db.Name != "SNOWFLAKE" && db.CreatedOn.Before(time.Now().Add(-4*time.Hour)) {
log.Printf("[DEBUG] Dropping database %s, created at: %s\n", db.ID().FullyQualifiedName(), db.CreatedOn.String())
if err := client.Databases.Drop(ctx, db.ID(), &DropDatabaseOptions{IfExists: Bool(true)}); err != nil {
return fmt.Errorf("sweeping database %s ended with error, err = %w", db.ID().FullyQualifiedName(), err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question: did you consider just logging an error instead of early return? I think we could at least try removing other objects.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, getting an error here means that something is f***ed up (e.g. with connection) because removal with if exists should succeed no matter what. That's why early return here is IMO more accurate.

@sfc-gh-asawicki sfc-gh-asawicki merged commit 9c4a117 into main Jun 17, 2024
9 checks passed
@sfc-gh-asawicki sfc-gh-asawicki deleted the nuke-stale-objects branch June 17, 2024 09:08
sfc-gh-jcieslak pushed a commit that referenced this pull request Jul 10, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.93.0](v0.92.0...v0.93.0)
(2024-07-10)


### 🎉 **What's new:**

* Add OAUTH integration for custom clients
([#2908](#2908))
([d9b557f](d9b557f))
* Add oauth integration for partner applications
([#2912](#2912))
([91788e5](91788e5))
* Add support for cortex search service
([#2860](#2860))
([43aa89f](43aa89f))
* API Authentication integration v1 readiness
([#2898](#2898))
([91931da](91931da))
* External Oauth integration v1 readiness
([#2907](#2907))
([ed237c3](ed237c3))
* Generate show outputs with mappers
([#2886](#2886))
([1cada88](1cada88))
* Introduce security integrations datasource
([#2892](#2892))
([7f6c657](7f6c657))
* SAML2 integration v1 readiness
([#2868](#2868))
([d0c136d](d0c136d))
* SCIM integration v1 readiness
([#2846](#2846))
([269df6b](269df6b))
* Security integrations datasource v1 readiness
([#2913](#2913))
([d10474a](d10474a))
* standard database v1 readiness
([#2842](#2842))
([3c11953](3c11953))
* Warehouse redesign final touches
([#2900](#2900))
([0eab636](0eab636))
* Warehouse redesign part1
([#2864](#2864))
([6664457](6664457))
* Warehouse redesign part2
([#2887](#2887))
([1aaf417](1aaf417))
* Warehouse redesign part3
([#2890](#2890))
([873a1ed](873a1ed))
* Warehouse redesign part4
([#2893](#2893))
([d525fd9](d525fd9))


### 🔧 **Misc**

* Add documentation on unset and defaults
([#2882](#2882))
([85a7836](85a7836))
* apply minor database changes
([#2872](#2872))
([6ccac59](6ccac59))
* Apply new resource conventions to scim integration
([#2891](#2891))
([e11e608](e11e608))
* Improve generator template organization
([#2820](#2820))
([5035e2f](5035e2f))
* Nuke stale objects
([#2869](#2869))
([9c4a117](9c4a117))
* Show a possible solution for
[#2877](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/2877)
([#2878](#2878))
([6fb437b](6fb437b))
* Validations cleanup and old grants removal
([#2884](#2884))
([05b7eee](05b7eee))


### 🐛 **Bug fixes:**

* Add disclaimers and fix tests
([#2905](#2905))
([1deaedc](1deaedc))
* Fix cortex search service
([#2904](#2904))
([763d06c](763d06c))
* use suppressQuoting to fix stage file_format permadiff
([#2885](#2885))
([fd70f6e](fd70f6e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: snowflake-release-please[bot] <105954990+snowflake-release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants