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

generate: add oci-version option #681

Merged
merged 1 commit into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions cmd/oci-runtime-tool/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ var generateFlags = []cli.Flag{
cli.StringSliceFlag{Name: "mounts-add", Usage: "configures additional mounts inside container"},
cli.StringSliceFlag{Name: "mounts-remove", Usage: "remove destination mountpoints from inside container"},
cli.BoolFlag{Name: "mounts-remove-all", Usage: "remove all mounts inside container"},
cli.StringFlag{Name: "oci-version", Usage: "specify the version of the Open Container Initiative runtime specification"},
cli.StringFlag{Name: "os", Value: runtime.GOOS, Usage: "operating system the container is created for"},
cli.StringFlag{Name: "output", Usage: "output file (defaults to stdout)"},
cli.BoolFlag{Name: "privileged", Usage: "enable privileged container settings"},
Expand Down Expand Up @@ -203,6 +204,10 @@ func setupSpec(g *generate.Generator, context *cli.Context) error {
g.SetHostname(context.String("hostname"))
}

if context.IsSet("oci-version") {
g.SetOCIVersion(context.String("oci-version"))
}

if context.IsSet("label") {
annotations := context.StringSlice("label")
for _, s := range annotations {
Expand Down
1 change: 1 addition & 0 deletions completions/bash/oci-runtime-tool
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ _oci-runtime-tool_generate() {
--linux-uidmappings
--mounts-add
--mounts-remove
--oci-version
--os
--output
--process-cap-add
Expand Down
6 changes: 6 additions & 0 deletions generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,12 @@ func (g *Generator) SetHostname(s string) {
g.Config.Hostname = s
}

// SetOCIVersion sets g.Config.Version.
func (g *Generator) SetOCIVersion(s string) {
g.initConfig()
g.Config.Version = s
}

// ClearAnnotations clears g.Config.Annotations.
func (g *Generator) ClearAnnotations() {
if g.Config == nil {
Expand Down
3 changes: 3 additions & 0 deletions man/oci-runtime-tool-generate.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ read the configuration from `config.json`.
Remove all mounts inside the container. The default is *false*.
When specified with --mount-add, this option will be parsed first.

**--oci-version**=""
Set the version of the Open Container Initiative runtime specification.

**--os**=OS
Operating system used within the container.

Expand Down