summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cirrus.yml53
-rw-r--r--cmd/podman/containers/stats.go37
-rw-r--r--cmd/podman/inspect/inspect.go1
-rw-r--r--cmd/podman/pods/ps.go13
-rwxr-xr-xcontrib/cirrus/runner.sh4
-rwxr-xr-xcontrib/cirrus/setup_environment.sh1
-rw-r--r--docs/source/markdown/podman-pod-ps.1.md5
-rw-r--r--docs/source/markdown/podman-stats.1.md5
-rw-r--r--pkg/api/handlers/compat/images.go5
-rw-r--r--pkg/domain/infra/abi/containers.go1
10 files changed, 90 insertions, 35 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
index ab639a59c..c2238c3c6 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -143,6 +143,7 @@ smoke_task:
build_task:
alias: 'build'
name: 'Build for $DISTRO_NV'
+ only_if: &not_docs $CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*'
gce_instance: &standardvm
image_project: libpod-218412
zone: "us-central1-a"
@@ -200,12 +201,14 @@ build_task:
path: ./*.html
type: text/html
+
# Confirm the result of building on at least one platform appears sane.
# This confirms the binaries can be executed, checks --help vs docs, and
# other essential post-build validation checks.
validate_task:
name: "Validate $DISTRO_NV Build"
alias: validate
+ only_if: *not_docs
depends_on:
- ext_svc_check
- automation
@@ -227,11 +230,13 @@ validate_task:
main_script: *main
always: *artifacts
+
# Exercise the "libpod" API with a small set of common
# operations to ensure they are functional.
bindings_task:
name: "Test Bindings"
alias: bindings
+ only_if: *not_docs
skip: *branch
depends_on:
- build
@@ -268,6 +273,7 @@ swagger_task:
endpoint_task:
name: "Test Endpoint"
alias: endpoint
+ only_if: *not_docs
depends_on:
- build
container: *smallcontainer
@@ -307,6 +313,7 @@ vendor_task:
alt_build_task:
name: "$ALT_NAME"
alias: alt_build
+ only_if: *not_docs
depends_on:
- build
env:
@@ -334,6 +341,7 @@ alt_build_task:
static_alt_build_task:
name: "Static Build"
alias: static_alt_build
+ only_if: *not_docs
depends_on:
- build
# Community-maintained task, may fail on occasion. If so, uncomment
@@ -385,6 +393,7 @@ osx_alt_build_task:
docker-py_test_task:
name: Docker-py Compat.
alias: docker-py_test
+ only_if: *not_docs
depends_on:
- build
container: *smallcontainer
@@ -398,11 +407,13 @@ docker-py_test_task:
main_script: *main
always: *artifacts
+
# Does exactly what it says, execute the podman unit-tests on all primary
# platforms and release versions.
unit_test_task:
name: "Unit tests on $DISTRO_NV"
alias: unit_test
+ only_if: *not_docs
depends_on:
- validate
matrix: *platform_axis
@@ -415,14 +426,39 @@ unit_test_task:
main_script: *main
always: *artifacts
+
+apiv2_test_task:
+ name: "APIv2 test on $DISTRO_NV"
+ alias: apiv2_test
+ depends_on:
+ - validate
+ gce_instance: *standardvm
+ env:
+ <<: *stdenvars
+ TEST_FLAVOR: apiv2
+ clone_script: *noop # Comes from cache
+ gopath_cache: *ro_gopath_cache
+ setup_script: *setup
+ main_script: *main
+ always: &logs_artifacts
+ <<: *artifacts
+ package_versions_script: '$SCRIPT_BASE/logcollector.sh packages'
+ ginkgo_node_logs_script: '$SCRIPT_BASE/logcollector.sh ginkgo'
+ df_script: '$SCRIPT_BASE/logcollector.sh df'
+ audit_log_script: '$SCRIPT_BASE/logcollector.sh audit'
+ journal_script: '$SCRIPT_BASE/logcollector.sh journal'
+ podman_system_info_script: '$SCRIPT_BASE/logcollector.sh podman'
+
+
# Execute the podman integration tests on all primary platforms and release
# versions, as root, without involving the podman-remote client.
local_integration_test_task: &local_integration_test_task
# Integration-test task name convention:
# <int.|sys.> <podman|remote> <Distro NV> <root|rootless>
name: &std_name_fmt "$TEST_FLAVOR $PODBIN_NAME $DISTRO_NV $PRIV_NAME $TEST_ENVIRON"
- skip: *branch
alias: local_integration_test
+ only_if: *not_docs
+ skip: *branch
depends_on:
- unit_test
matrix: *platform_axis
@@ -434,14 +470,8 @@ local_integration_test_task: &local_integration_test_task
gopath_cache: *ro_gopath_cache
setup_script: *setup
main_script: *main
- always: &logs_artifacts
- <<: *artifacts
- package_versions_script: '$SCRIPT_BASE/logcollector.sh packages'
- ginkgo_node_logs_script: '$SCRIPT_BASE/logcollector.sh ginkgo'
- df_script: '$SCRIPT_BASE/logcollector.sh df'
- audit_log_script: '$SCRIPT_BASE/logcollector.sh audit'
- journal_script: '$SCRIPT_BASE/logcollector.sh journal'
- podman_system_info_script: '$SCRIPT_BASE/logcollector.sh podman'
+ always: *logs_artifacts
+
# Nearly identical to `local_integration_test` except all operations
# are performed through the podman-remote client vs a podman "server"
@@ -459,6 +489,7 @@ remote_integration_test_task:
container_integration_test_task:
name: *std_name_fmt
alias: container_integration_test
+ only_if: *not_docs
skip: *branch
depends_on:
- unit_test
@@ -488,6 +519,7 @@ container_integration_test_task:
rootless_integration_test_task:
name: *std_name_fmt
alias: rootless_integration_test
+ only_if: *not_docs
skip: *branch
depends_on:
- unit_test
@@ -511,6 +543,7 @@ rootless_integration_test_task:
local_system_test_task: &local_system_test_task
name: *std_name_fmt
alias: local_system_test
+ only_if: *not_docs
depends_on:
- local_integration_test
matrix: *platform_axis
@@ -537,6 +570,7 @@ remote_system_test_task:
rootless_system_test_task:
name: *std_name_fmt
alias: rootless_system_test
+ only_if: *not_docs
depends_on:
- rootless_integration_test
matrix: *fedora_vm_axis
@@ -598,6 +632,7 @@ success_task:
- osx_alt_build
- docker-py_test
- unit_test
+ - apiv2_test
- local_integration_test
- remote_integration_test
- rootless_integration_test
diff --git a/cmd/podman/containers/stats.go b/cmd/podman/containers/stats.go
index bbd389bbf..c30ea52ec 100644
--- a/cmd/podman/containers/stats.go
+++ b/cmd/podman/containers/stats.go
@@ -3,12 +3,13 @@ package containers
import (
"fmt"
"os"
- "strings"
"text/tabwriter"
"text/template"
tm "github.com/buger/goterm"
+ "github.com/containers/podman/v2/cmd/podman/parse"
"github.com/containers/podman/v2/cmd/podman/registry"
+ "github.com/containers/podman/v2/cmd/podman/report"
"github.com/containers/podman/v2/cmd/podman/validate"
"github.com/containers/podman/v2/libpod/define"
"github.com/containers/podman/v2/pkg/cgroups"
@@ -58,9 +59,8 @@ type statsOptionsCLI struct {
}
var (
- statsOptions statsOptionsCLI
- defaultStatsRow = "{{.ID}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDS}}\n"
- defaultStatsHeader = "ID\tNAME\tCPU %\tMEM USAGE / LIMIT\tMEM %\tNET IO\tBLOCK IO\tPIDS\n"
+ statsOptions statsOptionsCLI
+ defaultStatsRow = "{{.ID}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDS}}\n"
)
func statFlags(flags *pflag.FlagSet) {
@@ -139,7 +139,16 @@ func stats(cmd *cobra.Command, args []string) error {
}
func outputStats(reports []define.ContainerStats) error {
- if len(statsOptions.Format) < 1 && !statsOptions.NoReset {
+ headers := report.Headers(define.ContainerStats{}, map[string]string{
+ "ID": "ID",
+ "CPUPerc": "CPU %",
+ "MemUsage": "MEM USAGE / LIMIT",
+ "MemPerc": "MEM %",
+ "NetIO": "NET IO",
+ "BlockIO": "BLOCK IO",
+ "PIDS": "PIDS",
+ })
+ if !statsOptions.NoReset {
tm.Clear()
tm.MoveCursor(1, 1)
tm.Flush()
@@ -148,25 +157,27 @@ func outputStats(reports []define.ContainerStats) error {
for _, r := range reports {
stats = append(stats, containerStats{r})
}
- if statsOptions.Format == "json" {
+ if parse.MatchesJSONFormat(statsOptions.Format) {
return outputJSON(stats)
}
format := defaultStatsRow
+
if len(statsOptions.Format) > 0 {
- format = statsOptions.Format
- if !strings.HasSuffix(format, "\n") {
- format += "\n"
- }
+ format = report.NormalizeFormat(statsOptions.Format)
+ } else if len(statsOptions.Format) < 1 {
+ format = defaultStatsRow
}
format = "{{range . }}" + format + "{{end}}"
- if len(statsOptions.Format) < 1 {
- format = defaultStatsHeader + format
- }
tmpl, err := template.New("stats").Parse(format)
if err != nil {
return err
}
w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0)
+ if len(statsOptions.Format) < 1 {
+ if err := tmpl.Execute(w, headers); err != nil {
+ return err
+ }
+ }
if err := tmpl.Execute(w, stats); err != nil {
return err
}
diff --git a/cmd/podman/inspect/inspect.go b/cmd/podman/inspect/inspect.go
index 658463650..3d1ef72aa 100644
--- a/cmd/podman/inspect/inspect.go
+++ b/cmd/podman/inspect/inspect.go
@@ -167,6 +167,7 @@ func (i *inspector) inspect(namesOrIDs []string) error {
func printJSON(data []interface{}) error {
enc := json.NewEncoder(os.Stdout)
+ enc.SetIndent("", " ")
return enc.Encode(data)
}
diff --git a/cmd/podman/pods/ps.go b/cmd/podman/pods/ps.go
index b7952e6e3..0013cca02 100644
--- a/cmd/podman/pods/ps.go
+++ b/cmd/podman/pods/ps.go
@@ -106,12 +106,13 @@ func pods(cmd *cobra.Command, _ []string) error {
}
headers := report.Headers(ListPodReporter{}, map[string]string{
- "ContainerIds": "IDS",
- "ContainerNames": "NAMES",
- "ContainerStatuses": "STATUS",
- "Namespace": "NAMESPACES",
+ "Id": "POD ID",
+ "Name": "NAME",
+ "Status": "STATUS",
+ "Labels": "LABELS",
"NumberOfContainers": "# OF CONTAINERS",
- "InfraId": "INFRA ID",
+ "Created": "CREATED",
+ "InfraID": "INFRA ID",
})
row := podPsFormat()
if cmd.Flags().Changed("format") {
@@ -135,7 +136,7 @@ func pods(cmd *cobra.Command, _ []string) error {
}
func podPsFormat() string {
- row := []string{"{{.Id}}", "{{.Name}}", "{{.Status}}", "{{.Created}}}"}
+ row := []string{"{{.Id}}", "{{.Name}}", "{{.Status}}", "{{.Created}}", "{{.InfraID}}"}
if psInput.CtrIds {
row = append(row, "{{.ContainerIds}}")
diff --git a/contrib/cirrus/runner.sh b/contrib/cirrus/runner.sh
index bfac8e7cb..b97a696d9 100755
--- a/contrib/cirrus/runner.sh
+++ b/contrib/cirrus/runner.sh
@@ -62,6 +62,10 @@ function _run_unit() {
make localunit
}
+function _run_apiv2() {
+ make localapiv2 |& logformatter
+}
+
function _run_int() {
dotest integration
}
diff --git a/contrib/cirrus/setup_environment.sh b/contrib/cirrus/setup_environment.sh
index 156c9b7b2..1b992711f 100755
--- a/contrib/cirrus/setup_environment.sh
+++ b/contrib/cirrus/setup_environment.sh
@@ -165,6 +165,7 @@ case "$TEST_FLAVOR" in
docker-py) ;&
build) make clean ;;
unit) ;;
+ apiv2) ;& # use next item
int) ;&
sys) ;&
bindings) ;&
diff --git a/docs/source/markdown/podman-pod-ps.1.md b/docs/source/markdown/podman-pod-ps.1.md
index 035c20c7f..3df4403b7 100644
--- a/docs/source/markdown/podman-pod-ps.1.md
+++ b/docs/source/markdown/podman-pod-ps.1.md
@@ -68,11 +68,10 @@ Valid placeholders for the Go template are listed below:
| .Name | Name of pod |
| .Status | Status of pod |
| .Labels | All the labels assigned to the pod |
-| .ContainerInfo | Show the names, ids and/or statuses of containers (only shows 9 unless no-trunc is specified) |
| .NumberOfContainers | Show the number of containers attached to pod |
| .Cgroup | Cgroup path of pod |
-| .UsePodCgroup | Whether containers use the Cgroup of the pod |
-
+| .Created | Creation time of pod |
+| .InfraID | Pod infra container ID |
**--sort**
Sort by created, ID, name, status, or number of containers
diff --git a/docs/source/markdown/podman-stats.1.md b/docs/source/markdown/podman-stats.1.md
index 741873c3f..042da26d1 100644
--- a/docs/source/markdown/podman-stats.1.md
+++ b/docs/source/markdown/podman-stats.1.md
@@ -47,12 +47,11 @@ Valid placeholders for the Go template are listed below:
| **Placeholder** | **Description** |
| --------------- | --------------- |
-| .Pod | Pod ID |
| .ID | Container ID |
| .Name | Container Name |
-| .CPU | CPU percentage |
+| .CPUPerc | CPU percentage |
| .MemUsage | Memory usage |
-| .Mem | Memory percentage |
+| .MemPerc | Memory percentage |
| .NetIO | Network IO |
| .BlockIO | Block IO |
| .PIDS | Number of PIDs |
diff --git a/pkg/api/handlers/compat/images.go b/pkg/api/handlers/compat/images.go
index f49ce59da..3431823bd 100644
--- a/pkg/api/handlers/compat/images.go
+++ b/pkg/api/handlers/compat/images.go
@@ -327,7 +327,10 @@ func GetImage(w http.ResponseWriter, r *http.Request) {
name := utils.GetName(r)
newImage, err := utils.GetImage(r, name)
if err != nil {
- utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Wrapf(err, "failed to find image %s", name))
+ // Here we need to fiddle with the error message because docker-py is looking for "No
+ // such image" to determine on how to raise the correct exception.
+ errMsg := strings.ReplaceAll(err.Error(), "no such image", "No such image")
+ utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Errorf("failed to find image %s: %s", name, errMsg))
return
}
inspect, err := handlers.ImageDataToImageInspect(r.Context(), newImage)
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index ac7523094..614fd5fe0 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -588,6 +588,7 @@ func (ic *ContainerEngine) ContainerAttach(ctx context.Context, nameOrID string,
if err != nil && errors.Cause(err) != define.ErrDetach {
return errors.Wrapf(err, "error attaching to container %s", ctr.ID())
}
+ os.Stdout.WriteString("\n")
return nil
}