|
Ran
|
Jobs
1
|
Files
224
|
Run time
1min
|
Badge
README BADGES
|
push
github
[8.x](backport #3143) cnvm: Delete old snapshots on startup (#3151) cnvm: Delete old snapshots on startup (#3143) ### Summary of your changes Change CNVM to add a background job cleaning up old snapshots. The logic here is: 1. Background routine is started. Since the amount of leftover snapshots can be quite high (e.g. 40k in our account), 3 cleanup workers are used 2. `IterOwnedSnapshots()` is called which goes over all snapshots, returning an iterator. Snapshots are selected if: 1. They are more than 48 hours old 2. They have a tag with key "Name" and value starting with "elastic-vulnerability" 3. They are "self-owned" 3. Cleanup returns. On context cancelled, no extra grace period is added so the process doesn't block restarts/shutdown. ### Screenshot/Data Deleted 1178 snapshots from `2025-03-25T16:17:08.384Z` to `2025-03-25T16:20:19.504Z` ### Related Issues Closes https://github.com/elastic/cloudbeat/issues/3105 Closes https://github.com/elastic/sdh-security-team/issues/1168 ### Checklist - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added the necessary README/documentation (if appropriate) #### Introducing a new rule? No (cherry picked from commit 8860b9d9c) Co-authored-by: Orestis Floros <orestis.floros@elastic.co>
96 of 101 new or added lines in 4 files covered. (95.05%)
9099 of 11969 relevant lines covered (76.02%)
16.19 hits per line
| Lines | Coverage | ∆ | File |
|---|---|---|---|
| 2 |
33.33 |
33.33% | internal/resources/providers/awslib/ec2/ebs_snapshot.go |
| 3 |
77.57 |
4.1% | internal/resources/providers/awslib/ec2/provider.go |
| ID | Job ID | Ran | Files | Coverage | |
|---|---|---|---|---|---|
| 1 | 14131670707.1 | 224 |
76.02 |
GitHub Action Run |
| Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
|---|