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

Use the Image Digest to save it in a Registry #251

Closed
Closed
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
9eb407f
index: add Image Index interface
husni-faiz Apr 3, 2023
816341c
remote: index: function to create new index
husni-faiz Apr 3, 2023
fefd9bc
bugfix: index: Remove mutating media type to DockerManifestList
husni-faiz Apr 9, 2023
05456ff
index: optimize: get image from descriptor
husni-faiz Apr 9, 2023
13989a3
index: check for image architecture
husni-faiz Apr 9, 2023
dc5c024
index: add default path to Save()
husni-faiz Apr 9, 2023
02d354b
index: add keychain to new index
husni-faiz Apr 9, 2023
db82b69
index: add image index types
husni-faiz Apr 9, 2023
cdb04c9
indexOptions for creating image index
husni-faiz Apr 9, 2023
d87b7d1
index: path and mediatype options for creating index
husni-faiz Apr 9, 2023
7842116
index: add remove index method
husni-faiz Apr 9, 2023
390546a
remote: index: remove path option
husni-faiz Apr 25, 2023
aa43a59
remote: index: user docker mediatype by default
husni-faiz Apr 25, 2023
21a4790
remote: index: remove saving to layout
husni-faiz Apr 25, 2023
74f8e44
remote: index: save index to registry
husni-faiz Apr 25, 2023
d91432c
index: local: annotate and add functionality
husni-faiz May 2, 2023
bccd2af
remote/index: return error instead of calling panic
husni-faiz May 7, 2023
e24cebc
remote/index: return a wrapped error if fetcing an image fails
husni-faiz May 7, 2023
c17b6d9
local/index: return error instead of calling panic
husni-faiz May 7, 2023
add9675
remote/new_index: validate index name
husni-faiz May 7, 2023
db2e406
local/index: refactor interface functions to use the index path
husni-faiz May 8, 2023
3464e40
local/index_options: create new index with IndexManifest
husni-faiz May 8, 2023
08653dd
remote/index_options: create new index with IndexManifest
husni-faiz May 8, 2023
c941979
remote/new_index: rename file
husni-faiz May 8, 2023
9d284ea
get IndexManifest from ggcr index
husni-faiz May 15, 2023
2752977
remote/index/save: return error if platform information is missing
husni-faiz May 17, 2023
a4589d4
remote/index: ImageIndexTest to be used in unit tests
husni-faiz May 17, 2023
8c5d049
remote/index_test: setup a registry for test
husni-faiz May 17, 2023
4f9c64b
remote/index_test: basic tests for remote index
husni-faiz May 17, 2023
85b8899
remote/new_index: NewIndexTest function to create a test index
husni-faiz May 17, 2023
6a0c434
remote/new_index: use index in registry if already exists
husni-faiz May 17, 2023
8653514
remote/index: remove ManifestSize unused function
husni-faiz May 20, 2023
93861df
index: add brief comments to all index functions
husni-faiz May 21, 2023
afaa657
index: remove returning error when platform information is missing
husni-faiz May 21, 2023
2f6f5c9
local/index: remove AppendManifet wrapper function
husni-faiz May 21, 2023
d558685
local/index: save indent formatted json output
husni-faiz May 26, 2023
adae788
local/index save: use os module instead of layout package
husni-faiz May 27, 2023
7e6c885
local/index: delete method to remove index from local storage
husni-faiz May 27, 2023
54343a5
local/index: wrap GetIndexManifest errors
husni-faiz May 28, 2023
191f664
new_index: check for local index first
husni-faiz Jun 1, 2023
fcb5ade
local/index: copy referenced images to same registry as index
husni-faiz Jun 1, 2023
51609ae
index: fix github action tests failing
husni-faiz Jun 1, 2023
818f3a2
fix linter error: io/ioutil deprecated
husni-faiz Nov 20, 2023
8fdc89d
Merge branch 'main' into dev-image-index
husni-faiz Nov 25, 2023
8656617
Merge branch 'main' into dev-image-index
jjbustamante Feb 13, 2024
64e6aff
Implementing some options to save an image by digest, this helps me w…
jjbustamante Mar 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
index: add default path to Save()
Signed-off-by: Husni Faiz <[email protected]>
husni-faiz committed Nov 25, 2023

Verified

This commit was signed with the committer’s verified signature.
ImgBotApp Imgbot
commit dc5c02451f5cfd1cea700d12287ea69380820609
5 changes: 3 additions & 2 deletions remote/index.go
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ type ImageIndex struct {
keychain authn.Keychain
repoName string
index v1.ImageIndex
path string
}

func (i *ImageIndex) Add(repoName string) error {
@@ -62,9 +63,9 @@ func (i *ImageIndex) Add(repoName string) error {

// func (i *ImageIndex) Remove(repoName string) error

func (i *ImageIndex) Save(path string) error {
func (i *ImageIndex) Save() error {
// write the index on disk, for example
layout.Write(path, i.index)
layout.Write(i.path, i.index)

return nil
}
3 changes: 3 additions & 0 deletions remote/new_manifest_list.go
Original file line number Diff line number Diff line change
@@ -11,6 +11,8 @@ func NewIndex(repoName string, ops ...ImageOption) (*ImageIndex, error) {

mediaType := defaultMediaType()

path := "./layout/"

index, err := emptyIndex(mediaType)
if err != nil {
return nil, err
@@ -19,6 +21,7 @@ func NewIndex(repoName string, ops ...ImageOption) (*ImageIndex, error) {
ridx := &ImageIndex{
repoName: repoName,
index: index,
path: path,
}

return ridx, nil