summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cirrus.yml120
-rw-r--r--.dockerignore3
-rw-r--r--.golangci.yml1
-rw-r--r--CONTRIBUTING.md58
-rw-r--r--RELEASE_NOTES.md6
-rw-r--r--changelog.txt53
-rw-r--r--cmd/podman/diff.go1
-rw-r--r--cmd/podman/network_list.go1
-rw-r--r--cmd/podman/pod_pause.go1
-rw-r--r--contrib/cirrus/lib.sh4
-rw-r--r--contrib/gate/Dockerfile29
-rw-r--r--contrib/gate/README.md6
-rwxr-xr-xcontrib/gate/entrypoint.sh22
-rw-r--r--go.mod2
-rw-r--r--go.sum2
-rwxr-xr-xhack/get_release_info.sh3
-rwxr-xr-xhack/install_golangci.sh24
-rw-r--r--libpod/image/filters.go2
-rw-r--r--libpod/networking_linux.go4
-rw-r--r--libpod/runtime_img.go2
-rw-r--r--libpod/runtime_pod_infra_linux.go2
-rw-r--r--libpod/storage.go2
-rw-r--r--pkg/api/handlers/containers.go2
-rw-r--r--pkg/api/handlers/generic/containers.go16
-rw-r--r--pkg/api/handlers/generic/images.go2
-rw-r--r--pkg/api/handlers/types.go23
-rw-r--r--pkg/api/handlers/utils/handler.go2
-rw-r--r--pkg/api/server/register_auth.go2
-rw-r--r--pkg/api/server/register_containers.go36
-rw-r--r--pkg/api/server/register_distribution.go2
-rw-r--r--pkg/api/server/register_events.go2
-rw-r--r--pkg/api/server/register_exec.go8
-rw-r--r--pkg/api/server/register_images.go26
-rw-r--r--pkg/api/server/register_info.go2
-rw-r--r--pkg/api/server/register_monitor.go2
-rw-r--r--pkg/api/server/register_plugins.go2
-rw-r--r--pkg/api/server/register_swarm.go8
-rw-r--r--pkg/api/server/register_system.go2
-rw-r--r--pkg/apparmor/apparmor.go1
-rw-r--r--pkg/bindings/containers/healthcheck.go2
-rw-r--r--pkg/hooks/exec/exec.go2
-rw-r--r--pkg/lookup/lookup.go2
-rw-r--r--pkg/specgen/create.go3
-rw-r--r--pkg/systemd/generate/systemdgen.go12
-rw-r--r--pkg/systemd/generate/systemdgen_test.go10
-rw-r--r--test/e2e/generate_systemd_test.go2
-rw-r--r--vendor/github.com/containernetworking/cni/libcni/api.go6
-rw-r--r--vendor/github.com/containernetworking/cni/pkg/invoke/args.go4
-rw-r--r--vendor/github.com/containernetworking/cni/pkg/invoke/raw_exec.go8
-rw-r--r--vendor/github.com/containernetworking/cni/pkg/types/020/types.go14
-rw-r--r--vendor/github.com/containernetworking/cni/pkg/types/current/types.go17
-rw-r--r--vendor/github.com/containernetworking/cni/pkg/types/types.go3
-rw-r--r--vendor/github.com/containernetworking/cni/pkg/utils/utils.go39
-rw-r--r--vendor/modules.txt2
54 files changed, 440 insertions, 172 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
index 39b2bdc1a..84a31e3ac 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -17,6 +17,7 @@ env:
DEST_BRANCH: "master"
# Overrides default location (/tmp/cirrus) for repo clone
GOPATH: "/var/tmp/go"
+ GOBIN: "${GOPATH}/bin"
GOSRC: "/var/tmp/go/src/github.com/containers/libpod"
CIRRUS_WORKING_DIR: "/var/tmp/go/src/github.com/containers/libpod"
# The default is 'sh' if unspecified
@@ -33,11 +34,16 @@ env:
####
#### Cache-image names to test with (double-quotes around names are critical)
###
+ FEDORA_NAME: "fedora-31"
+ PRIOR_FEDORA_NAME: "fedora-30"
+ UBUNTU_NAME: "ubuntu-19"
+ PRIOR_UBUNTU_NAME: "ubuntu-18"
+
_BUILT_IMAGE_SUFFIX: "libpod-5940307564953600"
- FEDORA_CACHE_IMAGE_NAME: "fedora-31-${_BUILT_IMAGE_SUFFIX}"
- PRIOR_FEDORA_CACHE_IMAGE_NAME: "fedora-30-${_BUILT_IMAGE_SUFFIX}"
- UBUNTU_CACHE_IMAGE_NAME: "ubuntu-19-${_BUILT_IMAGE_SUFFIX}"
- PRIOR_UBUNTU_CACHE_IMAGE_NAME: "ubuntu-18-${_BUILT_IMAGE_SUFFIX}"
+ FEDORA_CACHE_IMAGE_NAME: "${FEDORA_NAME}-${_BUILT_IMAGE_SUFFIX}"
+ PRIOR_FEDORA_CACHE_IMAGE_NAME: "${PRIOR_FEDORA_NAME}-${_BUILT_IMAGE_SUFFIX}"
+ UBUNTU_CACHE_IMAGE_NAME: "${UBUNTU_NAME}-${_BUILT_IMAGE_SUFFIX}"
+ PRIOR_UBUNTU_CACHE_IMAGE_NAME: "${PRIOR_UBUNTU_NAME}-${_BUILT_IMAGE_SUFFIX}"
####
#### Variables for composing new cache-images (used in PR testing) from
@@ -88,17 +94,18 @@ gce_instance:
# quick format, lint, and unit tests on the standard platform.
gating_task:
- # Only run this on PRs, never during post-merge testing. This is also required
- # for proper setting of EPOCH_TEST_COMMIT value, required by validation tools.
+ # Only run this on PRs, never during post-merge testing (for speed).
only_if: $CIRRUS_BRANCH != $DEST_BRANCH
env:
CIRRUS_WORKING_DIR: "/usr/src/libpod"
- GOPATH: "/go"
- GOSRC: "/go/src/github.com/containers/libpod"
+ SRCPATH: "$CIRRUS_WORKING_DIR"
# Runs within Cirrus's "community cluster"
container:
+ # Note: Image has dual purpose, see contrib/gate/README.md
+ # The entrypoint.sh script ensures a prestine copy of $SRCPATH is
+ # available at $GOSRC before executing make instructions.
image: "quay.io/libpod/gate:master"
cpu: 4
memory: 12
@@ -136,9 +143,9 @@ gating_task:
# Verify some aspects of ci/related scripts
ci_script:
- - '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/lib.sh.t |& ${TIMESTAMP}'
+ - '${GOSRC}/${SCRIPT_BASE}/lib.sh.t |& ${TIMESTAMP}'
- '/usr/local/bin/entrypoint.sh -C ${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/packer test'
- - '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/cirrus_yaml_test.py |& ${TIMESTAMP}'
+ - '${GOSRC}/${SCRIPT_BASE}/cirrus_yaml_test.py |& ${TIMESTAMP}'
# Verify expected bash environment (-o pipefail)
pipefail_enabledscript: 'if /bin/false | /bin/true; then echo "pipefail fault" && exit 72; fi'
@@ -220,13 +227,14 @@ varlink_api_task:
env:
CIRRUS_WORKING_DIR: "/usr/src/libpod"
- GOPATH: "/go"
- GOSRC: "/go/src/github.com/containers/libpod"
+ SRCPATH: "$CIRRUS_WORKING_DIR"
+ EPOCH_TEST_COMMIT: "${CIRRUS_BASE_SHA}" # repo clone missing this data
# Used by tree_status.sh
SUGGESTION: 'remove API.md, then "make varlink_api_generate" and commit changes.'
# Runs within Cirrus's "community cluster"
container:
+ # Note: Image has dual purpose, see contrib/gate/README.md
image: "quay.io/libpod/gate:master"
cpu: 4
memory: 12
@@ -367,7 +375,7 @@ image_prune_task:
# This task does the unit and integration testing for every platform
testing_task:
-
+ alias: "testing"
depends_on:
- "gating"
- "vendor"
@@ -380,21 +388,30 @@ testing_task:
$CIRRUS_CHANGE_MESSAGE !=~ '.*CI:IMG.*' &&
$CIRRUS_CHANGE_MESSAGE !=~ '.*CI:DOCS.*'
- gce_instance:
- matrix:
- image_name: "${FEDORA_CACHE_IMAGE_NAME}"
- image_name: "${PRIOR_FEDORA_CACHE_IMAGE_NAME}"
- # Multiple test failures on Ubuntu 19 - Fixes TBD in future PR
- # TODO: image_name: "${UBUNTU_CACHE_IMAGE_NAME}"
- image_name: "${PRIOR_UBUNTU_CACHE_IMAGE_NAME}"
+ matrix:
+ - name: "test ${FEDORA_NAME}"
+ gce_instance:
+ image_name: "${FEDORA_CACHE_IMAGE_NAME}"
+ - name: "test ${PRIOR_FEDORA_NAME}"
+ gce_instance:
+ image_name: "${PRIOR_FEDORA_CACHE_IMAGE_NAME}"
+ # Multiple test failures on Ubuntu 19 - Fixes TBD in future PR
+ # TODO: image_name: "${UBUNTU_CACHE_IMAGE_NAME}"
+ - name: "test ${PRIOR_UBUNTU_NAME}"
+ gce_instance:
+ image_name: "${PRIOR_UBUNTU_CACHE_IMAGE_NAME}"
timeout_in: 120m
env:
ADD_SECOND_PARTITION: 'true'
matrix:
- TEST_REMOTE_CLIENT: 'true'
- TEST_REMOTE_CLIENT: 'false'
+ - name: remote
+ env:
+ TEST_REMOTE_CLIENT: 'true'
+ - name: local
+ env:
+ TEST_REMOTE_CLIENT: 'false'
networking_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/networking.sh'
setup_environment_script: '$SCRIPT_BASE/setup_environment.sh |& ${TIMESTAMP}'
@@ -445,8 +462,12 @@ special_testing_rootless_task:
ADD_SECOND_PARTITION: 'true'
SPECIALMODE: 'rootless' # See docs
matrix:
- TEST_REMOTE_CLIENT: 'true'
- TEST_REMOTE_CLIENT: 'false'
+ - name: remote
+ env:
+ TEST_REMOTE_CLIENT: 'true'
+ - name: local
+ env:
+ TEST_REMOTE_CLIENT: 'false'
timeout_in: 60m
@@ -464,7 +485,7 @@ special_testing_rootless_task:
special_testing_in_podman_task:
-
+ alias: "special_testing_in_podman"
depends_on:
- "gating"
- "varlink_api"
@@ -476,12 +497,13 @@ special_testing_in_podman_task:
$CIRRUS_CHANGE_MESSAGE !=~ '.*CI:IMG.*' &&
$CIRRUS_CHANGE_MESSAGE !=~ '.*CI:DOCS.*'
- gce_instance:
- matrix:
- # FIXME: Integration testing currently broken for F31 hosts
- # Error: container_linux.go:345: starting container process caused "process_linux.go:281: applying cgroup configuration for process caused \"mountpoint for cgroup not found\"": OCI runtime error
- # image_name: "${FEDORA_CACHE_IMAGE_NAME}"
- image_name: "${PRIOR_FEDORA_CACHE_IMAGE_NAME}"
+ matrix:
+ # FIXME: Integration testing currently broken for F31 hosts
+ # Error: container_linux.go:345: starting container process caused "process_linux.go:281: applying cgroup configuration for process caused \"mountpoint for cgroup not found\"": OCI runtime error
+ # image_name: "${FEDORA_CACHE_IMAGE_NAME}"
+ - name: "in-podman ${PRIOR_FEDORA_NAME}"
+ gce_instance:
+ image_name: "${PRIOR_FEDORA_CACHE_IMAGE_NAME}"
env:
ADD_SECOND_PARTITION: 'true'
@@ -506,7 +528,7 @@ special_testing_in_podman_task:
special_testing_cross_task:
-
+ alias: "special_testing_cross"
depends_on:
- "gating"
- "varlink_api"
@@ -516,10 +538,13 @@ special_testing_cross_task:
$CIRRUS_CHANGE_MESSAGE !=~ '.*CI:IMG.*' &&
$CIRRUS_CHANGE_MESSAGE !=~ '.*CI:DOCS.*'
- env:
- matrix:
- CROSS_PLATFORM: 'windows'
- CROSS_PLATFORM: 'darwin'
+ matrix:
+ - name: 'cross-platform: windows'
+ env:
+ CROSS_PLATFORM: 'windows'
+ - name: 'cross-platform: darwin'
+ env:
+ CROSS_PLATFORM: 'darwin'
timeout_in: 20m
@@ -646,15 +671,19 @@ verify_test_built_images_task:
env:
ADD_SECOND_PARTITION: 'true'
matrix:
- TEST_REMOTE_CLIENT: 'true'
- TEST_REMOTE_CLIENT: 'false'
+ - name: remote
+ env:
+ TEST_REMOTE_CLIENT: 'true'
+ - name: local
+ env:
+ TEST_REMOTE_CLIENT: 'false'
matrix:
# Required env. var. by check_image_script
- PACKER_BUILDER_NAME: "fedora-30"
- PACKER_BUILDER_NAME: "fedora-31"
- PACKER_BUILDER_NAME: "ubuntu-18"
+ PACKER_BUILDER_NAME: "${FEDORA_NAME}"
+ PACKER_BUILDER_NAME: "${PRIOR_FEDORA_NAME}"
+ PACKER_BUILDER_NAME: "${PRIOR_UBUNTU_NAME}"
# Multiple test failures on ${UBUNTU_CACHE_IMAGE_NAME}
- # PACKER_BUILDER_NAME: "ubuntu-19"
+ # PACKER_BUILDER_NAME: "${UBUNTU_NAME}"
networking_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/networking.sh'
installed_packages_script: '$SCRIPT_BASE/logcollector.sh packages'
@@ -757,12 +786,13 @@ success_task:
env:
CIRRUS_WORKING_DIR: "/usr/src/libpod"
- GOPATH: "/go"
- GOSRC: "/go/src/github.com/containers/libpod"
+ SRCPATH: "$CIRRUS_WORKING_DIR"
+ EPOCH_TEST_COMMIT: "${CIRRUS_BASE_SHA}" # repo clone missing this data
container:
+ # Note: Image has dual purpose, see contrib/gate/README.md
image: "quay.io/libpod/gate:master"
cpu: 1
memory: 1
- success_script: '$CIRRUS_WORKING_DIR/$SCRIPT_BASE/success.sh |& ${TIMESTAMP}'
+ success_script: '/usr/local/bin/entrypoint.sh ./$SCRIPT_BASE/success.sh |& ${TIMESTAMP}'
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 000000000..85914ee63
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,3 @@
+.git/
+.github/
+bin/
diff --git a/.golangci.yml b/.golangci.yml
index dda1cc7ec..8b1062b4c 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -24,7 +24,6 @@ linters:
- goconst
- gocyclo
- golint
- - goimports
- gosec
- lll
- maligned
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index be13b6de3..7e94957eb 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -261,24 +261,62 @@ commit automatically with `git commit -s`.
All code changes must pass ``make validate`` and ``make lint``, as
executed in a standard container. The container image for this
-purpose is provided at: ``quay.io/libpod/gate:latest``. However,
-for changes to the image itself, it may also be built locally
-from the repository root, with the command:
+purpose is provided at: ``quay.io/libpod/gate:master``. With
+other tags available for different branches as needed. These
+images are built automatically after merges to the branch.
+
+#### Building the gate container locally
+
+For local use, debugging, or experimentation, the gate image may
+be built locally from the repository root, with the command:
```
-sudo podman build -t quay.io/libpod/gate:latest -f contrib/gate/Dockerfile .
+podman build -t gate -f contrib/gate/Dockerfile .
```
***N/B:*** **don't miss the dot (.) at the end, it's really important**
-The container executes 'make' by default, on a copy of the repository.
-This avoids changing or leaving build artifacts in your working directory.
+#### Local use of gate container
+
+The gate container's entry-point executes 'make' by default, on a copy of
+the repository made at runtime. This avoids the container changing or
+leaving build artifacts in your hosts working directory. It also guarantees
+every execution is based upon pristine code provided from the host.
+
Execution does not require any special permissions from the host. However,
-the repository root must be bind-mounted into the container at
-'/usr/src/libpod'. For example, running `make lint` is done (from
-the repository root) with the command:
+your libpod repository clone's root must be bind-mounted to the container at
+'/usr/src/libpod'. The copy will be made into /var/tmp/go (`$GOSRC` in container)
+before running your make target. For example, running `make lint` from a
+repository clone at $HOME/devel/libpod could be done with the commands:
+
+```bash
+$ cd $HOME/devel/libpod
+$ podman run -it --rm -v $PWD:/usr/src/libpod:ro \
+ --security-opt label=disable quay.io/libpod/gate:master \
+ lint
+```
+
+***N/B:*** Depending on your clone's git remotes-configuration,
+(esp. for `validate` and `lint` targets), you may also need to reference the
+commit which was your upstream fork-point. Otherwise you may receive an error
+similar to:
-``sudo podman run -it --rm -v $PWD:/usr/src/libpod:ro --security-opt label=disable quay.io/libpod/gate:latest lint``
+```
+fatal: Not a valid object name master
+Makefile:152: *** Required variable EPOCH_TEST_COMMIT value is undefined, whitespace, or empty. Stop.
+```
+
+For example, assuming your have a remote called `upstream` running the
+validate target should be done like this:
+
+```bash
+$ cd $HOME/devel/libpod
+$ git remote update upstream
+$ export EPOCH_TEST_COMMIT=$(git merge-base upstream/master HEAD)
+$ podman run -it --rm -e EPOCH_TEST_COMMIT -v $PWD:/usr/src/libpod:ro \
+ --security-opt label=disable quay.io/libpod/gate:master \
+ validate
+```
### Integration Tests
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index f813b494f..513a3eeca 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -4,9 +4,11 @@
### Features
- Many networking-related flags have been added to `podman pod create` to enable customization of pod networks, including `--add-host`, `--dns`, `--dns-opt`, `--dns-search`, `--ip`, `--mac-address`, `--network`, and `--no-hosts`
- The `podman ps --format=json` command now includes the ID of the image containers were created with
+- The `podman run` and `podman create` commands now feature an `--rmi` flag to remove the image the container was using after it exits (if no other containers are using said image) ([#4628](https://github.com/containers/libpod/issues/4628))
- The `podman create` and `podman run` commands now support the `--device-cgroup-rule` flag ([#4876](https://github.com/containers/libpod/issues/4876))
- While the HTTP API remains in alpha, many fixes and additions have landed. These are documented in a separate subsection below
- The `podman create` and `podman run` commands now feature a `--no-healthcheck` flag to disable healthchecks for a container ([#5299](https://github.com/containers/libpod/issues/5299))
+- Containers now recognize the `io.containers.capabilities` label, which specifies a list of capabilities required by the image to run. These capabilities will be used as long as they are more restrictive than the default capabilities used
### Bugfixes
- Fixed CVE-2020-1726, a security issue where volumes manually populated before first being mounted into a container could have those contents overwritten on first being mounted into a container
@@ -33,6 +35,8 @@
- Fixed a bug where the `--uts` flag to `podman create` and `podman run` would only allow specifying containers by full ID ([#5289](https://github.com/containers/libpod/issues/5289))
- Fixed a bug where rootless Podman could segfault when passed a large number of file descriptors
- Fixed a bug where the `podman port` command was incorrectly interpreting additional arguments as container names, instead of port numbers
+- Fixed a bug where units created by `podman generate systemd` did not depend on network targets, and so could start before the system network was ready ([#4130](https://github.com/containers/libpod/issues/4130))
+- Fixed a bug where exec sessions in containers which did not specify a user would not inherit supplemental groups added to the container via `--group-add`
### HTTP API
- Initial support for secure connections to servers via SSH tunneling has been added
@@ -47,7 +51,7 @@
- Many fixes have been made to API documentation to ensure it matches the code
### Misc
-- Updated vendored Buildah to v1.14.1
+- Updated vendored Buildah to v1.14.2
- Updated vendored containers/storage to v1.16.0
- The `Created` field to `podman images --format=json` has been renamed to `CreatedSince` as part of the fix for ([#5110](https://github.com/containers/libpod/issues/5110)). Go templates using the old name should still work
- The `CreatedTime` field to `podman images --format=json` has been renamed to `CreatedAt` as part of the fix for ([#5110](https://github.com/containers/libpod/issues/5110)). Go templates using the old name should still work
diff --git a/changelog.txt b/changelog.txt
index 84d6dcea0..9b0968265 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,56 @@
+- Changelog for v1.8.1-rc3 (2020-03-06)
+ * Update release notes for v1.8.1-RC3
+ * Part 2: try to clean up the long image instance names
+ * WIP: Try renaming long cirrus job names
+ * vendor: update github.com/containernetworking/cni to v0.7.2-0.20200304161608-4fae32b84921
+ * Removed extraneous comments and defaults plus amended variable declaration
+ * Removed the unnecessary code
+ * Implemented size parameter on GetContainer
+ * Implement size parameter on ListContainers
+ * Map configured status to created to match docker API states
+ * Fix to remove null entry from end of images json
+ * Register handlers without version to align with docker API
+ * golangci: enable goimports
+ * generate systemd: remove leading slashes
+ * exec: fix error code when conmon fails
+ * Vendor buildah 1.14.2
+ * env: don't set "container" env
+ * Fix podman image sign help output
+ * avoid adding to nil map
+ * Exec: use ErrorConmonRead
+ * exec: get the exit code from sync pipe instead of file
+ * generate systemd: add network dependencies
+ * Bump to Buildah v1.14.1
+ * APIv2 tests: add tests for stop
+ * Add the rmi flag to podman-run to delete container image
+ * consolidate env handling into pkg/env
+ * CI: format cirrus logs
+ * Update docs/source/markdown/podman-build.1.md
+ * Allow devs to set labels in container images for default capabilities.
+ * CI: add API v2 tests
+ * more swagger fixes
+ * Bump github.com/opencontainers/selinux from 1.3.2 to 1.3.3
+ * Add validate() for containers
+ * Cirrus: Fix gate image & false-positive exits
+ * Update pod bindings and Add test to validate prune pod apiv2 binding.
+ * Fix wrong condition in bindings test
+ * Ensure that exec sessions inherit supplemental groups
+ * Cirrus: Update VM images
+ * Cirrus: Force runc use in F30
+ * rework apiv2 wait endpoint|binding
+ * build: specify input fd to buildah
+ * Cirrus: Remove unnecessary handle_crun workaround
+ * Cirrus: Print env. vars at end of setup.
+ * Cirrus: Fix not growing Fedora root
+ * network create should use firewall plugin
+ * add firewall plugin (no backend) to default cni config
+ * binding tests for volumes
+ * Bump to v1.8.1-dev
+ * container Exists: fix URL
+ * CI: package_versions: include hostinfo, kernel
+ * Review comments
+ * [WIP] Add cmd flag to show container name in log
+
- Changelog for v1.8.1-rc2 (2020-02-27)
* Update release notes for v1.8.1-rc2
* Vendor in latest containers/buildah
diff --git a/cmd/podman/diff.go b/cmd/podman/diff.go
index f052b510d..c15512360 100644
--- a/cmd/podman/diff.go
+++ b/cmd/podman/diff.go
@@ -2,6 +2,7 @@ package main
import (
"fmt"
+
"github.com/containers/buildah/pkg/formats"
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/pkg/adapter"
diff --git a/cmd/podman/network_list.go b/cmd/podman/network_list.go
index 16edf743b..4f2380067 100644
--- a/cmd/podman/network_list.go
+++ b/cmd/podman/network_list.go
@@ -4,6 +4,7 @@ package main
import (
"errors"
+
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/pkg/adapter"
"github.com/containers/libpod/pkg/rootless"
diff --git a/cmd/podman/pod_pause.go b/cmd/podman/pod_pause.go
index 320072919..24fcee6b9 100644
--- a/cmd/podman/pod_pause.go
+++ b/cmd/podman/pod_pause.go
@@ -2,6 +2,7 @@ package main
import (
"fmt"
+
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
diff --git a/contrib/cirrus/lib.sh b/contrib/cirrus/lib.sh
index 1ffe554e9..5895d84f4 100644
--- a/contrib/cirrus/lib.sh
+++ b/contrib/cirrus/lib.sh
@@ -68,9 +68,9 @@ export FEDORA_BASE_IMAGE="fedora-cloud-base-31-1-9-1578586410"
export PRIOR_FEDORA_BASE_IMAGE="fedora-cloud-base-30-1-2-1578586410"
export BUILT_IMAGE_SUFFIX="${BUILT_IMAGE_SUFFIX:--$CIRRUS_REPO_NAME-${CIRRUS_BUILD_ID}}"
# IN_PODMAN container image
-IN_PODMAN_IMAGE="quay.io/libpod/in_podman:latest"
+IN_PODMAN_IMAGE="quay.io/libpod/in_podman:$DEST_BRANCH"
# Image for uploading releases
-UPLDREL_IMAGE="quay.io/libpod/upldrel:latest"
+UPLDREL_IMAGE="quay.io/libpod/upldrel:master"
# Avoid getting stuck waiting for user input
export DEBIAN_FRONTEND="noninteractive"
diff --git a/contrib/gate/Dockerfile b/contrib/gate/Dockerfile
index 2a904a202..54bd2cbde 100644
--- a/contrib/gate/Dockerfile
+++ b/contrib/gate/Dockerfile
@@ -33,31 +33,36 @@ RUN dnf -y install \
zip \
&& dnf clean all
-ENV GOPATH="/go" \
- PATH="/go/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" \
+ENV GOPATH="/var/tmp/go" \
+ GOBIN="/var/tmp/go/bin" \
+ PATH="/var/tmp/go/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" \
SRCPATH="/usr/src/libpod" \
- GOSRC="/go/src/github.com/containers/libpod"
+ GOSRC="/var/tmp/go/src/github.com/containers/libpod"
-# Only needed for installing build-time dependencies
+# Only needed for installing build-time dependencies, then will be removed
COPY / $GOSRC
-WORKDIR $GOSRC
-
# Install dependencies
RUN set -x && \
+ mkdir -p "$GOBIN" && \
+ mkdir -p /etc/cni/net.d && \
+ mkdir -p /etc/containers && \
install -D -m 755 $GOSRC/contrib/gate/entrypoint.sh /usr/local/bin/ && \
- python3 -m pip install pre-commit && \
- rm -rf "$GOSRC"
+ python3 -m pip install pre-commit
# Install cni config
-#RUN make install.cni
-RUN mkdir -p /etc/cni/net.d/
COPY cni/87-podman-bridge.conflist /etc/cni/net.d/87-podman-bridge.conflist
-
# Make sure we have some policy for pulling images
-RUN mkdir -p /etc/containers
COPY test/policy.json /etc/containers/policy.json
COPY test/redhat_sigstore.yaml /etc/containers/registries.d/registry.access.redhat.com.yaml
+WORKDIR "$GOSRC"
+RUN make install.tools && \
+ cd / && \
+ rm -rf "$GOSRC" && \
+ mkdir -p "$GOSRC"
VOLUME ["/usr/src/libpod"]
+# This entrypoint will synchronize the above volume ($SRCPATH) to $GOSRC before
+# executing make. This ensures the original source remains prestine and is never
+# modified by any lint/validation checks.
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
diff --git a/contrib/gate/README.md b/contrib/gate/README.md
index 709e6035f..fe1205dc5 100644
--- a/contrib/gate/README.md
+++ b/contrib/gate/README.md
@@ -1,4 +1,6 @@
![PODMAN logo](../../logo/podman-logo-source.svg)
-A standard container image for `gofmt` and lint-checking the libpod
-repository. The [contributors guide contains the documentation for usage.](https://github.com/containers/libpod/blob/master/CONTRIBUTING.md#go-format-and-lint)
+A standard container image for lint-checking and validating changes to the libpod
+repository. The
+[contributors guide contains the documentation for usage.](https://github.com/containers/libpod/blob/master/CONTRIBUTING.md#go-format-and-lint). Note that this container image is also utilized
+in automation, see the file [.cirrus.yml](.cirrus.yml)
diff --git a/contrib/gate/entrypoint.sh b/contrib/gate/entrypoint.sh
index 0189cf7c5..ab6528e00 100755
--- a/contrib/gate/entrypoint.sh
+++ b/contrib/gate/entrypoint.sh
@@ -1,15 +1,23 @@
#!/bin/bash
-[[ -n "$SRCPATH" ]] || \
- ( echo "ERROR: \$SRCPATH must be non-empty" && exit 1 )
-[[ -n "$GOSRC" ]] || \
- ( echo "ERROR: \$GOSRC must be non-empty" && exit 2 )
+set -e
+
+die() {
+ echo "${2:-FATAL ERROR (but no message given!)} (gate container entrypoint)"
+ exit ${1:-1}
+}
+
+[[ -n "$SRCPATH" ]] || die 1 "ERROR: \$SRCPATH must be non-empty"
+[[ -n "$GOPATH" ]] || die 2 "ERROR: \$GOPATH must be non-empty"
+[[ -n "$GOSRC" ]] || die 3 "ERROR: \$GOSRC must be non-empty"
[[ -r "${SRCPATH}/contrib/gate/Dockerfile" ]] || \
- ( echo "ERROR: Expecting libpod repository root at $SRCPATH" && exit 3 )
+ die 4 "ERROR: Expecting libpod repository root at $SRCPATH"
# Working from a copy avoids needing to perturb the actual source files
-mkdir -p "$GOSRC"
+# if/when developers use gate container for local testing
+echo "Copying $SRCPATH to $GOSRC"
+mkdir -vp "$GOSRC"
/usr/bin/rsync --recursive --links --quiet --safe-links \
--perms --times --delete "${SRCPATH}/" "${GOSRC}/"
cd "$GOSRC"
-make "$@"
+exec make "$@"
diff --git a/go.mod b/go.mod
index 0b9dde972..8d688e56c 100644
--- a/go.mod
+++ b/go.mod
@@ -6,7 +6,7 @@ require (
github.com/BurntSushi/toml v0.3.1
github.com/buger/goterm v0.0.0-20181115115552-c206103e1f37
github.com/checkpoint-restore/go-criu v0.0.0-20190109184317-bdb7599cd87b
- github.com/containernetworking/cni v0.7.2-0.20190904153231-83439463f784
+ github.com/containernetworking/cni v0.7.2-0.20200304161608-4fae32b84921
github.com/containernetworking/plugins v0.8.5
github.com/containers/buildah v1.14.2
github.com/containers/common v0.4.2
diff --git a/go.sum b/go.sum
index 9123735d7..c297b1894 100644
--- a/go.sum
+++ b/go.sum
@@ -66,6 +66,8 @@ github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kw
github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
github.com/containernetworking/cni v0.7.2-0.20190904153231-83439463f784 h1:rqUVLD8I859xRgUx/WMC3v7QAFqbLKZbs+0kqYboRJc=
github.com/containernetworking/cni v0.7.2-0.20190904153231-83439463f784/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
+github.com/containernetworking/cni v0.7.2-0.20200304161608-4fae32b84921 h1:eUMd8hlGasYcg1tBqETZtxaW3a7EIxqY7Z1g65gcKQg=
+github.com/containernetworking/cni v0.7.2-0.20200304161608-4fae32b84921/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
github.com/containernetworking/plugins v0.8.5 h1:pCvEMrFf7yzJI8+/D/7jkvE96KD52b7/Eu+jpahihy8=
github.com/containernetworking/plugins v0.8.5/go.mod h1:UZ2539umj8djuRQmBxuazHeJbYrLV8BSBejkk+she6o=
github.com/containers/buildah v1.13.1 h1:EdhllQxXmOZ56mGFf68AkrpIj9XtEkkGq0WaPWFuGM0=
diff --git a/hack/get_release_info.sh b/hack/get_release_info.sh
index c2be6a270..c1c694a44 100755
--- a/hack/get_release_info.sh
+++ b/hack/get_release_info.sh
@@ -6,8 +6,7 @@
set -euo pipefail
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
-cd "${GOSRC:-${DIR}/../}"
+cd "${GOSRC:-$(dirname $0)/../}"
valid_args() {
REGEX='^\s+[[:upper:]]+\*[)]'
diff --git a/hack/install_golangci.sh b/hack/install_golangci.sh
index 430685a71..6ef8ce823 100755
--- a/hack/install_golangci.sh
+++ b/hack/install_golangci.sh
@@ -1,17 +1,17 @@
#!/bin/bash
-if [ -z "$VERSION" ]; then
- echo \$VERSION is empty
- exit 1
-fi
+set -e
-if [ -z "$GOBIN" ]; then
- echo \$GOBIN is empty
- exit 1
-fi
+die() { echo "${1:-No error message given} (from $(basename $0))"; exit 1; }
+
+[ -n "$VERSION" ] || die "\$VERSION is empty or undefined"
+[ -n "$GOBIN" ] || die "\$GOBIN is empty or undefined"
-$GOBIN/golangci-lint --version | grep $VERSION
-if [ $? -ne 0 ]; then
- set -e
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOBIN v$VERSION
+BIN="$GOBIN/golangci-lint"
+if [ ! -x "$BIN" ]; then
+ echo "Installing golangci-lint v$VERSION into $GOBIN"
+ curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOBIN v$VERSION
+else
+ # Prints it's own file name as part of --verison output
+ echo "Using existing $(dirname $BIN)/$($BIN --version)"
fi
diff --git a/libpod/image/filters.go b/libpod/image/filters.go
index c54ca6333..8ca3526a0 100644
--- a/libpod/image/filters.go
+++ b/libpod/image/filters.go
@@ -3,13 +3,13 @@ package image
import (
"context"
"fmt"
- "github.com/pkg/errors"
"path/filepath"
"strconv"
"strings"
"time"
"github.com/containers/libpod/pkg/inspect"
+ "github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index d57b1a8eb..5a27a2abb 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -117,10 +117,10 @@ func (r *Runtime) configureNetNS(ctr *Container, ctrNS ns.NetNS) ([]*cnitypes.Re
networkStatus := make([]*cnitypes.Result, 0)
for idx, r := range results {
- logrus.Debugf("[%d] CNI result: %v", idx, r.Result.String())
+ logrus.Debugf("[%d] CNI result: %v", idx, r.Result)
resultCurrent, err := cnitypes.GetResult(r.Result)
if err != nil {
- return nil, errors.Wrapf(err, "error parsing CNI plugin result %q: %v", r.Result.String(), err)
+ return nil, errors.Wrapf(err, "error parsing CNI plugin result %q: %v", r.Result, err)
}
networkStatus = append(networkStatus, resultCurrent)
}
diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go
index bae1c1ed8..6c45a2300 100644
--- a/libpod/runtime_img.go
+++ b/libpod/runtime_img.go
@@ -21,7 +21,7 @@ import (
"github.com/containers/image/v5/directory"
dockerarchive "github.com/containers/image/v5/docker/archive"
ociarchive "github.com/containers/image/v5/oci/archive"
- "github.com/opencontainers/image-spec/specs-go/v1"
+ v1 "github.com/opencontainers/image-spec/specs-go/v1"
)
// Runtime API
diff --git a/libpod/runtime_pod_infra_linux.go b/libpod/runtime_pod_infra_linux.go
index da46f03e8..27735a9b2 100644
--- a/libpod/runtime_pod_infra_linux.go
+++ b/libpod/runtime_pod_infra_linux.go
@@ -10,7 +10,7 @@ import (
"github.com/containers/libpod/libpod/image"
"github.com/containers/libpod/pkg/rootless"
"github.com/containers/libpod/pkg/util"
- "github.com/opencontainers/image-spec/specs-go/v1"
+ v1 "github.com/opencontainers/image-spec/specs-go/v1"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/opencontainers/runtime-tools/generate"
"github.com/pkg/errors"
diff --git a/libpod/storage.go b/libpod/storage.go
index 6375d031b..d675f4ffe 100644
--- a/libpod/storage.go
+++ b/libpod/storage.go
@@ -8,7 +8,7 @@ import (
"github.com/containers/image/v5/types"
"github.com/containers/libpod/libpod/define"
"github.com/containers/storage"
- "github.com/opencontainers/image-spec/specs-go/v1"
+ v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
diff --git a/pkg/api/handlers/containers.go b/pkg/api/handlers/containers.go
index ee080e794..31cbde229 100644
--- a/pkg/api/handlers/containers.go
+++ b/pkg/api/handlers/containers.go
@@ -2,12 +2,12 @@ package handlers
import (
"fmt"
- "github.com/docker/docker/api/types"
"net/http"
"github.com/containers/libpod/libpod"
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/docker/docker/api/types"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/generic/containers.go b/pkg/api/handlers/generic/containers.go
index ab587ded4..b8460702c 100644
--- a/pkg/api/handlers/generic/containers.go
+++ b/pkg/api/handlers/generic/containers.go
@@ -57,6 +57,7 @@ func ListContainers(w http.ResponseWriter, r *http.Request) {
}{
// override any golang type defaults
}
+
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
return
@@ -85,7 +86,7 @@ func ListContainers(w http.ResponseWriter, r *http.Request) {
var list = make([]*handlers.Container, len(containers))
for i, ctnr := range containers {
- api, err := handlers.LibpodToContainer(ctnr, infoData)
+ api, err := handlers.LibpodToContainer(ctnr, infoData, query.Size)
if err != nil {
utils.InternalServerError(w, err)
return
@@ -97,6 +98,17 @@ func ListContainers(w http.ResponseWriter, r *http.Request) {
func GetContainer(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
+ decoder := r.Context().Value("decoder").(*schema.Decoder)
+ query := struct {
+ Size bool `schema:"size"`
+ }{
+ // override any golang type defaults
+ }
+
+ if err := decoder.Decode(&query, r.URL.Query()); err != nil {
+ utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
+ return
+ }
name := utils.GetName(r)
ctnr, err := runtime.LookupContainer(name)
@@ -104,7 +116,7 @@ func GetContainer(w http.ResponseWriter, r *http.Request) {
utils.ContainerNotFound(w, name, err)
return
}
- api, err := handlers.LibpodToContainerJSON(ctnr)
+ api, err := handlers.LibpodToContainerJSON(ctnr, query.Size)
if err != nil {
utils.InternalServerError(w, err)
return
diff --git a/pkg/api/handlers/generic/images.go b/pkg/api/handlers/generic/images.go
index 1ced499d9..3da5807ec 100644
--- a/pkg/api/handlers/generic/images.go
+++ b/pkg/api/handlers/generic/images.go
@@ -305,7 +305,7 @@ func GetImages(w http.ResponseWriter, r *http.Request) {
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Failed get images"))
return
}
- var summaries = make([]*handlers.ImageSummary, len(images)+1)
+ var summaries = make([]*handlers.ImageSummary, len(images))
for j, img := range images {
is, err := handlers.ImageToImageSummary(img)
if err != nil {
diff --git a/pkg/api/handlers/types.go b/pkg/api/handlers/types.go
index 2930a9567..2e429dc58 100644
--- a/pkg/api/handlers/types.go
+++ b/pkg/api/handlers/types.go
@@ -347,7 +347,7 @@ func ImageDataToImageInspect(ctx context.Context, l *libpodImage.Image) (*ImageI
}
-func LibpodToContainer(l *libpod.Container, infoData []define.InfoData) (*Container, error) {
+func LibpodToContainer(l *libpod.Container, infoData []define.InfoData, sz bool) (*Container, error) {
imageId, imageName := l.Image()
var (
@@ -360,11 +360,18 @@ func LibpodToContainer(l *libpod.Container, infoData []define.InfoData) (*Contai
if state, err = l.State(); err != nil {
return nil, err
}
- if sizeRW, err = l.RWSize(); err != nil {
- return nil, err
+ stateStr := state.String()
+ if stateStr == "configured" {
+ stateStr = "created"
}
- if sizeRootFs, err = l.RootFsSize(); err != nil {
- return nil, err
+
+ if sz {
+ if sizeRW, err = l.RWSize(); err != nil {
+ return nil, err
+ }
+ if sizeRootFs, err = l.RootFsSize(); err != nil {
+ return nil, err
+ }
}
return &Container{docker.Container{
@@ -378,7 +385,7 @@ func LibpodToContainer(l *libpod.Container, infoData []define.InfoData) (*Contai
SizeRw: sizeRW,
SizeRootFs: sizeRootFs,
Labels: l.Labels(),
- State: string(state),
+ State: stateStr,
Status: "",
HostConfig: struct {
NetworkMode string `json:",omitempty"`
@@ -391,9 +398,9 @@ func LibpodToContainer(l *libpod.Container, infoData []define.InfoData) (*Contai
}, nil
}
-func LibpodToContainerJSON(l *libpod.Container) (*docker.ContainerJSON, error) {
+func LibpodToContainerJSON(l *libpod.Container, sz bool) (*docker.ContainerJSON, error) {
_, imageName := l.Image()
- inspect, err := l.Inspect(true)
+ inspect, err := l.Inspect(sz)
if err != nil {
return nil, err
}
diff --git a/pkg/api/handlers/utils/handler.go b/pkg/api/handlers/utils/handler.go
index 44bcc794c..32b8c5b0a 100644
--- a/pkg/api/handlers/utils/handler.go
+++ b/pkg/api/handlers/utils/handler.go
@@ -3,7 +3,6 @@ package utils
import (
"encoding/json"
"fmt"
- "github.com/pkg/errors"
"io"
"net/http"
"net/url"
@@ -11,6 +10,7 @@ import (
"strings"
"github.com/gorilla/mux"
+ "github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
diff --git a/pkg/api/server/register_auth.go b/pkg/api/server/register_auth.go
index 8db131153..7e51c2b63 100644
--- a/pkg/api/server/register_auth.go
+++ b/pkg/api/server/register_auth.go
@@ -7,5 +7,7 @@ import (
func (s *APIServer) registerAuthHandlers(r *mux.Router) error {
r.Handle(VersionedPath("/auth"), s.APIHandler(handlers.UnsupportedHandler))
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/auth", s.APIHandler(handlers.UnsupportedHandler))
return nil
}
diff --git a/pkg/api/server/register_containers.go b/pkg/api/server/register_containers.go
index 6aad7ff88..a87e8eaee 100644
--- a/pkg/api/server/register_containers.go
+++ b/pkg/api/server/register_containers.go
@@ -34,6 +34,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/create"), s.APIHandler(generic.CreateContainer)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/create", s.APIHandler(generic.CreateContainer)).Methods(http.MethodPost)
// swagger:operation GET /containers/json compat listContainers
// ---
// tags:
@@ -84,6 +86,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/json"), s.APIHandler(generic.ListContainers)).Methods(http.MethodGet)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/json", s.APIHandler(generic.ListContainers)).Methods(http.MethodGet)
// swagger:operation POST /containers/prune compat pruneContainers
// ---
// tags:
@@ -106,6 +110,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/prune"), s.APIHandler(handlers.PruneContainers)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/prune", s.APIHandler(handlers.PruneContainers)).Methods(http.MethodPost)
// swagger:operation DELETE /containers/{name} compat removeContainer
// ---
// tags:
@@ -145,6 +151,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/{name}"), s.APIHandler(generic.RemoveContainer)).Methods(http.MethodDelete)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/{name}", s.APIHandler(generic.RemoveContainer)).Methods(http.MethodDelete)
// swagger:operation GET /containers/{name}/json compat getContainer
// ---
// tags:
@@ -172,6 +180,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/{name}/json"), s.APIHandler(generic.GetContainer)).Methods(http.MethodGet)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/{name}/json", s.APIHandler(generic.GetContainer)).Methods(http.MethodGet)
// swagger:operation POST /containers/{name}/kill compat killContainer
// ---
// tags:
@@ -202,6 +212,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/{name}/kill"), s.APIHandler(generic.KillContainer)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/{name}/kill", s.APIHandler(generic.KillContainer)).Methods(http.MethodPost)
// swagger:operation GET /containers/{name}/logs compat logsFromContainer
// ---
// tags:
@@ -254,6 +266,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/{name}/logs"), s.APIHandler(generic.LogsFromContainer)).Methods(http.MethodGet)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/{name}/logs", s.APIHandler(generic.LogsFromContainer)).Methods(http.MethodGet)
// swagger:operation POST /containers/{name}/pause compat pauseContainer
// ---
// tags:
@@ -276,7 +290,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/{name}/pause"), s.APIHandler(handlers.PauseContainer)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/{name}/pause", s.APIHandler(handlers.PauseContainer)).Methods(http.MethodPost)
r.HandleFunc(VersionedPath("/containers/{name}/rename"), s.APIHandler(handlers.UnsupportedHandler)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/{name}/rename", s.APIHandler(handlers.UnsupportedHandler)).Methods(http.MethodPost)
// swagger:operation POST /containers/{name}/restart compat restartContainer
// ---
// tags:
@@ -302,6 +320,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/{name}/restart"), s.APIHandler(handlers.RestartContainer)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/{name}/restart", s.APIHandler(handlers.RestartContainer)).Methods(http.MethodPost)
// swagger:operation POST /containers/{name}/start compat startContainer
// ---
// tags:
@@ -330,6 +350,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/{name}/start"), s.APIHandler(handlers.StartContainer)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/{name}/start", s.APIHandler(handlers.StartContainer)).Methods(http.MethodPost)
// swagger:operation GET /containers/{name}/stats compat statsContainer
// ---
// tags:
@@ -357,6 +379,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/{name}/stats"), s.APIHandler(generic.StatsContainer)).Methods(http.MethodGet)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/{name}/stats", s.APIHandler(generic.StatsContainer)).Methods(http.MethodGet)
// swagger:operation POST /containers/{name}/stop compat stopContainer
// ---
// tags:
@@ -385,6 +409,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/{name}/stop"), s.APIHandler(handlers.StopContainer)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/{name}/stop", s.APIHandler(handlers.StopContainer)).Methods(http.MethodPost)
// swagger:operation GET /containers/{name}/top compat topContainer
// ---
// tags:
@@ -410,6 +436,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/{name}/top"), s.APIHandler(handlers.TopContainer)).Methods(http.MethodGet)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/{name}/top", s.APIHandler(handlers.TopContainer)).Methods(http.MethodGet)
// swagger:operation POST /containers/{name}/unpause compat unpauseContainer
// ---
// tags:
@@ -432,6 +460,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/{name}/unpause"), s.APIHandler(handlers.UnpauseContainer)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/{name}/unpause", s.APIHandler(handlers.UnpauseContainer)).Methods(http.MethodPost)
// swagger:operation POST /containers/{name}/wait compat waitContainer
// ---
// tags:
@@ -465,6 +495,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/{name}/wait"), s.APIHandler(generic.WaitContainer)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/{name}/wait", s.APIHandler(generic.WaitContainer)).Methods(http.MethodPost)
// swagger:operation POST /containers/{name}/attach compat attachContainer
// ---
// tags:
@@ -520,6 +552,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/{name}/attach"), s.APIHandler(handlers.AttachContainer)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/{name}/attach", s.APIHandler(handlers.AttachContainer)).Methods(http.MethodPost)
// swagger:operation POST /containers/{name}/resize compat resizeContainer
// ---
// tags:
@@ -552,6 +586,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/{name}/resize"), s.APIHandler(handlers.ResizeContainer)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/containers/{name}/resize", s.APIHandler(handlers.ResizeContainer)).Methods(http.MethodPost)
/*
libpod endpoints
diff --git a/pkg/api/server/register_distribution.go b/pkg/api/server/register_distribution.go
index f03662224..730129d5d 100644
--- a/pkg/api/server/register_distribution.go
+++ b/pkg/api/server/register_distribution.go
@@ -7,5 +7,7 @@ import (
func (s *APIServer) registerDistributionHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/distribution/{name}/json"), handlers.UnsupportedHandler)
+ // Added non version path to URI to support docker non versioned paths
+ r.HandleFunc("/distribution/{name}/json", handlers.UnsupportedHandler)
return nil
}
diff --git a/pkg/api/server/register_events.go b/pkg/api/server/register_events.go
index bc3b62662..ea5d21882 100644
--- a/pkg/api/server/register_events.go
+++ b/pkg/api/server/register_events.go
@@ -35,5 +35,7 @@ func (s *APIServer) registerEventsHandlers(r *mux.Router) error {
// 500:
// "$ref": "#/responses/InternalError"
r.Handle(VersionedPath("/events"), s.APIHandler(handlers.GetEvents)).Methods(http.MethodGet)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/events", s.APIHandler(handlers.GetEvents)).Methods(http.MethodGet)
return nil
}
diff --git a/pkg/api/server/register_exec.go b/pkg/api/server/register_exec.go
index ad62de3f5..76033a9ca 100644
--- a/pkg/api/server/register_exec.go
+++ b/pkg/api/server/register_exec.go
@@ -75,6 +75,8 @@ func (s *APIServer) registerExecHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/containers/{name}/create"), s.APIHandler(handlers.CreateExec)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/containers/{name}/create", s.APIHandler(handlers.CreateExec)).Methods(http.MethodPost)
// swagger:operation POST /exec/{id}/start compat startExec
// ---
// tags:
@@ -111,6 +113,8 @@ func (s *APIServer) registerExecHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/exec/{id}/start"), s.APIHandler(handlers.StartExec)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/exec/{id}/start", s.APIHandler(handlers.StartExec)).Methods(http.MethodPost)
// swagger:operation POST /exec/{id}/resize compat resizeExec
// ---
// tags:
@@ -142,6 +146,8 @@ func (s *APIServer) registerExecHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/exec/{id}/resize"), s.APIHandler(handlers.ResizeExec)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/exec/{id}/resize", s.APIHandler(handlers.ResizeExec)).Methods(http.MethodPost)
// swagger:operation GET /exec/{id}/json compat inspectExec
// ---
// tags:
@@ -164,6 +170,8 @@ func (s *APIServer) registerExecHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/exec/{id}/json"), s.APIHandler(handlers.InspectExec)).Methods(http.MethodGet)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/exec/{id}/json", s.APIHandler(handlers.InspectExec)).Methods(http.MethodGet)
/*
libpod api follows
diff --git a/pkg/api/server/register_images.go b/pkg/api/server/register_images.go
index db04ecdc9..622d8f421 100644
--- a/pkg/api/server/register_images.go
+++ b/pkg/api/server/register_images.go
@@ -48,7 +48,11 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/images/create"), s.APIHandler(generic.CreateImageFromImage)).Methods(http.MethodPost).Queries("fromImage", "{fromImage}")
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/images/create", s.APIHandler(generic.CreateImageFromImage)).Methods(http.MethodPost).Queries("fromImage", "{fromImage}")
r.Handle(VersionedPath("/images/create"), s.APIHandler(generic.CreateImageFromSrc)).Methods(http.MethodPost).Queries("fromSrc", "{fromSrc}")
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/images/create", s.APIHandler(generic.CreateImageFromSrc)).Methods(http.MethodPost).Queries("fromSrc", "{fromSrc}")
// swagger:operation GET /images/json compat listImages
// ---
// tags:
@@ -84,6 +88,8 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/images/json"), s.APIHandler(generic.GetImages)).Methods(http.MethodGet)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/images/json", s.APIHandler(generic.GetImages)).Methods(http.MethodGet)
// swagger:operation POST /images/load compat importImage
// ---
// tags:
@@ -108,6 +114,8 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/images/load"), s.APIHandler(generic.LoadImages)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/images/load", s.APIHandler(generic.LoadImages)).Methods(http.MethodPost)
// swagger:operation POST /images/prune compat pruneImages
// ---
// tags:
@@ -133,6 +141,8 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/images/prune"), s.APIHandler(generic.PruneImages)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/images/prune", s.APIHandler(generic.PruneImages)).Methods(http.MethodPost)
// swagger:operation GET /images/search compat searchImages
// ---
// tags:
@@ -166,6 +176,8 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/images/search"), s.APIHandler(handlers.SearchImages)).Methods(http.MethodGet)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/images/search", s.APIHandler(handlers.SearchImages)).Methods(http.MethodGet)
// swagger:operation DELETE /images/{name:.*} compat removeImage
// ---
// tags:
@@ -198,6 +210,8 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/images/{name:.*}"), s.APIHandler(handlers.RemoveImage)).Methods(http.MethodDelete)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/images/{name:.*}", s.APIHandler(handlers.RemoveImage)).Methods(http.MethodDelete)
// swagger:operation GET /images/{name:.*}/get compat exportImage
// ---
// tags:
@@ -221,6 +235,8 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/images/{name:.*}/get"), s.APIHandler(generic.ExportImage)).Methods(http.MethodGet)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/images/{name:.*}/get", s.APIHandler(generic.ExportImage)).Methods(http.MethodGet)
// swagger:operation GET /images/{name:.*}/history compat imageHistory
// ---
// tags:
@@ -243,6 +259,8 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/images/{name:.*}/history"), s.APIHandler(handlers.HistoryImage)).Methods(http.MethodGet)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/images/{name:.*}/history", s.APIHandler(handlers.HistoryImage)).Methods(http.MethodGet)
// swagger:operation GET /images/{name:.*}/json compat inspectImage
// ---
// tags:
@@ -265,6 +283,8 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/images/{name:.*}/json"), s.APIHandler(generic.GetImage)).Methods(http.MethodGet)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/images/{name:.*}/json", s.APIHandler(generic.GetImage)).Methods(http.MethodGet)
// swagger:operation POST /images/{name:.*}/tag compat tagImage
// ---
// tags:
@@ -299,6 +319,8 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/images/{name:.*}/tag"), s.APIHandler(handlers.TagImage)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/images/{name:.*}/tag", s.APIHandler(handlers.TagImage)).Methods(http.MethodPost)
// swagger:operation POST /commit compat commitContainer
// ---
// tags:
@@ -344,6 +366,8 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/commit"), s.APIHandler(generic.CommitContainer)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/commit", s.APIHandler(generic.CommitContainer)).Methods(http.MethodPost)
// swagger:operation POST /build compat buildImage
// ---
@@ -554,6 +578,8 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/build"), s.APIHandler(handlers.BuildImage)).Methods(http.MethodPost)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/build", s.APIHandler(handlers.BuildImage)).Methods(http.MethodPost)
/*
libpod endpoints
*/
diff --git a/pkg/api/server/register_info.go b/pkg/api/server/register_info.go
index 36c467cc3..975a19fef 100644
--- a/pkg/api/server/register_info.go
+++ b/pkg/api/server/register_info.go
@@ -22,5 +22,7 @@ func (s *APIServer) registerInfoHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/info"), s.APIHandler(generic.GetInfo)).Methods(http.MethodGet)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/info", s.APIHandler(generic.GetInfo)).Methods(http.MethodGet)
return nil
}
diff --git a/pkg/api/server/register_monitor.go b/pkg/api/server/register_monitor.go
index dbe0d27ce..b821efbaa 100644
--- a/pkg/api/server/register_monitor.go
+++ b/pkg/api/server/register_monitor.go
@@ -7,5 +7,7 @@ import (
func (s *APIServer) registerMonitorHandlers(r *mux.Router) error {
r.Handle(VersionedPath("/monitor"), s.APIHandler(handlers.UnsupportedHandler))
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/monitor", s.APIHandler(handlers.UnsupportedHandler))
return nil
}
diff --git a/pkg/api/server/register_plugins.go b/pkg/api/server/register_plugins.go
index 479a79d1f..50026f6ad 100644
--- a/pkg/api/server/register_plugins.go
+++ b/pkg/api/server/register_plugins.go
@@ -7,5 +7,7 @@ import (
func (s *APIServer) registerPluginsHandlers(r *mux.Router) error {
r.Handle(VersionedPath("/plugins"), s.APIHandler(handlers.UnsupportedHandler))
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/plugins", s.APIHandler(handlers.UnsupportedHandler))
return nil
}
diff --git a/pkg/api/server/register_swarm.go b/pkg/api/server/register_swarm.go
index e37ac4e41..8a5588268 100644
--- a/pkg/api/server/register_swarm.go
+++ b/pkg/api/server/register_swarm.go
@@ -16,6 +16,14 @@ func (s *APIServer) registerSwarmHandlers(r *mux.Router) error {
r.PathPrefix("/v{version:[0-9.]+}/services/").HandlerFunc(noSwarm)
r.PathPrefix("/v{version:[0-9.]+}/swarm/").HandlerFunc(noSwarm)
r.PathPrefix("/v{version:[0-9.]+}/tasks/").HandlerFunc(noSwarm)
+
+ // Added non version path to URI to support docker non versioned paths
+ r.PathPrefix("/configs/").HandlerFunc(noSwarm)
+ r.PathPrefix("/nodes/").HandlerFunc(noSwarm)
+ r.PathPrefix("/secrets/").HandlerFunc(noSwarm)
+ r.PathPrefix("/services/").HandlerFunc(noSwarm)
+ r.PathPrefix("/swarm/").HandlerFunc(noSwarm)
+ r.PathPrefix("/tasks/").HandlerFunc(noSwarm)
return nil
}
diff --git a/pkg/api/server/register_system.go b/pkg/api/server/register_system.go
index 188c1cdac..4776692f5 100644
--- a/pkg/api/server/register_system.go
+++ b/pkg/api/server/register_system.go
@@ -9,5 +9,7 @@ import (
func (s *APIServer) registerSystemHandlers(r *mux.Router) error {
r.Handle(VersionedPath("/system/df"), s.APIHandler(generic.GetDiskUsage)).Methods(http.MethodGet)
+ // Added non version path to URI to support docker non versioned paths
+ r.Handle("/system/df", s.APIHandler(generic.GetDiskUsage)).Methods(http.MethodGet)
return nil
}
diff --git a/pkg/apparmor/apparmor.go b/pkg/apparmor/apparmor.go
index 45c029c07..1e824550d 100644
--- a/pkg/apparmor/apparmor.go
+++ b/pkg/apparmor/apparmor.go
@@ -2,6 +2,7 @@ package apparmor
import (
"errors"
+
libpodVersion "github.com/containers/libpod/version"
)
diff --git a/pkg/bindings/containers/healthcheck.go b/pkg/bindings/containers/healthcheck.go
index dc607c1b3..3f94fad01 100644
--- a/pkg/bindings/containers/healthcheck.go
+++ b/pkg/bindings/containers/healthcheck.go
@@ -2,10 +2,10 @@ package containers
import (
"context"
- "github.com/containers/libpod/pkg/bindings"
"net/http"
"github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/pkg/bindings"
)
// RunHealthCheck executes the container's healthcheck and returns the health status of the
diff --git a/pkg/hooks/exec/exec.go b/pkg/hooks/exec/exec.go
index 4038e3d94..77b350573 100644
--- a/pkg/hooks/exec/exec.go
+++ b/pkg/hooks/exec/exec.go
@@ -5,13 +5,13 @@ import (
"bytes"
"context"
"fmt"
- "github.com/sirupsen/logrus"
"io"
osexec "os/exec"
"time"
rspec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
+ "github.com/sirupsen/logrus"
)
// DefaultPostKillTimeout is the recommended default post-kill timeout.
diff --git a/pkg/lookup/lookup.go b/pkg/lookup/lookup.go
index a249dd753..dff25f74f 100644
--- a/pkg/lookup/lookup.go
+++ b/pkg/lookup/lookup.go
@@ -4,7 +4,7 @@ import (
"os"
"strconv"
- "github.com/cyphar/filepath-securejoin"
+ securejoin "github.com/cyphar/filepath-securejoin"
"github.com/opencontainers/runc/libcontainer/user"
"github.com/sirupsen/logrus"
)
diff --git a/pkg/specgen/create.go b/pkg/specgen/create.go
index 34f9ffac2..e6ac53016 100644
--- a/pkg/specgen/create.go
+++ b/pkg/specgen/create.go
@@ -2,12 +2,13 @@ package specgen
import (
"context"
+ "os"
+
"github.com/containers/libpod/libpod"
"github.com/containers/libpod/libpod/config"
"github.com/containers/libpod/libpod/define"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
- "os"
)
// MakeContainer creates a container based on the SpecGenerator
diff --git a/pkg/systemd/generate/systemdgen.go b/pkg/systemd/generate/systemdgen.go
index 999a65126..00ddc63f3 100644
--- a/pkg/systemd/generate/systemdgen.go
+++ b/pkg/systemd/generate/systemdgen.go
@@ -96,11 +96,11 @@ Before={{- range $index, $value := .RequiredServices -}}{{if $index}} {{end}}{{
[Service]
Restart={{.RestartPolicy}}
{{- if .New}}
-ExecStartPre=/usr/bin/rm -f /%t/%n-pid /%t/%n-cid
+ExecStartPre=/usr/bin/rm -f %t/%n-pid %t/%n-cid
ExecStart={{.RunCommand}}
-ExecStop={{.Executable}} stop --ignore --cidfile /%t/%n-cid {{if (ge .StopTimeout 0)}}-t {{.StopTimeout}}{{end}}
-ExecStopPost={{.Executable}} rm --ignore -f --cidfile /%t/%n-cid
-PIDFile=/%t/%n-pid
+ExecStop={{.Executable}} stop --ignore --cidfile %t/%n-cid {{if (ge .StopTimeout 0)}}-t {{.StopTimeout}}{{end}}
+ExecStopPost={{.Executable}} rm --ignore -f --cidfile %t/%n-cid
+PIDFile=%t/%n-pid
{{- else}}
ExecStart={{.Executable}} start {{.ContainerName}}
ExecStop={{.Executable}} stop {{if (ge .StopTimeout 0)}}-t {{.StopTimeout}}{{end}} {{.ContainerName}}
@@ -160,8 +160,8 @@ func CreateContainerSystemdUnit(info *ContainerInfo, opts Options) (string, erro
command := []string{
info.Executable,
"run",
- "--conmon-pidfile", "/%t/%n-pid",
- "--cidfile", "/%t/%n-cid",
+ "--conmon-pidfile", "%t/%n-pid",
+ "--cidfile", "%t/%n-cid",
"--cgroups=no-conmon",
}
command = append(command, info.CreateCommand[index:]...)
diff --git a/pkg/systemd/generate/systemdgen_test.go b/pkg/systemd/generate/systemdgen_test.go
index a68a02d33..145296ea9 100644
--- a/pkg/systemd/generate/systemdgen_test.go
+++ b/pkg/systemd/generate/systemdgen_test.go
@@ -131,11 +131,11 @@ After=network-online.target
[Service]
Restart=always
-ExecStartPre=/usr/bin/rm -f /%t/%n-pid /%t/%n-cid
-ExecStart=/usr/bin/podman run --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid --cgroups=no-conmon --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN
-ExecStop=/usr/bin/podman stop --ignore --cidfile /%t/%n-cid -t 42
-ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile /%t/%n-cid
-PIDFile=/%t/%n-pid
+ExecStartPre=/usr/bin/rm -f %t/%n-pid %t/%n-cid
+ExecStart=/usr/bin/podman run --conmon-pidfile %t/%n-pid --cidfile %t/%n-cid --cgroups=no-conmon --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN
+ExecStop=/usr/bin/podman stop --ignore --cidfile %t/%n-cid -t 42
+ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/%n-cid
+PIDFile=%t/%n-pid
KillMode=none
Type=forking
diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go
index d0dadd09d..31131a68b 100644
--- a/test/e2e/generate_systemd_test.go
+++ b/test/e2e/generate_systemd_test.go
@@ -191,7 +191,7 @@ var _ = Describe("Podman generate systemd", func() {
found, _ := session.GrepString("# container-foo.service")
Expect(found).To(BeTrue())
- found, _ = session.GrepString("stop --ignore --cidfile /%t/%n-cid -t 42")
+ found, _ = session.GrepString("stop --ignore --cidfile %t/%n-cid -t 42")
Expect(found).To(BeTrue())
})
diff --git a/vendor/github.com/containernetworking/cni/libcni/api.go b/vendor/github.com/containernetworking/cni/libcni/api.go
index 22b111742..7e52bd838 100644
--- a/vendor/github.com/containernetworking/cni/libcni/api.go
+++ b/vendor/github.com/containernetworking/cni/libcni/api.go
@@ -409,6 +409,9 @@ func (c *CNIConfig) addNetwork(ctx context.Context, name, cniVersion string, net
if err := utils.ValidateNetworkName(name); err != nil {
return nil, err
}
+ if err := utils.ValidateInterfaceName(rt.IfName); err != nil {
+ return nil, err
+ }
newConf, err := buildOneConfig(name, cniVersion, net, prevResult, rt)
if err != nil {
@@ -629,6 +632,9 @@ func (c *CNIConfig) validatePlugin(ctx context.Context, pluginName, expectedVers
if err != nil {
return err
}
+ if expectedVersion == "" {
+ expectedVersion = "0.1.0"
+ }
vi, err := invoke.GetVersionInfo(ctx, pluginPath, c.exec)
if err != nil {
diff --git a/vendor/github.com/containernetworking/cni/pkg/invoke/args.go b/vendor/github.com/containernetworking/cni/pkg/invoke/args.go
index d31a44e87..3cdb4bc8d 100644
--- a/vendor/github.com/containernetworking/cni/pkg/invoke/args.go
+++ b/vendor/github.com/containernetworking/cni/pkg/invoke/args.go
@@ -60,8 +60,8 @@ func (args *Args) AsEnv() []string {
pluginArgsStr = stringify(args.PluginArgs)
}
- // Duplicated values which come first will be overrided, so we must put the
- // custom values in the end to avoid being overrided by the process environments.
+ // Duplicated values which come first will be overridden, so we must put the
+ // custom values in the end to avoid being overridden by the process environments.
env = append(env,
"CNI_COMMAND="+args.Command,
"CNI_CONTAINERID="+args.ContainerID,
diff --git a/vendor/github.com/containernetworking/cni/pkg/invoke/raw_exec.go b/vendor/github.com/containernetworking/cni/pkg/invoke/raw_exec.go
index ad8498ba2..4f89a5dda 100644
--- a/vendor/github.com/containernetworking/cni/pkg/invoke/raw_exec.go
+++ b/vendor/github.com/containernetworking/cni/pkg/invoke/raw_exec.go
@@ -44,10 +44,14 @@ func (e *RawExec) ExecPlugin(ctx context.Context, pluginPath string, stdinData [
}
func pluginErr(err error, output []byte) error {
- if _, ok := err.(*exec.ExitError); ok {
+ if exitError, ok := err.(*exec.ExitError); ok {
emsg := types.Error{}
if len(output) == 0 {
- emsg.Msg = "netplugin failed with no error message"
+ if len(exitError.Stderr) == 0 {
+ emsg.Msg = "netplugin failed with no error message"
+ } else {
+ emsg.Msg = fmt.Sprintf("netplugin failed: %q", string(exitError.Stderr))
+ }
} else if perr := json.Unmarshal(output, &emsg); perr != nil {
emsg.Msg = fmt.Sprintf("netplugin failed but error parsing its diagnostic message %q: %v", string(output), perr)
}
diff --git a/vendor/github.com/containernetworking/cni/pkg/types/020/types.go b/vendor/github.com/containernetworking/cni/pkg/types/020/types.go
index 53256167f..36f31678a 100644
--- a/vendor/github.com/containernetworking/cni/pkg/types/020/types.go
+++ b/vendor/github.com/containernetworking/cni/pkg/types/020/types.go
@@ -86,20 +86,6 @@ func (r *Result) PrintTo(writer io.Writer) error {
return err
}
-// String returns a formatted string in the form of "[IP4: $1,][ IP6: $2,] DNS: $3" where
-// $1 represents the receiver's IPv4, $2 represents the receiver's IPv6 and $3 the
-// receiver's DNS. If $1 or $2 are nil, they won't be present in the returned string.
-func (r *Result) String() string {
- var str string
- if r.IP4 != nil {
- str = fmt.Sprintf("IP4:%+v, ", *r.IP4)
- }
- if r.IP6 != nil {
- str += fmt.Sprintf("IP6:%+v, ", *r.IP6)
- }
- return fmt.Sprintf("%sDNS:%+v", str, r.DNS)
-}
-
// IPConfig contains values necessary to configure an interface
type IPConfig struct {
IP net.IPNet
diff --git a/vendor/github.com/containernetworking/cni/pkg/types/current/types.go b/vendor/github.com/containernetworking/cni/pkg/types/current/types.go
index 7267a2e6d..754cc6e72 100644
--- a/vendor/github.com/containernetworking/cni/pkg/types/current/types.go
+++ b/vendor/github.com/containernetworking/cni/pkg/types/current/types.go
@@ -207,23 +207,6 @@ func (r *Result) PrintTo(writer io.Writer) error {
return err
}
-// String returns a formatted string in the form of "[Interfaces: $1,][ IP: $2,] DNS: $3" where
-// $1 represents the receiver's Interfaces, $2 represents the receiver's IP addresses and $3 the
-// receiver's DNS. If $1 or $2 are nil, they won't be present in the returned string.
-func (r *Result) String() string {
- var str string
- if len(r.Interfaces) > 0 {
- str += fmt.Sprintf("Interfaces:%+v, ", r.Interfaces)
- }
- if len(r.IPs) > 0 {
- str += fmt.Sprintf("IP:%+v, ", r.IPs)
- }
- if len(r.Routes) > 0 {
- str += fmt.Sprintf("Routes:%+v, ", r.Routes)
- }
- return fmt.Sprintf("%sDNS:%+v", str, r.DNS)
-}
-
// Convert this old version result to the current CNI version result
func (r *Result) Convert() (*Result, error) {
return r, nil
diff --git a/vendor/github.com/containernetworking/cni/pkg/types/types.go b/vendor/github.com/containernetworking/cni/pkg/types/types.go
index 3e185c1ce..3fa757a5d 100644
--- a/vendor/github.com/containernetworking/cni/pkg/types/types.go
+++ b/vendor/github.com/containernetworking/cni/pkg/types/types.go
@@ -100,9 +100,6 @@ type Result interface {
// Prints the result in JSON format to provided writer
PrintTo(writer io.Writer) error
-
- // Returns a JSON string representation of the result
- String() string
}
func PrintResult(result Result, version string) error {
diff --git a/vendor/github.com/containernetworking/cni/pkg/utils/utils.go b/vendor/github.com/containernetworking/cni/pkg/utils/utils.go
index 324c40dea..b8ec38874 100644
--- a/vendor/github.com/containernetworking/cni/pkg/utils/utils.go
+++ b/vendor/github.com/containernetworking/cni/pkg/utils/utils.go
@@ -15,14 +15,22 @@
package utils
import (
+ "bytes"
+ "fmt"
"regexp"
+ "unicode"
"github.com/containernetworking/cni/pkg/types"
)
-// cniValidNameChars is the regexp used to validate valid characters in
-// containerID and networkName
-const cniValidNameChars = `[a-zA-Z0-9][a-zA-Z0-9_.\-]`
+const (
+ // cniValidNameChars is the regexp used to validate valid characters in
+ // containerID and networkName
+ cniValidNameChars = `[a-zA-Z0-9][a-zA-Z0-9_.\-]`
+
+ // maxInterfaceNameLength is the length max of a valid interface name
+ maxInterfaceNameLength = 15
+)
var cniReg = regexp.MustCompile(`^` + cniValidNameChars + `*$`)
@@ -49,3 +57,28 @@ func ValidateNetworkName(networkName string) *types.Error {
}
return nil
}
+
+// ValidateInterfaceName will validate the interface name based on the three rules below
+// 1. The name must not be empty
+// 2. The name must be less than 16 characters
+// 3. The name must not be "." or ".."
+// 3. The name must not contain / or : or any whitespace characters
+// ref to https://github.com/torvalds/linux/blob/master/net/core/dev.c#L1024
+func ValidateInterfaceName(ifName string) *types.Error {
+ if len(ifName) == 0 {
+ return types.NewError(types.ErrInvalidEnvironmentVariables, "interface name is empty", "")
+ }
+ if len(ifName) > maxInterfaceNameLength {
+ return types.NewError(types.ErrInvalidEnvironmentVariables, "interface name is too long", fmt.Sprintf("interface name should be less than %d characters", maxInterfaceNameLength+1))
+ }
+ if ifName == "." || ifName == ".." {
+ return types.NewError(types.ErrInvalidEnvironmentVariables, "interface name is . or ..", "")
+ }
+ for _, r := range bytes.Runes([]byte(ifName)) {
+ if r == '/' || r == ':' || unicode.IsSpace(r) {
+ return types.NewError(types.ErrInvalidEnvironmentVariables, "interface name contains / or : or whitespace characters", "")
+ }
+ }
+
+ return nil
+}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 96b4edd6f..53745057c 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -48,7 +48,7 @@ github.com/containerd/containerd/errdefs
github.com/containerd/continuity/fs
github.com/containerd/continuity/syscallx
github.com/containerd/continuity/sysx
-# github.com/containernetworking/cni v0.7.2-0.20190904153231-83439463f784
+# github.com/containernetworking/cni v0.7.2-0.20200304161608-4fae32b84921
github.com/containernetworking/cni/libcni
github.com/containernetworking/cni/pkg/invoke
github.com/containernetworking/cni/pkg/types