Skip to content

feat(store): add bucket lifecycle support#847

Open
mping-exo wants to merge 5 commits into
masterfrom
sc-184182/bucket-lifecycle
Open

feat(store): add bucket lifecycle support#847
mping-exo wants to merge 5 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 2 times, most recently 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.

Comment thread pkg/storage/sos/lifecycle.go
Comment thread tests/integ/with-api/lifecycle_test.go
@natalie-o-perret natalie-o-perret requested a review from a team June 26, 2026 16:38
@mping-exo mping-exo marked this pull request as ready for review June 29, 2026 13:22
@mping-exo mping-exo force-pushed the sc-184182/bucket-lifecycle branch from f790f58 to 5ced9eb Compare June 29, 2026 13:23
@pierre-emmanuelJ pierre-emmanuelJ self-requested a review June 29, 2026 15:32
@mping-exo mping-exo force-pushed the sc-184182/bucket-lifecycle branch from 5ced9eb to 2fb2f45 Compare June 30, 2026 10:51

@natalie-o-perret natalie-o-perret left a comment

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.

The nit test can be done later in a follow-up pr, not blocking.

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