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

Increase the generate function #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zhouhao3
Copy link

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]

@zhouhao3
Copy link
Author

This is my initial idea, I will continue to improve the PR, such as documentation, other types of creation, etc.

image/image.go Outdated
manifest: manifestStr,
config: configStr,
tarList: []tarContent{
tarContent{&tar.Header{Name: "example", Size: 7, Mode: 0600}, []byte("example")},
Copy link
Contributor

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.

@zhouhao3 zhouhao3 force-pushed the oci-generate branch 3 times, most recently from 1dc1828 to 2739a20 Compare December 29, 2016 02:50
@zhouhao3
Copy link
Author

@zhouhao3 zhouhao3 force-pushed the oci-generate branch 2 times, most recently from 8ec02ed to d217b34 Compare January 20, 2017 08:33
@zhouhao3
Copy link
Author

zhouhao3 commented Feb 3, 2017

ping @xiekeyang @coolljt0725 @stevvooe @vbatts @jonboulle PTAL ,thanks.

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)
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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")
Copy link
Contributor

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 {
Copy link
Contributor

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.
Copy link
Contributor

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.

@zhouhao3 zhouhao3 force-pushed the oci-generate branch 2 times, most recently from f6b4742 to 68112d9 Compare January 24, 2018 08:01
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