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

Preview Envs on Harvester: Delete when inactive #10379

Merged
merged 1 commit into from
Jun 1, 2022
Merged

Conversation

vulkoingim
Copy link
Contributor

@vulkoingim vulkoingim commented May 31, 2022

Description

  • Add a check for DB activity for preview environments running on Harvester
  • Clean up things a bit (or try to)
  • Flip the logic from is-inactive -> is-active, as double negatives make for a confusing experience (CHECKING_FOR_NO_DB_ACTIVITY, isInactive = false = actually active env, etc)

Related Issue(s)

Fixes #9891

How to test

werft run github -j .werft/platform-delete-preview-environments-cron.yaml

Following is a platform-delete-preview-environments job (no preview environments were harmed, as all are returned as active on that run)

https://werft.gitpod-dev.com/job/gitpod-custom-aa-del-harvester.28

Release Notes

NONE

@vulkoingim vulkoingim changed the title Check for db activity in harvester preview environments Preview Envs on Harvester: Delete when inactive May 31, 2022
Comment on lines 475 to 479
Object.entries(result).forEach(([key]) => logLine+=` ${key}:${result[key]},`);
logLine = logLine.slice(0, -1);

werft.log(sliceID, `${previewEnvironment.name} (${previewEnvironment.namespace}) - is-active=${isActive} ${logLine}`)
Copy link
Contributor Author

@vulkoingim vulkoingim May 31, 2022

Choose a reason for hiding this comment

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

Not a fan of logging here, but it does make things cleaner

@vulkoingim vulkoingim force-pushed the aa/del-harvester branch 2 times, most recently from 6327cb2 to db7a143 Compare June 1, 2022 09:52
@vulkoingim vulkoingim marked this pull request as ready for review June 1, 2022 09:52
@vulkoingim vulkoingim requested a review from a team June 1, 2022 09:52
Copy link
Contributor

@mads-hartmann mads-hartmann left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, and I agree that removing the double negative is a nice improvement. I have left a few suggestions for improvements, but they can be done in a follow up PR if you prefer (I have added the hold label, so you can just remove it if you want to merge this and open a new PR).

This does not solve all of #9891 yet though, as currently we'd still delete the preview environment if e.g. the branch was missing or stale (it was mentioned as a comment on the issue). For that you'd need to modify the logic for previewsToDelete ☺️

@vulkoingim vulkoingim force-pushed the aa/del-harvester branch 3 times, most recently from 213815b to 4c6227a Compare June 1, 2022 11:54
@vulkoingim vulkoingim requested a review from mads-hartmann June 1, 2022 11:59
Copy link
Contributor

@mads-hartmann mads-hartmann left a comment

Choose a reason for hiding this comment

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

One tiny boolean that I think you have to flip, but otherwise, LGTM ☺️

@roboquat roboquat merged commit c9e363c into main Jun 1, 2022
@roboquat roboquat deleted the aa/del-harvester branch June 1, 2022 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preview Envs on Harvester: Delete when inactive
3 participants