Skip to content

Commit

Permalink
Merge pull request #15279 from mheon/bump_420_final
Browse files Browse the repository at this point in the history
Final Backports and Bump to v4.2.0
  • Loading branch information
openshift-merge-robot authored Aug 11, 2022
2 parents b53eccf + eba1f77 commit edb3f70
Show file tree
Hide file tree
Showing 275 changed files with 15,049 additions and 5,085 deletions.
14 changes: 9 additions & 5 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ bindings_task:
only_if: >-
$CIRRUS_PR != '' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:COPR.*' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:BUILD.*'
depends_on:
- build
Expand Down Expand Up @@ -325,9 +326,7 @@ alt_build_task:
alias: alt_build
# Don't create task for [CI:DOCS] or multiarch builds
# Docs: ./contrib/cirrus/CIModes.md
only_if: &not_docs_multiarch >-
$CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*' &&
$CIRRUS_CRON != 'multiarch'
only_if: $CIRRUS_CRON != 'multiarch'
depends_on:
- build
env:
Expand Down Expand Up @@ -360,7 +359,7 @@ osx_alt_build_task:
name: "OSX Cross"
alias: osx_alt_build
# Docs: ./contrib/cirrus/CIModes.md
only_if: *not_docs_multiarch
only_if: $CIRRUS_CRON != 'multiarch'
depends_on:
- build
env:
Expand Down Expand Up @@ -395,6 +394,7 @@ docker-py_test_task:
only_if: &not_tag_branch_build_docs >-
$CIRRUS_PR != '' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:COPR.*' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:BUILD.*'

depends_on:
Expand Down Expand Up @@ -629,6 +629,7 @@ local_system_test_task: &local_system_test_task
only_if: &not_tag_build_docs_multiarch >-
$CIRRUS_TAG == '' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:COPR.*' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:BUILD.*' &&
$CIRRUS_CRON != 'multiarch'
depends_on:
Expand Down Expand Up @@ -906,7 +907,10 @@ artifacts_task:
name: "Artifacts"
alias: artifacts
# Docs: ./contrib/cirrus/CIModes.md
only_if: *not_docs_multiarch
only_if: >-
$CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*' &&
$CIRRUS_CHANGE_TITLE !=~ '.*CI:COPR.*' &&
$CIRRUS_CRON != 'multiarch'
depends_on:
- success
# This task is a secondary/convenience for downstream consumers, don't
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Briefly describe the problem you are having in a few paragraphs.
(paste your output here)
```

**Output of `podman info --debug`:**
**Output of `podman info`:**

```
(paste your output here)
Expand Down
15 changes: 14 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
- Pods created with no shared namespaces will no longer create an infra container unless one is explicitly requested ([#15048](https://github.com/containers/podman/issues/15048)).
- The `podman create`, `podman run`, and `podman cp` commands can now autocomplete paths in the image or container via the shell completion.
- The `libpod/common` package has been removed as it's not used anywhere.
- The `--userns` option to `podman create` and `podman run` is no longer accepted when an explicit UID or GID mapping is specified ([#15233](https://github.com/containers/podman/issues/15233)).

### Bugfixes
- Fixed a bug where bind-mounting `/dev` into a container which used the `--init` flag would cause the container to fail to start ([#14251](https://github.com/containers/podman/issues/14251)).
Expand All @@ -68,6 +69,7 @@
- Fixed a bug where the `podman machine init` command would fail when run from `C:\Windows\System32` on Windows systems ([#14416](https://github.com/containers/podman/issues/14416)).
- Fixed a bug where the `podman machine init --now` did not respect proxy environment variables ([#14640](https://github.com/containers/podman/issues/14640)).
- Fixed a bug where the `podman machine init` command would fail if there is no `$HOME/.ssh` dir ([#14572](https://github.com/containers/podman/issues/14572)).
- Fixed a bug where the `podman machine init` command would add a connection even if creating the VM failed ([#15154](https://github.com/containers/podman/issues/15154)).
- Fixed a bug where interrupting the `podman machine start` command could render the VM unable to start.
- Fixed a bug where the `podman machine list --format` command would still print a heading.
- Fixed a bug where the `podman machine list` command did not properly set the `Starting` field ([#14738](https://github.com/containers/podman/issues/14738)).
Expand All @@ -91,6 +93,12 @@
- Fixed a bug where Podman containers could fail to run if the image did not contain an `/etc/passwd` file ([#14966](https://github.com/containers/podman/issues/14966)).
- Fixed a bug where the remote Podman client's `podman push` command did not display progress information ([#14971](https://github.com/containers/podman/issues/14971)).
- Fixed a bug where a lock ordering issue could cause `podman pod rm` to deadlock if it was run at the same time as a command that attempted to lock multiple containers at once ([#14929](https://github.com/containers/podman/issues/14929)).
- Fixed a bug where the `podman rm --force` command would exit with a non-0 code if the container in question did not exist ([#14612](https://github.com/containers/podman/issues/14612)).
- Fixed a bug where the `podman container restore` command would fail when attempting to restore a checkpoint for a container with the same name as an image ([#15055](https://github.com/containers/podman/issues/15055)).
- Fixed a bug where the `podman manifest push --rm` command could remove image, instead of manifest lists ([#15033](https://github.com/containers/podman/issues/15033)).
- Fixed a bug where the `podman run --rm` command could fail to remove the container if it failed to start ([#15049](https://github.com/containers/podman/issues/15049)).
- Fixed a bug where the `podman generate systemd --new` command would create incorrect unit files when the container was created with the `--sdnotify` parameter ([#15052](https://github.com/containers/podman/issues/15052)).
- Fixed a bug where the `podman generate systemd --new` command would fail when `-h <hostname>` was used to create the container ([#15124](https://github.com/containers/podman/pull/15124)).

### API
- The Docker-compatible API now supports API version v1.41 ([#14204](https://github.com/containers/podman/issues/14204)).
Expand All @@ -110,12 +118,17 @@
- The `podman build` command now supports caching with builds that specify `--squash-all` by allowing the `--layers` flag to be used at the same time.
- Podman Machine support for QEMU installations at non-default paths has been improved.
- The `podman machine ssh` command no longer prints spurious warnings every time it is run.
- When accessing the WSL prompt on Windows, the rootless user will be preferred.
- The `podman info` command now includes a field for information on supported authentication plugins for improved Docker compatibility. Authentication plugins are not presently supported by Podman, so this field is always empty.
- The `podman system prune` command now no longer prints the `Deleted Images` header if no images were pruned.
- The `podman system service` command now automatically creates and moves to a sub-cgroup when running in the root cgroup ([#14573](https://github.com/containers/podman/issues/14573)).
- Updated Buildah to v1.27.0
- Updated the containers/image library to v5.22.0
- Updated the containers/storage library to v1.42.0
- Updated the containers/common library to v0.49.1
- Podman will automatically create a sub-cgroup and move itself into it when it detects that it is running inside a container ([#14884](https://github.com/containers/podman/issues/14884)).
- Fixed an incorrect release note about regexp.
- MacOS pkginstaller support is now included.
- A new MacOS installer (via pkginstaller) is now supported.

## 4.1.1
### Features
Expand Down
16 changes: 7 additions & 9 deletions cmd/podman/containers/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,14 @@ func replaceContainer(name string) error {
}

func CreateInit(c *cobra.Command, vals entities.ContainerCreateOptions, isInfra bool) (entities.ContainerCreateOptions, error) {
vals.UserNS = c.Flag("userns").Value.String()
// if user did not modify --userns flag and did turn on
// uid/gid mappings, set userns flag to "private"
if !c.Flag("userns").Changed && vals.UserNS == "host" {
if len(vals.UIDMap) > 0 ||
len(vals.GIDMap) > 0 ||
vals.SubUIDName != "" ||
vals.SubGIDName != "" {
vals.UserNS = "private"
if len(vals.UIDMap) > 0 || len(vals.GIDMap) > 0 || vals.SubUIDName != "" || vals.SubGIDName != "" {
if c.Flag("userns").Changed {
return vals, errors.New("--userns and --uidmap/--gidmap/--subuidname/--subgidname are mutually exclusive")
}
// force userns flag to "private"
vals.UserNS = "private"
} else {
vals.UserNS = c.Flag("userns").Value.String()
}
if c.Flag("kernel-memory") != nil && c.Flag("kernel-memory").Changed {
logrus.Warnf("The --kernel-memory flag is no longer supported. This flag is a noop.")
Expand Down
51 changes: 34 additions & 17 deletions cmd/podman/containers/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,32 +93,49 @@ func init() {
}

func restore(cmd *cobra.Command, args []string) error {
var errs utils.OutputErrors
var (
e error
errs utils.OutputErrors
)
podmanStart := time.Now()
if rootless.IsRootless() {
return fmt.Errorf("restoring a container requires root")
}

// Find out if this is an image
inspectOpts := entities.InspectOptions{}
imgData, _, err := registry.ImageEngine().Inspect(context.Background(), args, inspectOpts)
if err != nil {
return err
// Check if the container exists (#15055)
exists := &entities.BoolReport{Value: false}
for _, ctr := range args {
exists, e = registry.ContainerEngine().ContainerExists(registry.GetContext(), ctr, entities.ContainerExistsOptions{})
if e != nil {
return e
}
if exists.Value {
break
}
}

hostInfo, err := registry.ContainerEngine().Info(context.Background())
if err != nil {
return err
}
if !exists.Value {
// Find out if this is an image
inspectOpts := entities.InspectOptions{}
imgData, _, err := registry.ImageEngine().Inspect(context.Background(), args, inspectOpts)
if err != nil {
return err
}

for i := range imgData {
restoreOptions.CheckpointImage = true
checkpointRuntimeName, found := imgData[i].Annotations[define.CheckpointAnnotationRuntimeName]
if !found {
return fmt.Errorf("image is not a checkpoint: %s", imgData[i].ID)
hostInfo, err := registry.ContainerEngine().Info(context.Background())
if err != nil {
return err
}
if hostInfo.Host.OCIRuntime.Name != checkpointRuntimeName {
return fmt.Errorf("container image \"%s\" requires runtime: \"%s\"", imgData[i].ID, checkpointRuntimeName)

for i := range imgData {
restoreOptions.CheckpointImage = true
checkpointRuntimeName, found := imgData[i].Annotations[define.CheckpointAnnotationRuntimeName]
if !found {
return fmt.Errorf("image is not a checkpoint: %s", imgData[i].ID)
}
if hostInfo.Host.OCIRuntime.Name != checkpointRuntimeName {
return fmt.Errorf("container image \"%s\" requires runtime: \"%s\"", imgData[i].ID, checkpointRuntimeName)
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions cmd/podman/containers/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ func removeContainers(namesOrIDs []string, rmOptions entities.RmOptions, setExit
var errs utils.OutputErrors
responses, err := registry.ContainerEngine().ContainerRm(context.Background(), namesOrIDs, rmOptions)
if err != nil {
if rmOptions.Force && strings.Contains(err.Error(), define.ErrNoSuchCtr.Error()) {
return nil
}
if setExit {
setExitCode(err)
}
Expand All @@ -136,6 +139,9 @@ func removeContainers(namesOrIDs []string, rmOptions entities.RmOptions, setExit
if errors.Is(r.Err, define.ErrWillDeadlock) {
logrus.Errorf("Potential deadlock detected - please run 'podman system renumber' to resolve")
}
if rmOptions.Force && strings.Contains(r.Err.Error(), define.ErrNoSuchCtr.Error()) {
continue
}
if setExit {
setExitCode(r.Err)
}
Expand Down
20 changes: 10 additions & 10 deletions cmd/podman/containers/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ func startFlags(cmd *cobra.Command) {

flags.BoolVarP(&startOptions.Interactive, "interactive", "i", false, "Keep STDIN open even if not attached")
flags.BoolVar(&startOptions.SigProxy, "sig-proxy", false, "Proxy received signals to the process (default true if attaching, false otherwise)")
flags.StringSliceVarP(&filters, "filter", "f", []string{}, "Filter output based on conditions given")
_ = cmd.RegisterFlagCompletionFunc("filter", common.AutocompletePsFilters)

filterFlagName := "filter"
flags.StringSliceVarP(&filters, filterFlagName, "f", []string{}, "Filter output based on conditions given")
_ = cmd.RegisterFlagCompletionFunc(filterFlagName, common.AutocompletePsFilters)

flags.BoolVar(&startOptions.All, "all", false, "Start all containers regardless of their state or configuration")

Expand All @@ -84,7 +86,7 @@ func init() {
}

func validateStart(cmd *cobra.Command, args []string) error {
if len(args) == 0 && !startOptions.Latest && !startOptions.All {
if len(args) == 0 && !startOptions.Latest && !startOptions.All && len(filters) < 1 {
return errors.New("start requires at least one argument")
}
if startOptions.All && startOptions.Latest {
Expand Down Expand Up @@ -123,14 +125,12 @@ func start(cmd *cobra.Command, args []string) error {
}

containers := args
if len(filters) > 0 {
for _, f := range filters {
split := strings.SplitN(f, "=", 2)
if len(split) == 1 {
return fmt.Errorf("invalid filter %q", f)
}
startOptions.Filters[split[0]] = append(startOptions.Filters[split[0]], split[1])
for _, f := range filters {
split := strings.SplitN(f, "=", 2)
if len(split) < 2 {
return fmt.Errorf("invalid filter %q", f)
}
startOptions.Filters[split[0]] = append(startOptions.Filters[split[0]], split[1])
}

responses, err := registry.ContainerEngine().ContainerStart(registry.GetContext(), containers, startOptions)
Expand Down
18 changes: 16 additions & 2 deletions cmd/podman/images/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ package images
import (
"errors"
"fmt"
"strings"

"github.com/containers/podman/v4/cmd/podman/common"
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/cmd/podman/utils"
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/containers/podman/v4/pkg/errorhandling"
"github.com/containers/storage/types"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
Expand Down Expand Up @@ -81,8 +84,19 @@ func rm(cmd *cobra.Command, args []string) error {
fmt.Println("Deleted: " + d)
}
}
registry.SetExitCode(report.ExitCode)
for _, err := range rmErrors {
if !imageOpts.Force || !strings.Contains(err.Error(), types.ErrImageUnknown.Error()) {
registry.SetExitCode(report.ExitCode)
}
}
}

return errorhandling.JoinErrors(rmErrors)
var errs utils.OutputErrors
for _, err := range rmErrors {
if imageOpts.Force && strings.Contains(err.Error(), types.ErrImageUnknown.Error()) {
continue
}
errs = append(errs, err)
}
return errorhandling.JoinErrors(errs)
}
6 changes: 6 additions & 0 deletions cmd/podman/networks/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,19 @@ func networkRm(cmd *cobra.Command, args []string) error {
}
responses, err := registry.ContainerEngine().NetworkRm(registry.Context(), args, networkRmOptions)
if err != nil {
if networkRmOptions.Force && strings.Contains(err.Error(), define.ErrNoSuchNetwork.Error()) {
return nil
}
setExitCode(err)
return err
}
for _, r := range responses {
if r.Err == nil {
fmt.Println(r.Name)
} else {
if networkRmOptions.Force && strings.Contains(r.Err.Error(), define.ErrNoSuchNetwork.Error()) {
continue
}
setExitCode(r.Err)
errs = append(errs, r.Err)
}
Expand Down
7 changes: 6 additions & 1 deletion cmd/podman/pods/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ func removePods(namesOrIDs []string, rmOptions entities.PodRmOptions, printIDs b

responses, err := registry.ContainerEngine().PodRm(context.Background(), namesOrIDs, rmOptions)
if err != nil {
if rmOptions.Force && strings.Contains(err.Error(), define.ErrNoSuchPod.Error()) {
return nil
}
setExitCode(err)
return err
}
Expand All @@ -104,13 +107,15 @@ func removePods(namesOrIDs []string, rmOptions entities.PodRmOptions, printIDs b
fmt.Println(r.Id)
}
} else {
if rmOptions.Force && strings.Contains(r.Err.Error(), define.ErrNoSuchPod.Error()) {
continue
}
setExitCode(r.Err)
errs = append(errs, r.Err)
}
}
return errs.PrintErrors()
}

func setExitCode(err error) {
if errors.Is(err, define.ErrNoSuchPod) || strings.Contains(err.Error(), define.ErrNoSuchPod.Error()) {
registry.SetExitCode(1)
Expand Down
1 change: 1 addition & 0 deletions cmd/podman/system/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func infoFlags(cmd *cobra.Command) {
flags := cmd.Flags()

flags.BoolVarP(&debug, "debug", "D", false, "Display additional debug information")
_ = flags.MarkHidden("debug") // It's a NOP since Podman version 2.0

formatFlagName := "format"
flags.StringVarP(&inFormat, formatFlagName, "f", "", "Change the output format to JSON or a Go template")
Expand Down
6 changes: 6 additions & 0 deletions cmd/podman/volumes/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,19 @@ func rm(cmd *cobra.Command, args []string) error {
}
responses, err := registry.ContainerEngine().VolumeRm(context.Background(), args, rmOptions)
if err != nil {
if rmOptions.Force && strings.Contains(err.Error(), define.ErrNoSuchVolume.Error()) {
return nil
}
setExitCode(err)
return err
}
for _, r := range responses {
if r.Err == nil {
fmt.Println(r.Id)
} else {
if rmOptions.Force && strings.Contains(r.Err.Error(), define.ErrNoSuchVolume.Error()) {
continue
}
setExitCode(r.Err)
errs = append(errs, r.Err)
}
Expand Down
10 changes: 10 additions & 0 deletions contrib/cirrus/CIModes.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ of this document, it's not possible to override the behavior of `$CIRRUS_PR`.
+ meta
+ success

### Intended `[CI:COPR]` PR Tasks:
+ ext_svc_check
+ automation
+ *build*
+ validate
+ swagger
+ consistency
+ meta
+ success

### Intend `[CI:BUILD]` PR Tasks:
+ ext_svc_check
+ automation
Expand Down
Loading

0 comments on commit edb3f70

Please sign in to comment.