Skip to content

feat(store): add bucket lifecycle support#847

Draft
mping-exo wants to merge 4 commits into
masterfrom
sc-184182/bucket-lifecycle
Draft

feat(store): add bucket lifecycle support#847
mping-exo wants to merge 4 commits into
masterfrom
sc-184182/bucket-lifecycle

Conversation

@mping-exo

@mping-exo mping-exo commented Jun 19, 2026

Copy link
Copy Markdown

Description

  • Bump s3 dependency to fix some issues with serde (eg previous versions wouldn't serialize a field with false value because they were missing this old check vs new check
    • this caused alot of small changes, mostly some fields are now pointers and referencing code had to be updated
    • I reworked the PR into two commits, 1 with proper changes and another just for vendor changes"
  • Add bucket lifecycle commands to storage
    • set
    • show
    • delete

Checklist

(For exoscale contributors)

  • Changelog updated (under Unreleased block, and add the Pull Request #number for each bit you add to the CHANGELOG.md)
  • Testing

Testing

get/show/delete config


$ go run main.go -Approd -z ch-dk-2 storage bucket lifecycle set sos://miguel1 ../lifecycle-tests/aws2.json

$ go run main.go -Approd -z ch-dk-2 storage bucket lifecycle show sos://miguel1

┼──────────────────┼─────────────────────────────────────────────────────────────────────────────────┼
│ BUCKET LIFECYCLE │                                                                                 │
┼──────────────────┼─────────────────────────────────────────────────────────────────────────────────┼
│ Bucket           │ miguel1                                                                         │
│ Rules            │                                                                                 │
│                  │   ID                                      Expire-Objects-On-Specific-Date       │
│                  │   Status                                  Enabled                               │
│                  │   Filter (And) object-size-greater-than                                  1024   │
│                  │   Filter (And) object-size-less-than                            2048999999999   │
│                  │   Expiration date                         2025-12-31 00:00:00 +0000 UTC         │
│                  │   ID                                      Noncurrent-Version-Expiration-1-Day   │
│                  │   Status                                  Enabled                               │
│                  │   Noncurrent expiration days                                                1   │
│                  │   ID                                      Expire-Old-Delete-Markers             │
│                  │   Status                                  Enabled                               │
│                  │   Expire delete marker                    false                                 │
│                  │                                                                                 │
┼──────────────────┼─────────────────────────────────────────────────────────────────────────────────┼

$ go run main.go -Approd -z ch-dk-2 storage bucket lifecycle delete sos://miguel1

expiration header

┼───────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────┼
│    STORAGE    │                                                                                                               │
┼───────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────┼
│ Path          │ some-key                                                                                                      │
│ Bucket        │ miguel1                                                                                                       │
│ Last Modified │ 2025-04-18 15:21:50 UTC                                                                                       │
│ Size          │ 10 B                                                                                                          │
│ URL           │ https://sos-ch-dk-2.exo.io/miguel1/some-key                                                                   │
│ ACL           │                                                                                                               │
│               │   Read           -                                                                                            │
│               │   Write          -                                                                                            │
│               │   Read ACP       -                                                                                            │
│               │   Write ACP      -                                                                                            │
│               │   Full Control   49bda34b-82ac-4686-a5f9-7b542cbfc649                                                         │
│               │                                                                                                               │
│ Metadata      │                                                                                                               │
│ Headers       │                                                                                                               │
│               │   Content-Encoding                                                                                            │
│               │   Content-Type       application/octet-stream                                                                 │
│               │   Expires-At         expiry-date="Wed, 31 Dec 2025 00:00:00 GMT", rule-id="Expire-Objects-On-Specific-Date"   │
│               │                                                                                                               │
┼───────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────┼

@mping-exo mping-exo force-pushed the sc-184182/bucket-lifecycle branch from d0106d1 to 020c155 Compare June 22, 2026 13:57
@mping-exo mping-exo force-pushed the sc-184182/bucket-lifecycle branch from 020c155 to 1ff974f Compare June 22, 2026 13:58
@natalie-o-perret natalie-o-perret self-requested a review June 26, 2026 07:23
@pierre-emmanuelJ pierre-emmanuelJ requested a review from a team June 26, 2026 07:23
@natalie-o-perret

natalie-o-perret commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution, in grand scheme of things lgtm, I have one tiny issue with some enum handling in the default case, will leave a comment in the code directly.

I'm also wondering if the dep bump could have been separated from the feature, separate PRs.

case r.Filter.ObjectSizeLessThan != nil:
return &types.LifecycleRuleFilterMemberObjectSizeLessThan{Value: *r.Filter.ObjectSizeLessThan}
default:
return &types.LifecycleRuleFilterMemberPrefix{}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here we return &types.LifecycleRuleFilterMemberPrefix{} when none of the recognised fields are set.

This silently turns any rule with an unrecognised filter into an empty prefix filter rather than erroring.

We might want to add some signal, wdyt?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We test the happy path, but we might also want ToS3 => FromS3 round-trip test to catch silent field drops, default: case and any future divergence between the two.

@natalie-o-perret natalie-o-perret requested a review from a team June 26, 2026 16:38
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.

2 participants