-
Notifications
You must be signed in to change notification settings - Fork 82
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
Increase the generate function #101
base: master
Are you sure you want to change the base?
Conversation
This is my initial idea, I will continue to improve the PR, such as documentation, other types of creation, etc. |
be3d2ac
to
58f765f
Compare
image/image.go
Outdated
manifest: manifestStr, | ||
config: configStr, | ||
tarList: []tarContent{ | ||
tarContent{&tar.Header{Name: "example", Size: 7, Mode: 0600}, []byte("example")}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want to hard-code any tar content for this command.
Also, I think we want to give users a way to pick different image-layout backends (e.g. tar-backed image-layouts, directory-backed image-layouts, …). For example, the oci-image-init
I've floated in #5 takes a --type
option.
1dc1828
to
2739a20
Compare
8ec02ed
to
d217b34
Compare
ping @xiekeyang @coolljt0725 @stevvooe @vbatts @jonboulle PTAL ,thanks. |
d217b34
to
a658211
Compare
Makefile
Outdated
@@ -7,8 +7,8 @@ EPOCH_TEST_COMMIT ?= v0.2.0 | |||
TOOLS := \ | |||
oci-create-runtime-bundle \ | |||
oci-image-validate \ | |||
oci-unpack | |||
MAN := $(TOOLS:%=%.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably don't want to remove this line ;).
.gitignore
Outdated
@@ -1,3 +1,4 @@ | |||
/oci-create-runtime-bundle | |||
/oci-unpack | |||
/oci-image-validate | |||
/oci-generate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current position of oci-unpack
is unfortunate, but I think we should alphabetize these entries (and the entries in the Makefile's TOOLS
).
image/image.go
Outdated
return Compress(dest) | ||
} | ||
|
||
//GenerateLayout create an imageLayou that conforms to the OCI specification on a given path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“Layou” → “Layout”. And do you have any plans to provide a way to generate a tar-backed image layout? I think we want to support that.
|
||
//Compress use gzip to compress tar.gz | ||
func Compress(src string) error { | ||
d, err := os.Create(src + ".tar") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A function that compresses an on-disk directory into an on-disk file (I don't actually see any code in here about compressing with gzip) doesn't seem like the friendliest public API. And you don't seem to be using this function anywhere. So I suspect you should drop Compress
and compress
from this PR.
return desc, nil | ||
} | ||
|
||
func createTarBlob(name string, list []tarContent) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm holding out hope that #8 or something like that lands. Until we get a public API for creating layers, I'd rather not drag createTarBlob
out of image_test.go
.
return err | ||
} | ||
|
||
// create image layer blob file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer this function be public, create whatever boilerplate the spec requires image layouts to have, and then stop. Filling in example layers, JSON blobs, and refs isn't useful (we can always distribute the example image directly if that content is useful). What I think users want (among other things) is a tool to create a new, empty image layout so they can start populating it with their content. And that's what #5's oci-image-init image-layout …
, CreateDir
, and CreateTarFile
are doing.
a658211
to
59ec62f
Compare
Signed-off-by: zhouhao <[email protected]>
f6b4742
to
68112d9
Compare
Increase the generate function,you can create an OCI-compliant imageLayout based on the address you enter.Now just create the imageLayout, after the completion of the code can also create other types (I do not know if these are not necessary).
Signed-off-by: zhouhao [email protected]