summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--cmd/podman/common/completion.go8
-rw-r--r--cmd/podman/machine/machine.go35
-rw-r--r--cmd/podman/machine/rm.go5
-rw-r--r--cmd/podman/machine/ssh.go5
-rw-r--r--cmd/podman/machine/start.go5
-rw-r--r--cmd/podman/machine/stop.go5
-rw-r--r--docs/source/image.rst2
-rw-r--r--docs/source/markdown/podman-machine-init.1.md7
-rw-r--r--pkg/api/handlers/compat/images_build.go1
-rw-r--r--pkg/bindings/test/containers_test.go9
-rw-r--r--pkg/machine/qemu/machine.go41
-rw-r--r--test/e2e/build_test.go17
13 files changed, 102 insertions, 44 deletions
diff --git a/Makefile b/Makefile
index 49250f2fd..705ac4ded 100644
--- a/Makefile
+++ b/Makefile
@@ -545,18 +545,22 @@ install.cni:
.PHONY: install.docker
install.docker:
+ install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(BINDIR)
install ${SELINUXOPT} -m 755 docker $(DESTDIR)$(BINDIR)/docker
install ${SELINUXOPT} -m 755 -d ${DESTDIR}${SYSTEMDDIR} ${DESTDIR}${USERSYSTEMDDIR} ${DESTDIR}${TMPFILESDIR}
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman-docker.conf -t ${DESTDIR}${TMPFILESDIR}
.PHONY: install.docker-docs-nobuild
install.docker-docs-nobuild:
- install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
+ install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(MANDIR)/man1
install ${SELINUXOPT} -m 644 docs/build/man/docker*.1 -t $(DESTDIR)$(MANDIR)/man1
.PHONY: install.docker-docs
install.docker-docs: docker-docs install.docker-docs-nobuild
+.PHONY: install.docker-full
+install.docker-full: install.docker install.docker-docs
+
.PHONY: install.systemd
ifneq (,$(findstring systemd,$(BUILDTAGS)))
install.systemd:
diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go
index 6bed5e0c6..bc106263c 100644
--- a/cmd/podman/common/completion.go
+++ b/cmd/podman/common/completion.go
@@ -1092,11 +1092,3 @@ func AutocompleteVolumeFilters(cmd *cobra.Command, args []string, toComplete str
}
return completeKeyValues(toComplete, kv)
}
-
-// AutocompleteMachineSSH - Autocomplete machine ssh command.
-func AutocompleteMachineSSH(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
- if len(args) == 0 {
- return nil, cobra.ShellCompDirectiveNoFileComp
- }
- return nil, cobra.ShellCompDirectiveDefault
-}
diff --git a/cmd/podman/machine/machine.go b/cmd/podman/machine/machine.go
index 9a2377d12..d8cdf5568 100644
--- a/cmd/podman/machine/machine.go
+++ b/cmd/podman/machine/machine.go
@@ -3,9 +3,13 @@
package machine
import (
+ "strings"
+
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
"github.com/containers/podman/v3/pkg/domain/entities"
+ "github.com/containers/podman/v3/pkg/machine"
+ "github.com/containers/podman/v3/pkg/machine/qemu"
"github.com/spf13/cobra"
)
@@ -30,3 +34,34 @@ func init() {
Command: machineCmd,
})
}
+
+// autocompleteMachineSSH - Autocomplete machine ssh command.
+func autocompleteMachineSSH(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
+ if len(args) == 0 {
+ return getMachines(toComplete)
+ }
+ return nil, cobra.ShellCompDirectiveDefault
+}
+
+// autocompleteMachine - Autocomplete machines.
+func autocompleteMachine(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
+ if len(args) == 0 {
+ return getMachines(toComplete)
+ }
+ return nil, cobra.ShellCompDirectiveNoFileComp
+}
+
+func getMachines(toComplete string) ([]string, cobra.ShellCompDirective) {
+ suggestions := []string{}
+ machines, err := qemu.List(machine.ListOptions{})
+ if err != nil {
+ cobra.CompErrorln(err.Error())
+ return nil, cobra.ShellCompDirectiveNoFileComp
+ }
+ for _, m := range machines {
+ if strings.HasPrefix(m.Name, toComplete) {
+ suggestions = append(suggestions, m.Name)
+ }
+ }
+ return suggestions, cobra.ShellCompDirectiveNoFileComp
+}
diff --git a/cmd/podman/machine/rm.go b/cmd/podman/machine/rm.go
index 002a793a3..e05b5f7a8 100644
--- a/cmd/podman/machine/rm.go
+++ b/cmd/podman/machine/rm.go
@@ -8,7 +8,6 @@ import (
"os"
"strings"
- "github.com/containers/common/pkg/completion"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
@@ -18,13 +17,13 @@ import (
var (
rmCmd = &cobra.Command{
- Use: "rm [options] [NAME]",
+ Use: "rm [options] [MACHINE]",
Short: "Remove an existing machine",
Long: "Remove an existing machine ",
RunE: rm,
Args: cobra.MaximumNArgs(1),
Example: `podman machine rm myvm`,
- ValidArgsFunction: completion.AutocompleteNone,
+ ValidArgsFunction: autocompleteMachine,
}
)
diff --git a/cmd/podman/machine/ssh.go b/cmd/podman/machine/ssh.go
index 586c4267d..aec68d2a4 100644
--- a/cmd/podman/machine/ssh.go
+++ b/cmd/podman/machine/ssh.go
@@ -3,7 +3,6 @@
package machine
import (
- "github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
@@ -14,7 +13,7 @@ import (
var (
sshCmd = &cobra.Command{
- Use: "ssh [options] [NAME] [COMMAND [ARG ...]]",
+ Use: "ssh [options] [MACHINE] [COMMAND [ARG ...]]",
Short: "SSH into a virtual machine",
Long: "SSH into a virtual machine ",
RunE: ssh,
@@ -22,7 +21,7 @@ var (
Example: `podman machine ssh myvm
podman machine ssh -e myvm echo hello`,
- ValidArgsFunction: common.AutocompleteMachineSSH,
+ ValidArgsFunction: autocompleteMachineSSH,
}
)
diff --git a/cmd/podman/machine/start.go b/cmd/podman/machine/start.go
index 40800160e..959fa21d2 100644
--- a/cmd/podman/machine/start.go
+++ b/cmd/podman/machine/start.go
@@ -3,7 +3,6 @@
package machine
import (
- "github.com/containers/common/pkg/completion"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
@@ -13,13 +12,13 @@ import (
var (
startCmd = &cobra.Command{
- Use: "start [NAME]",
+ Use: "start [MACHINE]",
Short: "Start an existing machine",
Long: "Start an existing machine ",
RunE: start,
Args: cobra.MaximumNArgs(1),
Example: `podman machine start myvm`,
- ValidArgsFunction: completion.AutocompleteNone,
+ ValidArgsFunction: autocompleteMachine,
}
)
diff --git a/cmd/podman/machine/stop.go b/cmd/podman/machine/stop.go
index 7d655f0ba..36b434d8e 100644
--- a/cmd/podman/machine/stop.go
+++ b/cmd/podman/machine/stop.go
@@ -3,7 +3,6 @@
package machine
import (
- "github.com/containers/common/pkg/completion"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/machine"
@@ -13,13 +12,13 @@ import (
var (
stopCmd = &cobra.Command{
- Use: "stop [NAME]",
+ Use: "stop [MACHINE]",
Short: "Stop an existing machine",
Long: "Stop an existing machine ",
RunE: stop,
Args: cobra.MaximumNArgs(1),
Example: `podman machine stop myvm`,
- ValidArgsFunction: completion.AutocompleteNone,
+ ValidArgsFunction: autocompleteMachine,
}
)
diff --git a/docs/source/image.rst b/docs/source/image.rst
index 2b0ef3d43..0552df929 100644
--- a/docs/source/image.rst
+++ b/docs/source/image.rst
@@ -40,6 +40,6 @@ Image
:doc:`trust <markdown/podman-image-trust.1>` Manage container image trust policy
-:doc:`unmount <markdown/podman-unmount.1>` Unmount an image's root filesystem
+:doc:`unmount <markdown/podman-image-unmount.1>` Unmount an image's root filesystem
:doc:`untag <markdown/podman-untag.1>` Removes one or more names from a locally-stored image
diff --git a/docs/source/markdown/podman-machine-init.1.md b/docs/source/markdown/podman-machine-init.1.md
index e2ed1eb10..930086ff4 100644
--- a/docs/source/markdown/podman-machine-init.1.md
+++ b/docs/source/markdown/podman-machine-init.1.md
@@ -28,7 +28,12 @@ Size of the disk for the guest VM in GB.
#### **\-\-ignition-path**
-Fully qualified path of the ignition file
+Fully qualified path of the ignition file.
+
+If an ignition file is provided, the file
+will be copied into the user's CONF_DIR and renamed. Additionally, no SSH keys will
+be generated nor will a system connection be made. It is assumed that the user will
+do these things manually or handle otherwise.
#### **\-\-image-path**
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go
index fd310711f..6dac789d6 100644
--- a/pkg/api/handlers/compat/images_build.go
+++ b/pkg/api/handlers/compat/images_build.go
@@ -349,6 +349,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
Jobs: &jobs,
Labels: labels,
Layers: query.Layers,
+ LogRusage: query.LogRusage,
Manifest: query.Manifest,
MaxPullPushRetries: 3,
NamespaceOptions: nsoptions,
diff --git a/pkg/bindings/test/containers_test.go b/pkg/bindings/test/containers_test.go
index cb9e0721b..4f049d18b 100644
--- a/pkg/bindings/test/containers_test.go
+++ b/pkg/bindings/test/containers_test.go
@@ -568,15 +568,6 @@ var _ = Describe("Podman containers ", func() {
Expect(err).To(BeNil())
Expect(len(reports.PruneReportsIds(pruneResponse))).To(Equal(0))
Expect(len(reports.PruneReportsErrs(pruneResponse))).To(Equal(0))
-
- // Valid filter params container should be pruned now.
- filters := map[string][]string{
- "until": {"0s"},
- }
- pruneResponse, err = containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filters))
- Expect(err).To(BeNil())
- Expect(len(reports.PruneReportsErrs(pruneResponse))).To(Equal(0))
- Expect(len(reports.PruneReportsIds(pruneResponse))).To(Equal(1))
})
It("podman prune running containers", func() {
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index b4427f160..b48926524 100644
--- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -37,12 +37,8 @@ func NewMachine(opts machine.InitOptions) (machine.VM, error) {
if len(opts.Name) > 0 {
vm.Name = opts.Name
}
- vm.IgnitionFilePath = opts.IgnitionPath
- // If no ignitionfilepath was provided, use defaults
- if len(vm.IgnitionFilePath) < 1 {
- ignitionFile := filepath.Join(vmConfigDir, vm.Name+".ign")
- vm.IgnitionFilePath = ignitionFile
- }
+ ignitionFile := filepath.Join(vmConfigDir, vm.Name+".ign")
+ vm.IgnitionFilePath = ignitionFile
// An image was specified
if len(opts.ImagePath) > 0 {
@@ -125,6 +121,9 @@ func LoadVMByName(name string) (machine.VM, error) {
// Init writes the json configuration file to the filesystem for
// other verbs (start, stop)
func (v *MachineVM) Init(opts machine.InitOptions) error {
+ var (
+ key string
+ )
sshDir := filepath.Join(homedir.Get(), ".ssh")
// GetConfDir creates the directory so no need to check for
// its existence
@@ -164,9 +163,13 @@ func (v *MachineVM) Init(opts machine.InitOptions) error {
// Add location of bootable image
v.CmdLine = append(v.CmdLine, "-drive", "if=virtio,file="+v.ImagePath)
// This kind of stinks but no other way around this r/n
- uri := machine.SSHRemoteConnection.MakeSSHURL("localhost", "/run/user/1000/podman/podman.sock", strconv.Itoa(v.Port), v.RemoteUsername)
- if err := machine.AddConnection(&uri, v.Name, filepath.Join(sshDir, v.Name), opts.IsDefault); err != nil {
- return err
+ if len(opts.IgnitionPath) < 1 {
+ uri := machine.SSHRemoteConnection.MakeSSHURL("localhost", "/run/user/1000/podman/podman.sock", strconv.Itoa(v.Port), v.RemoteUsername)
+ if err := machine.AddConnection(&uri, v.Name, filepath.Join(sshDir, v.Name), opts.IsDefault); err != nil {
+ return err
+ }
+ } else {
+ fmt.Println("An ignition path was provided. No SSH connection was added to Podman")
}
// Write the JSON file
b, err := json.MarshalIndent(v, "", " ")
@@ -176,9 +179,14 @@ func (v *MachineVM) Init(opts machine.InitOptions) error {
if err := ioutil.WriteFile(jsonFile, b, 0644); err != nil {
return err
}
- key, err := machine.CreateSSHKeys(v.IdentityPath)
- if err != nil {
- return err
+
+ // User has provided ignition file so keygen
+ // will be skipped.
+ if len(opts.IgnitionPath) < 1 {
+ key, err = machine.CreateSSHKeys(v.IdentityPath)
+ if err != nil {
+ return err
+ }
}
// Run arch specific things that need to be done
if err := v.prepare(); err != nil {
@@ -200,6 +208,15 @@ func (v *MachineVM) Init(opts machine.InitOptions) error {
return errors.Errorf("error resizing image: %q", err)
}
}
+ // If the user provides an ignition file, we need to
+ // copy it into the conf dir
+ if len(opts.IgnitionPath) > 0 {
+ inputIgnition, err := ioutil.ReadFile(opts.IgnitionPath)
+ if err != nil {
+ return err
+ }
+ return ioutil.WriteFile(v.IgnitionFilePath, inputIgnition, 0644)
+ }
// Write the ignition file
ign := machine.DynamicIgnition{
Name: opts.Username,
diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go
index 95ed23313..4f337116e 100644
--- a/test/e2e/build_test.go
+++ b/test/e2e/build_test.go
@@ -549,4 +549,21 @@ RUN echo hello`, ALPINE)
inspect.WaitWithDefaultTimeout()
Expect(inspect.OutputToString()).To(Equal("1970-01-01 00:00:00 +0000 UTC"))
})
+
+ It("podman build --log-rusage", func() {
+ targetPath, err := CreateTempDirInTempDir()
+ Expect(err).To(BeNil())
+
+ containerFile := filepath.Join(targetPath, "Containerfile")
+ content := `FROM scratch`
+
+ Expect(ioutil.WriteFile(containerFile, []byte(content), 0755)).To(BeNil())
+
+ session := podmanTest.Podman([]string{"build", "--log-rusage", "--pull-never", targetPath})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring("(system)"))
+ Expect(session.OutputToString()).To(ContainSubstring("(user)"))
+ Expect(session.OutputToString()).To(ContainSubstring("(elapsed)"))
+ })
})