Skip to content

Commit

Permalink
Merge pull request #10778 from mheon/backports_322
Browse files Browse the repository at this point in the history
Backports for v3.2.2
  • Loading branch information
openshift-merge-robot authored Jun 25, 2021
2 parents f8a793a + 9f4afa1 commit dec1419
Show file tree
Hide file tree
Showing 71 changed files with 713 additions and 377 deletions.
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,14 @@ LIBPOD := ${PROJECT}/v3/libpod
GCFLAGS ?= all=-trimpath=$(CURDIR)
ASMFLAGS ?= all=-trimpath=$(CURDIR)
LDFLAGS_PODMAN ?= \
-X $(LIBPOD)/define.gitCommit=$(GIT_COMMIT) \
-X $(LIBPOD)/define.buildInfo=$(BUILD_INFO) \
-X $(LIBPOD)/config._installPrefix=$(PREFIX) \
-X $(LIBPOD)/config._etcDir=$(ETCDIR) \
$(EXTRA_LDFLAGS)
-X $(LIBPOD)/define.gitCommit=$(GIT_COMMIT) \
-X $(LIBPOD)/define.buildInfo=$(BUILD_INFO) \
-X $(LIBPOD)/config._installPrefix=$(PREFIX) \
-X $(LIBPOD)/config._etcDir=$(ETCDIR) \
$(EXTRA_LDFLAGS)
LDFLAGS_PODMAN_STATIC ?= \
$(LDFLAGS_PODMAN) \
-extldflags=-static
#Update to LIBSECCOMP_COMMIT should reflect in Dockerfile too.
LIBSECCOMP_COMMIT := v2.3.3
# Rarely if ever should integration tests take more than 50min,
Expand Down Expand Up @@ -314,7 +317,7 @@ $(SRCBINDIR)/podman$(BINSFX): $(SRCBINDIR) .gopathok $(SOURCES) go.mod go.sum
-o $@ ./cmd/podman

$(SRCBINDIR)/podman-remote-static: $(SRCBINDIR) .gopathok $(SOURCES) go.mod go.sum
CGO_ENABLED=$(CGO_ENABLED) \
CGO_ENABLED=0 \
GOOS=$(GOOS) \
$(GO) build \
$(BUILDFLAGS) \
Expand Down
27 changes: 27 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Release Notes

## 3.2.2
### Changes
- Podman's handling of the Architecture field of images has been relaxed. Since 3.2.0, Podman required that the architecture of the image match the architecture of the system to run containers based on an image, but images often incorrectly report architecture, causing Podman to reject valid images ([#10648](https://github.com/containers/podman/issues/10648) and [#10682](https://github.com/containers/podman/issues/10682)).
- Podman no longer uses inotify to monitor for changes to CNI configurations. This removes potential issues where Podman cannot be run because a user has exhausted their available inotify sessions ([#10686](https://github.com/containers/podman/issues/10686)).

### Bugfixes
- Fixed a bug where the `podman cp` would, when given a directory as its source and a target that existed and was a file, copy the contents of the directory into the parent directory of the file; this now results in an error.
- Fixed a bug where the `podman logs` command would, when following a running container's logs, not include the last line of output from the container when it exited when the `k8s-file` driver was in use ([#10675](https://github.com/containers/podman/issues/10675)).
- Fixed a bug where Podman would fail to run containers if `systemd-resolved` was incorrectly detected as the system's DNS server ([#10733](https://github.com/containers/podman/issues/10733)).
- Fixed a bug where the `podman exec -t` command would only resize the exec session's TTY after the session started, leading to a race condition where the terminal would initially not have a size set ([#10560](https://github.com/containers/podman/issues/10560)).
- Fixed a bug where Podman containers using the `slirp4netns` network mode would add an incorrect entry to `/etc/hosts` pointing the container's hostname to the wrong IP address.
- Fixed a bug where Podman would create volumes specified by images with incorrect permissions ([#10188](https://github.com/containers/podman/issues/10188) and [#10606](https://github.com/containers/podman/issues/10606)).
- Fixed a bug where Podman would not respect the `uid` and `gid` options to `podman volume create -o` ([#10620](https://github.com/containers/podman/issues/10620)).
- Fixed a bug where the `podman run` command could panic when parsing the system's cgroup configuration ([#10666](https://github.com/containers/podman/issues/10666)).
- Fixed a bug where the remote Podman client's `podman build -f - ...` command did not read a Containerfile from STDIN ([#10621](https://github.com/containers/podman/issues/10621)).
- Fixed a bug where the `podman container restore --import` command would fail to restore checkpoints created from privileged containers ([#10615](https://github.com/containers/podman/issues/10615)).
- Fixed a bug where Podman was not respecting the `TMPDIR` environment variable when pulling images ([#10698](https://github.com/containers/podman/issues/10698)).
- Fixed a bug where a number of Podman commands did not properly support using Go templates as an argument to the `--format` option.

### API
- Fixed a bug where the Compat Inspect endpoint for Containers did not include information on container healthchecks ([#10457](https://github.com/containers/podman/issues/10457)).
- Fixed a bug where the Libpod and Compat Build endpoints for Images did not properly handle the `devices` query parameter ([#10614](https://github.com/containers/podman/issues/10614)).

### Misc
- Fixed a bug where the Makefile's `make podman-remote-static` target to build a statically-linked `podman-remote` binary was instead producing dynamic binaries ([#10656](https://github.com/containers/podman/issues/10656)).
- Updated the containers/common library to v0.38.11

## 3.2.1
### Changes
- Podman now allows corrupt images (e.g. from restarting the system during an image pull) to be replaced by a `podman pull` of the same image (instead of requiring they be removed first, then re-pulled).
Expand Down
12 changes: 7 additions & 5 deletions cmd/podman/containers/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package containers
import (
"fmt"
"os"
"text/tabwriter"
"text/template"

"github.com/containers/common/pkg/report"
"github.com/containers/podman/v3/cmd/podman/common"
Expand Down Expand Up @@ -118,12 +116,16 @@ func mount(_ *cobra.Command, args []string) error {
mrs = append(mrs, mountReporter{r})
}

format := "{{range . }}{{.ID}}\t{{.Path}}\n{{end}}"
tmpl, err := template.New("mounts").Parse(format)
format := "{{range . }}{{.ID}}\t{{.Path}}\n{{end -}}"
tmpl, err := report.NewTemplate("mounts").Parse(format)
if err != nil {
return err
}

w, err := report.NewWriterDefault(os.Stdout)
if err != nil {
return err
}
w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0)
defer w.Flush()
return tmpl.Execute(w, mrs)
}
Expand Down
17 changes: 8 additions & 9 deletions cmd/podman/containers/ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ import (
"sort"
"strconv"
"strings"
"text/tabwriter"
"text/template"
"time"

tm "github.com/buger/goterm"
"github.com/containers/common/pkg/completion"
"github.com/containers/common/pkg/report"
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/parse"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/utils"
"github.com/containers/podman/v3/cmd/podman/validate"
Expand Down Expand Up @@ -228,18 +225,20 @@ func ps(cmd *cobra.Command, _ []string) error {
hdrs, format := createPsOut()
if cmd.Flags().Changed("format") {
format = report.NormalizeFormat(listOpts.Format)
format = parse.EnforceRange(format)
format = report.EnforceRange(format)
}
ns := strings.NewReplacer(".Namespaces.", ".")
format = ns.Replace(format)

tmpl, err := template.New("listContainers").
Funcs(template.FuncMap(report.DefaultFuncs)).
Parse(format)
tmpl, err := report.NewTemplate("list").Parse(format)
if err != nil {
return err
}

w, err := report.NewWriterDefault(os.Stdout)
if err != nil {
return err
}
w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0)
defer w.Flush()

headers := func() error { return nil }
Expand Down Expand Up @@ -322,7 +321,7 @@ func createPsOut() ([]map[string]string, string) {
row += "\t{{.Size}}"
}
}
return hdrs, "{{range .}}" + row + "\n{{end}}"
return hdrs, "{{range .}}" + row + "\n{{end -}}"
}

type psReporter struct {
Expand Down
13 changes: 7 additions & 6 deletions cmd/podman/containers/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ package containers
import (
"fmt"
"os"
"text/tabwriter"
"text/template"

tm "github.com/buger/goterm"
"github.com/containers/common/pkg/report"
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/parse"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
"github.com/containers/podman/v3/libpod/define"
Expand Down Expand Up @@ -172,13 +169,17 @@ func outputStats(reports []define.ContainerStats) error {
if len(statsOptions.Format) > 0 {
format = report.NormalizeFormat(statsOptions.Format)
}
format = parse.EnforceRange(format)
format = report.EnforceRange(format)

tmpl, err := template.New("stats").Parse(format)
tmpl, err := report.NewTemplate("stats").Parse(format)
if err != nil {
return err
}

w, err := report.NewWriterDefault(os.Stdout)
if err != nil {
return err
}
w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0)
defer w.Flush()

if len(statsOptions.Format) < 1 {
Expand Down
10 changes: 7 additions & 3 deletions cmd/podman/containers/top.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"os"
"strings"
"text/tabwriter"

"github.com/containers/common/pkg/report"
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
Expand Down Expand Up @@ -79,7 +79,7 @@ func init() {
validate.AddLatestFlag(containerTopCommand, &topOptions.Latest)
}

func top(cmd *cobra.Command, args []string) error {
func top(_ *cobra.Command, args []string) error {
if topOptions.ListDescriptors {
descriptors, err := util.GetContainerPidInformationDescriptors()
if err != nil {
Expand All @@ -105,7 +105,11 @@ func top(cmd *cobra.Command, args []string) error {
return err
}

w := tabwriter.NewWriter(os.Stdout, 5, 1, 3, ' ', 0)
w, err := report.NewWriterDefault(os.Stdout)
if err != nil {
return err
}

for _, proc := range topResponse.Value {
if _, err := fmt.Fprintln(w, proc); err != nil {
return err
Expand Down
13 changes: 7 additions & 6 deletions cmd/podman/images/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ import (
"fmt"
"os"
"strings"
"text/tabwriter"
"text/template"
"time"
"unicode"

"github.com/containers/common/pkg/report"
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/parse"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/docker/go-units"
Expand Down Expand Up @@ -127,13 +124,17 @@ func history(cmd *cobra.Command, args []string) error {
case opts.quiet:
row = "{{.ID}}\n"
}
format := parse.EnforceRange(row)
format := report.EnforceRange(row)

tmpl, err := template.New("report").Parse(format)
tmpl, err := report.NewTemplate("history").Parse(format)
if err != nil {
return err
}

w, err := report.NewWriterDefault(os.Stdout)
if err != nil {
return err
}
w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0)
defer w.Flush()

if !opts.quiet && !cmd.Flags().Changed("format") {
Expand Down
22 changes: 11 additions & 11 deletions cmd/podman/images/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ import (
"os"
"sort"
"strings"
"text/tabwriter"
"text/template"
"time"
"unicode"

"github.com/containers/common/pkg/completion"
"github.com/containers/common/pkg/report"
"github.com/containers/image/v5/docker/reference"
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/parse"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/docker/go-units"
Expand Down Expand Up @@ -126,7 +123,7 @@ func images(cmd *cobra.Command, args []string) error {
case listFlag.quiet:
return writeID(imgs)
default:
if cmd.Flags().Changed("format") && !parse.HasTable(listFlag.format) {
if cmd.Flags().Changed("format") && !report.HasTable(listFlag.format) {
listFlag.noHeading = true
}
return writeTemplate(imgs)
Expand Down Expand Up @@ -181,20 +178,23 @@ func writeTemplate(imgs []imageReporter) error {
"ReadOnly": "R/O",
})

var row string
var format string
if listFlag.format == "" {
row = lsFormatFromFlags(listFlag)
format = lsFormatFromFlags(listFlag)
} else {
row = report.NormalizeFormat(listFlag.format)
format = report.NormalizeFormat(listFlag.format)
format = report.EnforceRange(format)
}
format := parse.EnforceRange(row)

tmpl, err := template.New("list").Parse(format)
tmpl, err := report.NewTemplate("list").Parse(format)
if err != nil {
return err
}

w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0)
w, err := report.NewWriterDefault(os.Stdout)
if err != nil {
return err
}
defer w.Flush()

if !listFlag.noHeading {
Expand Down Expand Up @@ -323,7 +323,7 @@ func lsFormatFromFlags(flags listFlagType) string {
row = append(row, "{{.ReadOnly}}")
}

return strings.Join(row, "\t") + "\n"
return "{{range . }}" + strings.Join(row, "\t") + "\n{{end -}}"
}

type imageReporter struct {
Expand Down
13 changes: 8 additions & 5 deletions cmd/podman/images/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package images
import (
"fmt"
"os"
"text/tabwriter"
"text/template"

"github.com/containers/common/pkg/report"
"github.com/containers/podman/v3/cmd/podman/common"
Expand Down Expand Up @@ -99,13 +97,18 @@ func mount(cmd *cobra.Command, args []string) error {
mrs = append(mrs, mountReporter{r})
}

row := "{{range . }}{{.ID}}\t{{.Path}}\n{{end}}"
tmpl, err := template.New("mounts").Parse(row)
row := "{{range . }}{{.ID}}\t{{.Path}}\n{{end -}}"
tmpl, err := report.NewTemplate("mounts").Parse(row)
if err != nil {
return err
}

w, err := report.NewWriterDefault(os.Stdout)
if err != nil {
return err
}
w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0)
defer w.Flush()

return tmpl.Execute(w, mrs)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/images/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func pushFlags(cmd *cobra.Command) {
_ = cmd.RegisterFlagCompletionFunc(digestfileFlagName, completion.AutocompleteDefault)

formatFlagName := "format"
flags.StringVarP(&pushOptions.Format, formatFlagName, "f", "", "Manifest type (oci, v2s2, or v2s1) to use when pushing an image using the 'dir' transport (default is manifest type of source)")
flags.StringVarP(&pushOptions.Format, formatFlagName, "f", "", "Manifest type (oci, v2s2, or v2s1) to use in the destination (default is manifest type of source, with fallbacks)")
_ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteManifestFormat)

flags.BoolVarP(&pushOptions.Quiet, "quiet", "q", false, "Suppress output information when pushing images")
Expand Down
15 changes: 8 additions & 7 deletions cmd/podman/images/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ package images
import (
"fmt"
"os"
"text/tabwriter"
"text/template"

"github.com/containers/common/pkg/auth"
"github.com/containers/common/pkg/completion"
"github.com/containers/common/pkg/report"
"github.com/containers/image/v5/types"
"github.com/containers/podman/v3/cmd/podman/parse"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/pkg/errors"
Expand Down Expand Up @@ -163,18 +160,22 @@ func imageSearch(cmd *cobra.Command, args []string) error {
case report.IsJSON(searchOptions.Format):
return printArbitraryJSON(searchReport)
case cmd.Flags().Changed("format"):
renderHeaders = parse.HasTable(searchOptions.Format)
renderHeaders = report.HasTable(searchOptions.Format)
row = report.NormalizeFormat(searchOptions.Format)
default:
row = "{{.Index}}\t{{.Name}}\t{{.Description}}\t{{.Stars}}\t{{.Official}}\t{{.Automated}}\n"
}
format := parse.EnforceRange(row)
format := report.EnforceRange(row)

tmpl, err := template.New("search").Parse(format)
tmpl, err := report.NewTemplate("search").Parse(format)
if err != nil {
return err
}

w, err := report.NewWriterDefault(os.Stdout)
if err != nil {
return err
}
w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0)
defer w.Flush()

if renderHeaders {
Expand Down
Loading

0 comments on commit dec1419

Please sign in to comment.