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

feat(oci): add new package with store implementation #2332

Merged
merged 6 commits into from
Nov 3, 2023

Conversation

GeorgeMac
Copy link
Contributor

Supports #2296
Fixes FLI-660

This adds a new package oci with a single type Store.
The store manages reading from the new Flipt bundle OCI format.
It will be consumed by the new oci.Source type in a subsequent PR.

It supports fetching with an optional IfNoMatch digest.
The source will provide the previously observed digest between subsequent fetches.
Then it will skip producing a new snapshot when Matched == true as this means the reference hasn't changed contents target. It does so even in the face of created at timestamp change. It purely focusses on the contents state.

@GeorgeMac GeorgeMac requested a review from a team as a code owner November 3, 2023 11:39
Copy link
Contributor

github-actions bot commented Nov 3, 2023

Uffizzi Ephemeral Environment deployment-40049

☁️ https://app.uffizzi.com/github.com/flipt-io/flipt/pull/2332

📄 View Application Logs etc.

⏰ This Preview will be destroyed in 1 hours at: Fri Nov 3 15:52:49 UTC 2023

What is Uffizzi? Learn more!

Copy link

codecov bot commented Nov 3, 2023

Codecov Report

Merging #2332 (3e248ef) into gm/fs-oci (563a8c4) will decrease coverage by 0.12%.
The diff coverage is 65.60%.

@@              Coverage Diff              @@
##           gm/fs-oci    #2332      +/-   ##
=============================================
- Coverage      70.94%   70.83%   -0.12%     
=============================================
  Files             78       79       +1     
  Lines           7456     7613     +157     
=============================================
+ Hits            5290     5393     +103     
- Misses          1865     1906      +41     
- Partials         301      314      +13     
Files Coverage Δ
internal/config/config.go 86.74% <50.00%> (-0.65%) ⬇️
internal/config/storage.go 82.56% <40.00%> (-4.30%) ⬇️
internal/oci/file.go 68.08% <68.08%> (ø)

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

Copy link
Collaborator

@markphelps markphelps left a comment

Choose a reason for hiding this comment

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

wicket wicked 🧙🏻‍♀️

return fmt.Errorf("getting user state dir: %w", err)
}

imageDir := filepath.Join(configDir, "flipt", "bundles")
Copy link
Collaborator

Choose a reason for hiding this comment

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

i wonder if we should have a helper func that we use to get the flipt state dir, since we do it here now and i think in a couple other places

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just pushed a commit for this. See what you think.


if mediaType != MediaTypeFliptNamespace {
return nil, fmt.Errorf("layer %q: type %q: %w", layer.Digest, mediaType, ErrUnexpectedMediaType)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm when would this line happen? This is if they were to point towards an image that isnt flipt related I guess?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would be if the OCI image was malformed. Someone had written a layer in that we dont currently expect.
We're only going to support this kind of layer for now in an OCI artifact.

Copy link
Collaborator

@markphelps markphelps left a comment

Choose a reason for hiding this comment

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

nice!

@GeorgeMac GeorgeMac merged commit 6fd0f9e into gm/fs-oci Nov 3, 2023
25 of 27 checks passed
@GeorgeMac GeorgeMac deleted the gm/fs-oci-store branch November 3, 2023 17:48
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