Skip to content

Commit

Permalink
Introduce podman machine os commands
Browse files Browse the repository at this point in the history
Introduce machine os and machine os apply. Note that these are both stubs at the current moment, and do not introduce functionality. In order to build them, you must use the `experimental` build tag, or use `make podman-remote-experimental`

[NO NEW TESTS NEEDED]
as there is no actual functionality and this is a WIP.

Signed-off-by: Ashley Cui <[email protected]>
  • Loading branch information
ashley-cui committed Nov 28, 2022
1 parent 34cc61d commit 96c208e
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,15 @@ bin/rootlessport: $(SOURCES) go.mod go.sum
.PHONY: rootlessport
rootlessport: bin/rootlessport

.PHONY: podman-remote-experimental
podman-remote-experimental: $(SRCBINDIR)/experimental/podman$(BINSFX)
$(SRCBINDIR)/experimental/podman$(BINSFX): $(SOURCES) go.mod go.sum | $(SRCBINDIR)
$(GOCMD) build \
$(BUILDFLAGS) \
$(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' \
-tags "${REMOTETAGS} experimental" \
-o $@ ./cmd/podman

###
### Secondary binary-build targets
###
Expand Down
28 changes: 28 additions & 0 deletions cmd/podman/machine/os.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//go:build (amd64 || arm64) && experimental
// +build amd64 arm64
// +build experimental

package machine

import (
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/cmd/podman/validate"
"github.com/spf13/cobra"
)

var (
OSCmd = &cobra.Command{
Use: "os",
Short: "Manage a virtual machine's os",
Long: "Manage a virtual machine's operating system",
PersistentPreRunE: validate.NoOp,
RunE: validate.SubCommandExists,
}
)

func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Command: OSCmd,
Parent: machineCmd,
})
}
38 changes: 38 additions & 0 deletions cmd/podman/machine/os/apply.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//go:build (amd64 || arm64) && experimental
// +build amd64 arm64
// +build experimental

package machineos

import (
"fmt"

"github.com/containers/podman/v4/cmd/podman/machine"
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/cmd/podman/validate"
"github.com/spf13/cobra"
)

var (
applyCmd = &cobra.Command{
Use: "apply",
Short: "Apply OCI image to existing VM",
Long: "Apply custom layers from a containerized Fedora CoreOS image on top of an existing VM",
PersistentPreRunE: validate.NoOp,
RunE: apply,
Example: `podman machine os apply myimage`,
}
)

func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Command: applyCmd,
Parent: machine.OSCmd,
})

}

func apply(cmd *cobra.Command, args []string) error {
fmt.Println("Applying..")
return nil
}
8 changes: 8 additions & 0 deletions cmd/podman/main_experimental.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build experimental
// +build experimental

package main

import (
_ "github.com/containers/podman/v4/cmd/podman/machine/os"
)

0 comments on commit 96c208e

Please sign in to comment.