Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Add services column to docker app ls command #757

Merged
merged 5 commits into from
Nov 25, 2019

Conversation

silvin-lubecki
Copy link
Contributor

- What I did
The current docker app ls command relies only on parsing claims in the local claim store and its last action, so it is totally uncorrelated with the current app status.

  • List all the required services and the running services

- How I did it

  • Tries to call status json action on all installed app and parses the json output with services description and their status. The ls command aggregates all those services, and counts how many are running and how many are desired (from the bundle).

- How to verify it

 $ docker app ls           
INSTALLATION          APPLICATION   SERVICES LAST ACTION RESULT  CREATED     MODIFIED    REFERENCE
socks                 socks (0.1)   13/13    install     success 4 hours ago 4 hours ago docker.io/library/sockshop:latest
sweet_cartwright      coins (0.1.0) N/A      install     failure 4 days ago  4 days ago  79390aac20c7945c22f18d3bc2a029a9a2aaf07aca6bef458ec18014085b010a
compassionate_mcnulty coins (0.1.0) N/A      install     success 11 days ago 11 days ago 79390aac20c7945c22f18d3bc2a029a9a2aaf07aca6bef458ec18014085b010a

$ docker ps               
CONTAINER ID        IMAGE                                COMMAND                  CREATED              STATUS              PORTS                                NAMES
6b93b1f4d147        weaveworksdemos/user-db:0.4.0        "/entrypoint.sh mong…"   54 seconds ago       Up 40 seconds       27017/tcp                            socks_user-db.1.ru12155gazmubn4ptz18ujelg
123a1d4a9737        weaveworksdemos/load-test:0.1.1      "/usr/local/bin/runL…"   About a minute ago   Up About a minute   8089/tcp                             socks_user-sim.1.f42swbjvlrbo8wp5q974nev9g
8f5f61e99639        weaveworksdemos/payment:0.4.3        "/app -port=80"          4 hours ago          Up 4 hours          80/tcp                               socks_payment.1.lsc40gglfm5qejdoebzyfsf16

$ docker kill 6b93b1f4d147
6b93b1f4d147

$ docker app ls           
INSTALLATION          APPLICATION   SERVICES LAST ACTION RESULT  CREATED     MODIFIED    REFERENCE
socks                 socks (0.1)   12/13    install     success 4 hours ago 4 hours ago docker.io/library/sockshop:latest
sweet_cartwright      coins (0.1.0) N/A      install     failure 4 days ago  4 days ago  79390aac20c7945c22f18d3bc2a029a9a2aaf07aca6bef458ec18014085b010a
compassionate_mcnulty coins (0.1.0) N/A      install     success 11 days ago 11 days ago 79390aac20c7945c22f18d3bc2a029a9a2aaf07aca6bef458ec18014085b010a

- Description for the changelog

  • Add services column to docker app ls command

- A picture of a cute animal (not mandatory)
image

Copy link
Contributor

@ndeloof ndeloof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't understand the change to installerContext. Would at least request a comment if there's a legitimate reason.

internal/commands/list.go Outdated Show resolved Hide resolved
@@ -22,55 +26,78 @@ import (
var (
listColumns = []struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't took time to create a formatter for app ls command, but we should for homogeneity. Will look into this in a future PR.

@silvin-lubecki silvin-lubecki force-pushed the ls-services-column branch 3 times, most recently from 737346c to a6b8ddc Compare November 22, 2019 17:22
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
- List all the required services and the running services
- Tries to call status json action on all installed app

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
… the last command still using it

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
@codecov
Copy link

codecov bot commented Nov 22, 2019

Codecov Report

Merging #757 into master will decrease coverage by 0.49%.
The diff coverage is 78.46%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #757     +/-   ##
=========================================
- Coverage   70.07%   69.58%   -0.5%     
=========================================
  Files          64       64             
  Lines        3519     3567     +48     
=========================================
+ Hits         2466     2482     +16     
- Misses        727      757     +30     
- Partials      326      328      +2
Impacted Files Coverage Δ
internal/cnab/driver.go 77.77% <100%> (ø) ⬆️
internal/commands/run.go 63.73% <100%> (-0.4%) ⬇️
internal/commands/image/inspect.go 65.3% <100%> (-0.7%) ⬇️
internal/commands/image/render.go 69.49% <100%> (-0.51%) ⬇️
internal/commands/update.go 58.92% <100%> (-0.73%) ⬇️
internal/commands/remove.go 52.94% <100%> (-0.91%) ⬇️
internal/commands/image/command.go 100% <100%> (ø) ⬆️
internal/commands/inspect.go 21.66% <25%> (-29.16%) ⬇️
internal/commands/list.go 70.63% <70.88%> (-0.99%) ⬇️
internal/commands/validate.go 75% <75%> (ø) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b621499...f84667a. Read the comment docs.

@silvin-lubecki
Copy link
Contributor Author

PTAL

@eunomie eunomie merged commit 9a49da4 into docker:master Nov 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants