summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--OWNERS16
-rw-r--r--install.md4
-rw-r--r--pkg/api/handlers/compat/ping.go1
-rw-r--r--pkg/api/handlers/compat/system.go82
-rw-r--r--pkg/specgen/generate/container_create.go1
-rw-r--r--test/apiv2/rest_api/test_rest_v2_0_0.py62
-rw-r--r--test/system/030-run.bats13
7 files changed, 163 insertions, 16 deletions
diff --git a/OWNERS b/OWNERS
index 823385f46..88dedae25 100644
--- a/OWNERS
+++ b/OWNERS
@@ -3,22 +3,26 @@ approvers:
- edsantiago
- giuseppe
- jwhonce
+ - Luap99
- mheon
- rhatdan
+ - saschagrunert
- TomSweeneyRedHat
- - vrothberg
- umohnani8
- - Luap99
+ - vrothberg
+ - zhangguanzhang
reviewers:
+ - ashley-cui
- baude
- edsantiago
- giuseppe
- jwhonce
+ - Luap99
- mheon
+ - QiWang19
- rhatdan
+ - saschagrunert
- TomSweeneyRedHat
- - vrothberg
- - ashley-cui
- - QiWang19
- umohnani8
- - Luap99
+ - vrothberg
+ - zhangguanzhang
diff --git a/install.md b/install.md
index 2ef6eae2c..d09abec3a 100644
--- a/install.md
+++ b/install.md
@@ -1,5 +1,5 @@
# libpod Installation Instructions
-The installation instructions for Podman and libpod now reside **[here](https://podman.io/getting-started/installation)** in the **[podman.io](https://podman.io)** site. From the homepage, the installation instructions can be found under "Get Started->Installing Podman".
+The installation instructions for Podman and libpod now reside **[here](https://podman.io/getting-started/installation)** on the **[podman.io](https://podman.io)** site.
-The podman.io site resides in a GitHub under the Containers repository at [https://github.com/containers/podman.io](https://github.com/containers/podman.io). If you see a change that needs to happen to the installation instructions, please feel free to open a pull request there, we're always happy to have new contributors!
+The podman.io site resides in a GitHub repository under the containers organization at [https://github.com/containers/podman.io](https://github.com/containers/podman.io). If you see a change that needs to happen to the installation instructions, please feel free to open a pull request there. We're always happy to have new contributors!
diff --git a/pkg/api/handlers/compat/ping.go b/pkg/api/handlers/compat/ping.go
index 9f6611b30..5513e902e 100644
--- a/pkg/api/handlers/compat/ping.go
+++ b/pkg/api/handlers/compat/ping.go
@@ -15,6 +15,7 @@ import (
func Ping(w http.ResponseWriter, r *http.Request) {
// Note API-Version and Libpod-API-Version are set in handler_api.go
w.Header().Set("BuildKit-Version", "")
+ w.Header().Set("Builder-Version", "")
w.Header().Set("Docker-Experimental", "true")
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Pragma", "no-cache")
diff --git a/pkg/api/handlers/compat/system.go b/pkg/api/handlers/compat/system.go
index 322bfa7ed..e21ae160a 100644
--- a/pkg/api/handlers/compat/system.go
+++ b/pkg/api/handlers/compat/system.go
@@ -2,17 +2,91 @@ package compat
import (
"net/http"
+ "strings"
+ "github.com/containers/podman/v2/libpod"
"github.com/containers/podman/v2/pkg/api/handlers"
"github.com/containers/podman/v2/pkg/api/handlers/utils"
+ "github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/containers/podman/v2/pkg/domain/infra/abi"
docker "github.com/docker/docker/api/types"
)
func GetDiskUsage(w http.ResponseWriter, r *http.Request) {
+ options := entities.SystemDfOptions{}
+ runtime := r.Context().Value("runtime").(*libpod.Runtime)
+ ic := abi.ContainerEngine{Libpod: runtime}
+ df, err := ic.SystemDf(r.Context(), options)
+ if err != nil {
+ utils.InternalServerError(w, err)
+ }
+
+ imgs := make([]*docker.ImageSummary, len(df.Images))
+ for i, o := range df.Images {
+ t := docker.ImageSummary{
+ Containers: int64(o.Containers),
+ Created: o.Created.Unix(),
+ ID: o.ImageID,
+ Labels: map[string]string{},
+ ParentID: "",
+ RepoDigests: nil,
+ RepoTags: []string{o.Tag},
+ SharedSize: o.SharedSize,
+ Size: o.Size,
+ VirtualSize: o.Size - o.UniqueSize,
+ }
+ imgs[i] = &t
+ }
+
+ ctnrs := make([]*docker.Container, len(df.Containers))
+ for i, o := range df.Containers {
+ t := docker.Container{
+ ID: o.ContainerID,
+ Names: []string{o.Names},
+ Image: o.Image,
+ ImageID: o.Image,
+ Command: strings.Join(o.Command, " "),
+ Created: o.Created.Unix(),
+ Ports: nil,
+ SizeRw: o.RWSize,
+ SizeRootFs: o.Size,
+ Labels: map[string]string{},
+ State: o.Status,
+ Status: o.Status,
+ HostConfig: struct {
+ NetworkMode string `json:",omitempty"`
+ }{},
+ NetworkSettings: nil,
+ Mounts: nil,
+ }
+ ctnrs[i] = &t
+ }
+
+ vols := make([]*docker.Volume, len(df.Volumes))
+ for i, o := range df.Volumes {
+ t := docker.Volume{
+ CreatedAt: "",
+ Driver: "",
+ Labels: map[string]string{},
+ Mountpoint: "",
+ Name: o.VolumeName,
+ Options: nil,
+ Scope: "local",
+ Status: nil,
+ UsageData: &docker.VolumeUsageData{
+ RefCount: 1,
+ Size: o.Size,
+ },
+ }
+ vols[i] = &t
+ }
+
utils.WriteResponse(w, http.StatusOK, handlers.DiskUsage{DiskUsage: docker.DiskUsage{
- LayersSize: 0,
- Images: nil,
- Containers: nil,
- Volumes: nil,
+ LayersSize: 0,
+ Images: imgs,
+ Containers: ctnrs,
+ Volumes: vols,
+ BuildCache: []*docker.BuildCache{},
+ BuilderSize: 0,
}})
}
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go
index 95e4eeb8f..4f36744ca 100644
--- a/pkg/specgen/generate/container_create.go
+++ b/pkg/specgen/generate/container_create.go
@@ -98,7 +98,6 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener
// present.
imgName := newImage.InputName
if s.Image == newImage.InputName && strings.HasPrefix(newImage.ID(), s.Image) {
- imgName = ""
names := newImage.Names()
if len(names) > 0 {
imgName = names[0]
diff --git a/test/apiv2/rest_api/test_rest_v2_0_0.py b/test/apiv2/rest_api/test_rest_v2_0_0.py
index 3d015a896..d8d214e33 100644
--- a/test/apiv2/rest_api/test_rest_v2_0_0.py
+++ b/test/apiv2/rest_api/test_rest_v2_0_0.py
@@ -93,14 +93,21 @@ class TestApi(unittest.TestCase):
self.assertIsNotNone(r.content)
_ = json.loads(r.text)
+ info = requests.get(PODMAN_URL + "/v1.40/info")
+ self.assertEqual(info.status_code, 200, info.content)
+ _ = json.loads(info.text)
+
def test_events(self):
r = requests.get(_url("/events?stream=false"))
self.assertEqual(r.status_code, 200, r.text)
self.assertIsNotNone(r.content)
- for line in r.text.splitlines():
+
+ report = r.text.splitlines()
+ self.assertGreater(len(report), 0, "No events found!")
+ for line in report:
obj = json.loads(line)
# Actor.ID is uppercase for compatibility
- _ = obj["Actor"]["ID"]
+ self.assertIn("ID", obj["Actor"])
def test_containers(self):
r = requests.get(_url("/containers/json"), timeout=5)
@@ -360,17 +367,38 @@ class TestApi(unittest.TestCase):
self.assertFalse(search.is_alive(), "/images/search took too long")
def test_ping(self):
+ required_headers = (
+ "API-Version",
+ "Builder-Version",
+ "Docker-Experimental",
+ "Cache-Control",
+ "Pragma",
+ "Pragma",
+ )
+
+ def check_headers(req):
+ for k in required_headers:
+ self.assertIn(k, req.headers)
+
r = requests.get(PODMAN_URL + "/_ping")
self.assertEqual(r.status_code, 200, r.text)
+ self.assertEqual(r.text, "OK")
+ check_headers(r)
r = requests.head(PODMAN_URL + "/_ping")
self.assertEqual(r.status_code, 200, r.text)
+ self.assertEqual(r.text, "")
+ check_headers(r)
r = requests.get(_url("/_ping"))
self.assertEqual(r.status_code, 200, r.text)
+ self.assertEqual(r.text, "OK")
+ check_headers(r)
- r = requests.get(_url("/_ping"))
+ r = requests.head(_url("/_ping"))
self.assertEqual(r.status_code, 200, r.text)
+ self.assertEqual(r.text, "")
+ check_headers(r)
def test_history_compat(self):
r = requests.get(PODMAN_URL + "/v1.40/images/alpine/history")
@@ -474,6 +502,34 @@ class TestApi(unittest.TestCase):
prune = requests.post(PODMAN_URL + "/v1.40/volumes/prune")
self.assertEqual(prune.status_code, 200, prune.content)
+ def test_auth_compat(self):
+ r = requests.post(
+ PODMAN_URL + "/v1.40/auth",
+ json={
+ "username": "bozo",
+ "password": "wedontneednopasswords",
+ "serveraddress": "https://localhost/v1.40/",
+ },
+ )
+ self.assertEqual(r.status_code, 404, r.content)
+
+ def test_version(self):
+ r = requests.get(PODMAN_URL + "/v1.40/version")
+ self.assertEqual(r.status_code, 200, r.content)
+
+ r = requests.get(_url("/version"))
+ self.assertEqual(r.status_code, 200, r.content)
+
+ def test_df_compat(self):
+ r = requests.get(PODMAN_URL + "/v1.40/system/df")
+ self.assertEqual(r.status_code, 200, r.content)
+
+ obj = json.loads(r.content)
+ self.assertIn("Images", obj)
+ self.assertIn("Containers", obj)
+ self.assertIn("Volumes", obj)
+ self.assertIn("BuildCache", obj)
+
if __name__ == "__main__":
unittest.main()
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index 6db6b76f1..3ee141f5f 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -536,6 +536,19 @@ json-file | f
run_podman untag $IMAGE $newtag $newtag2
}
+# Regression test for issue #8558
+@test "podman run on untagged image: make sure that image metadata is set" {
+ run_podman inspect $IMAGE --format "{{.ID}}"
+ imageID="$output"
+
+ # prior to #8623 `podman run` would error out on untagged images with:
+ # Error: both RootfsImageName and RootfsImageID must be set if either is set: invalid argument
+ run_podman untag $IMAGE
+ run_podman run --rm $imageID ls
+
+ run_podman tag $imageID $IMAGE
+}
+
@test "Verify /run/.containerenv exist" {
run_podman run --rm $IMAGE ls -1 /run/.containerenv
is "$output" "/run/.containerenv"