Skip to content

Conversation

fabianofranz
Copy link
Member

Makes use of the existing osc deploy command to list the deployments history through the -L flag. Loosely inspired by git log and some ideas from git diff --stat.

Already available in master:

osc deploy database       // display the latest deployment for the "database" dc

Added by this PR:

osc deploy database -L    // list all deployments for the "database" dc
osc deploy database -L 3  // list the latest 3 deployments for the "database" dc

Other features and flags remain the same.

The UPSTREAM commit is under discussion here: spf13/pflag#18.

@fabianofranz fabianofranz force-pushed the 614_deployment_history branch from e243771 to 136eac8 Compare May 7, 2015 20:54
fmt.Fprintf(out, "Latest deployment for %s/%s:\n", namespace, name)
printLines(out, indent, 1, d.describeDeployment(deploy.(*graph.DeploymentConfigNode))...)
node := deploy.(*graph.DeploymentConfigNode)
deploymentsCount := len(node.Deployments) + 1
Copy link
Member Author

Choose a reason for hiding this comment

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

@ironcladlou I need to know the number of deployments of a dc, is this correct? len(node.Deployments) + 1 (the active deployment)

Copy link
Contributor

Choose a reason for hiding this comment

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

@fabianofranz I haven't yet digested all the graph stuff going on here, but I can't see yet why you'd need to add 1- there's no distinction between an "active" deployment and any other in the system, so if you list RCs filtered by the deploymentConfig label, you should get an accurate count...

@fabianofranz
Copy link
Member Author

@ironcladlou @smarterclayton please review.

@fabianofranz fabianofranz force-pushed the 614_deployment_history branch from 136eac8 to 185d762 Compare May 7, 2015 21:34
@@ -26,6 +26,12 @@ NOTE: This command is still under active development and is subject to change.`
deploy_example = ` // Display the latest deployment for the 'database' deployment config
$ %[1]s deploy database

// List all deployments for the 'database' deployment config
$ %[1]s deploy database -L
Copy link
Contributor

Choose a reason for hiding this comment

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

So why wouldn't I just describe dc/database? What does this add that the other does not?

Copy link
Member Author

Choose a reason for hiding this comment

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

This one will list the history of deployments for the given dc, while describe only gives you the latest one. Also extends the functionality that was already available in the command when running without flags. Sample output:

All 6 deployments for test1/database:

  #6 deployed about an hour ago
  #5 deployed about an hour ago
  #4 deployed about an hour ago
  #3 deployed 2 hours ago
  #2 deployed 2 hours ago
  #1 deployed 2 hours ago

I do think though we could add more information to the output (or/and add a --verbose mode). What would you guys suggest?

Copy link
Contributor

Choose a reason for hiding this comment

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

On May 7, 2015, at 8:19 PM, Fabiano Franz [email protected] wrote:

In pkg/cmd/cli/cmd/deploy.go:

@@ -26,6 +26,12 @@ NOTE: This command is still under active development and is subject to change. deploy_example = // Display the latest deployment for the 'database' deployment config
$ %[1]s deploy database

  • // List all deployments for the 'database' deployment config
  • $ %[1]s deploy database -L
    This one will list the history of deployments for the given dc, while describe only gives you the latest one. Also extends the functionality that was already available in the command when running without flags. Sample output:

Why doesn't describe give me that? Why can't describe show me historical data? Why do we need two?
All 6 deployments for test1/database:

#6 deployed about an hour ago
#5 deployed about an hour ago
#4 deployed about an hour ago
#3 deployed 2 hours ago
#2 deployed 2 hours ago
#1 deployed 2 hours ago
I do think though we could add more information to the output (or/and add a --verbose mode). What would you guys suggest?


Reply to this email directly or view it on GitHub.

Copy link
Member Author

Choose a reason for hiding this comment

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

Describe could give you that, for sure.

Still, I do like this idea of having it somehow attached to the deploy command, because user-friendliness (the flow of doing osc deploy database --retry then osc deploy database -L seemed fluid). Also, displaying the complete deployment history in describe could become too much depending on the history size, and given describe doesn't provide an argument to control it (limit the history size, etc).

We could do a mid-term, where we add a few more items from the history to describe, but still limit to say 3 or 5, and add more information to this one, similar to what describe does (maybe just a little less verbose, say not displaying the pod status and things like that). How does it sound?

Copy link
Member Author

Choose a reason for hiding this comment

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

Or maybe describe display the latest 3 in full details, and all others in one line each, like this command is doing atm.

Copy link
Contributor

Choose a reason for hiding this comment

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

I just don't know why we would want to replicate describe somewhere else. It's our go to for "get info about this". This command is about action and maybe a bit of status.

On May 7, 2015, at 9:23 PM, Fabiano Franz [email protected] wrote:

In pkg/cmd/cli/cmd/deploy.go:

@@ -26,6 +26,12 @@ NOTE: This command is still under active development and is subject to change. deploy_example = // Display the latest deployment for the 'database' deployment config
$ %[1]s deploy database

  • // List all deployments for the 'database' deployment config
  • $ %[1]s deploy database -L
    Or maybe describe display the latest 3 in full details, and all others in one line each, like this command is doing atm.


Reply to this email directly or view it on GitHub.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, let me cook something around describe. What do you think about displaying the complete history, but only the latest 3 deployments in history in full details (like the latest one is displayed today), and all others summarized? Or let's just display the full history with details (I didn't check yet about performance, not sure if every deployment would require an additional api call, etc)?

@fabianofranz fabianofranz force-pushed the 614_deployment_history branch from 185d762 to ef48deb Compare May 8, 2015 21:32
@fabianofranz
Copy link
Member Author

@smarterclayton @ironcladlou Added deployments history to describe (notice only the latest one is shown in full details) and a message to the deploy command. How does it look?

$ osc describe dc/database
Name:       database
Created:    21 hours ago
Labels:     template=application-template-stibuild
Latest Version: 5
Triggers:   Config
Strategy:   Recreate
Template:
    Selector:   name=database
    Replicas:   1
    Containers:
        NAME                IMAGE               ENV
        ruby-helloworld-database    openshift/mysql-55-centos7  MYSQL_DATABASE=root,MYSQL_PASSWORD=LeArq4Tt,MYSQL_USER=user2HX
Deployment #5 (latest):
    Name:           database-5
    Status:         Complete
    Deployed at:    39 minutes ago
    Selector:       deployment=database-5,deploymentconfig=database,name=database
    Labels:         template=application-template-stibuild
    Replicas:       1 current / 1 desired
    Pods Status:    1 Running / 0 Waiting / 0 Succeeded / 0 Failed
Deployment #4:
    Name:           database-4
    Status:         Complete
    Deployed at:    about an hour ago
    Selector:       deployment=database-4,deploymentconfig=database,name=database
Deployment #3:
    Name:           database-3
    Status:         Complete
    Deployed at:    21 hours ago
    Selector:       deployment=database-3,deploymentconfig=database,name=database
Deployment #2:
    Name:           database-2
    Status:         Complete
    Deployed at:    21 hours ago
    Selector:       deployment=database-2,deploymentconfig=database,name=database
Deployment #1:
    Name:           database-1
    Status:         Complete
    Deployed at:    21 hours ago
    Selector:       deployment=database-1,deploymentconfig=database,name=database
No events.

and

$ osc deploy database -L
All 5 deployments for test3/database:

  #5 deployed 38 minutes ago
  #4 deployed about an hour ago
  #3 deployed 21 hours ago
  #2 deployed 21 hours ago
  #1 deployed 21 hours ago

For more details run 'osc describe dc/database'.

@smarterclayton
Copy link
Contributor

Why have -L? Just display the last three on osc deploy automatically in simple mode.

On May 8, 2015, at 5:43 PM, Fabiano Franz [email protected] wrote:

@smarterclayton @ironcladlou Added deployments history to describe (notice only the latest one is shown in full details) and a message to the deploy command. How does it look?

$ osc describe dc/database
Name: database
Created: 21 hours ago
Labels: template=application-template-stibuild
Latest Version: 5
Triggers: Config
Strategy: Recreate
Template:
Selector: name=database
Replicas: 1
Containers:
NAME IMAGE ENV
ruby-helloworld-database openshift/mysql-55-centos7 MYSQL_DATABASE=root,MYSQL_PASSWORD=LeArq4Tt,MYSQL_USER=user2HX
Deployment #5 (latest):
Name: database-5
Status: Complete
Deployed at: 39 minutes ago
Selector: deployment=database-5,deploymentconfig=database,name=database
Labels: template=application-template-stibuild
Replicas: 1 current / 1 desired
Pods Status: 1 Running / 0 Waiting / 0 Succeeded / 0 Failed
Deployment #4:
Name: database-4
Status: Complete
Deployed at: about an hour ago
Selector: deployment=database-4,deploymentconfig=database,name=database
Deployment #3:
Name: database-3
Status: Complete
Deployed at: 21 hours ago
Selector: deployment=database-3,deploymentconfig=database,name=database
Deployment #2:
Name: database-2
Status: Complete
Deployed at: 21 hours ago
Selector: deployment=database-2,deploymentconfig=database,name=database
Deployment #1:
Name: database-1
Status: Complete
Deployed at: 21 hours ago
Selector: deployment=database-1,deploymentconfig=database,name=database
No events.
and

$ osc deploy database -L
All 5 deployments for test3/database:

#5 deployed 38 minutes ago
#4 deployed about an hour ago
#3 deployed 21 hours ago
#2 deployed 21 hours ago
#1 deployed 21 hours ago

For more details run 'osc describe dc/database'.

Reply to this email directly or view it on GitHub.

@smarterclayton
Copy link
Contributor

I guess it's less scriptable.

Still, we have osc status and osc describe DC, I don't think we have a need for -L

On May 8, 2015, at 5:43 PM, Fabiano Franz [email protected] wrote:

@smarterclayton @ironcladlou Added deployments history to describe (notice only the latest one is shown in full details) and a message to the deploy command. How does it look?

$ osc describe dc/database
Name: database
Created: 21 hours ago
Labels: template=application-template-stibuild
Latest Version: 5
Triggers: Config
Strategy: Recreate
Template:
Selector: name=database
Replicas: 1
Containers:
NAME IMAGE ENV
ruby-helloworld-database openshift/mysql-55-centos7 MYSQL_DATABASE=root,MYSQL_PASSWORD=LeArq4Tt,MYSQL_USER=user2HX
Deployment #5 (latest):
Name: database-5
Status: Complete
Deployed at: 39 minutes ago
Selector: deployment=database-5,deploymentconfig=database,name=database
Labels: template=application-template-stibuild
Replicas: 1 current / 1 desired
Pods Status: 1 Running / 0 Waiting / 0 Succeeded / 0 Failed
Deployment #4:
Name: database-4
Status: Complete
Deployed at: about an hour ago
Selector: deployment=database-4,deploymentconfig=database,name=database
Deployment #3:
Name: database-3
Status: Complete
Deployed at: 21 hours ago
Selector: deployment=database-3,deploymentconfig=database,name=database
Deployment #2:
Name: database-2
Status: Complete
Deployed at: 21 hours ago
Selector: deployment=database-2,deploymentconfig=database,name=database
Deployment #1:
Name: database-1
Status: Complete
Deployed at: 21 hours ago
Selector: deployment=database-1,deploymentconfig=database,name=database
No events.
and

$ osc deploy database -L
All 5 deployments for test3/database:

#5 deployed 38 minutes ago
#4 deployed about an hour ago
#3 deployed 21 hours ago
#2 deployed 21 hours ago
#1 deployed 21 hours ago

For more details run 'osc describe dc/database'.

Reply to this email directly or view it on GitHub.

@fabianofranz
Copy link
Member Author

Ok, I'll remove the existing logic around -L and all the smart and awesome filtering trends I was foreseeing for a future where every human kind could filter all existing stuff, just using -L [n[,m]] Filter n items, alternatively skipping the first m. :)))

The main reason for having a "short" version of the older deployments in the describe history is that pods info require a separate api call. I could keep Labels and Replicas though.

Other comments?

@smarterclayton
Copy link
Contributor

I don't even know that you need more than the last 2 deployment. You care about the current and it's state, and the pods that are running on any older ones.

Deployment Configs should eventually have a status field updated with the state of their rcs, like rcs and pods. Then we wouldn't need the queries.

On May 8, 2015, at 6:39 PM, Fabiano Franz [email protected] wrote:

Ok, I'll remove the existing logic around -L and all the smart and awesome filtering trends I was foreseeing for a future where every human kind could filter all existing stuff, just using -L [n[,m]] Filter n items, alternatively skipping the first m. :)))

The main reason for having a "short" version of the older deployments in the describe history is that pods info require a separate api call. I could keep Labels and Replicas though.

Other comments?

----- Original Message -----

I guess it's less scriptable.

Still, we have osc status and osc describe DC, I don't think we have a need
for -L

On May 8, 2015, at 5:43 PM, Fabiano Franz [email protected] wrote:

@smarterclayton @ironcladlou Added deployments history to describe (notice
only the latest one is shown in full details) and a message to the deploy
command. How does it look?

$ osc describe dc/database
Name: database
Created: 21 hours ago
Labels: template=application-template-stibuild
Latest Version: 5
Triggers: Config
Strategy: Recreate
Template:
Selector: name=database
Replicas: 1
Containers:
NAME IMAGE ENV
ruby-helloworld-database openshift/mysql-55-centos7
MYSQL_DATABASE=root,MYSQL_PASSWORD=LeArq4Tt,MYSQL_USER=user2HX
Deployment #5 (latest):
Name: database-5
Status: Complete
Deployed at: 39 minutes ago
Selector:
deployment=database-5,deploymentconfig=database,name=database
Labels: template=application-template-stibuild
Replicas: 1 current / 1 desired
Pods Status: 1 Running / 0 Waiting / 0 Succeeded / 0 Failed
Deployment #4:
Name: database-4
Status: Complete
Deployed at: about an hour ago
Selector:
deployment=database-4,deploymentconfig=database,name=database
Deployment #3:
Name: database-3
Status: Complete
Deployed at: 21 hours ago
Selector:
deployment=database-3,deploymentconfig=database,name=database
Deployment #2:
Name: database-2
Status: Complete
Deployed at: 21 hours ago
Selector:
deployment=database-2,deploymentconfig=database,name=database
Deployment #1:
Name: database-1
Status: Complete
Deployed at: 21 hours ago
Selector:
deployment=database-1,deploymentconfig=database,name=database
No events.
and

$ osc deploy database -L
All 5 deployments for test3/database:

#5 deployed 38 minutes ago
#4 deployed about an hour ago
#3 deployed 21 hours ago
#2 deployed 21 hours ago
#1 deployed 21 hours ago

For more details run 'osc describe dc/database'.

Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub:
#2128 (comment)

Reply to this email directly or view it on GitHub.

@fabianofranz fabianofranz force-pushed the 614_deployment_history branch from ef48deb to 2761945 Compare May 12, 2015 21:40
@fabianofranz
Copy link
Member Author

Removed the -L flag and kept the existing behavior of only displaying the latest deployment. Added a message with the describe syntax in case the user wants more info. Describe prints the history but with a very limited set of info in older deployments, added the "Replica" field. Refactored the command to match the Complete|Validate|Run pattern. This makes the output of describe very similar to the web console version after #2178 gets merged. @smarterclayton @ironcladlou please add your final comments.

$ osc deploy database
Latest deployment for test5/database:

  #5 deployed 7 minutes ago

For more details run 'osc describe dc/database'.

$ osc describe dc database
Name:       database
Created:    About an hour ago
Labels:     template=application-template-stibuild
Latest Version: 5
Triggers:   Config
Strategy:   Recreate
Template:
    Selector:   name=database
    Replicas:   1
    Containers:
        NAME                IMAGE               ENV
        ruby-helloworld-database    openshift/mysql-55-centos7  MYSQL_DATABASE=root,MYSQL_PASSWORD=QpYDTJ63,MYSQL_USER=user25J
Deployment #2 (latest):
    Name:       database-5
    Created:    7 minutes ago
    Status:     Complete
    Replicas:   1 current / 1 desired
    Selector:   deployment=database-5,deploymentconfig=database,name=database
    Labels:     template=application-template-stibuild
    Pods Status:    1 Running / 0 Waiting / 0 Succeeded / 0 Failed
Deployment #1:
    Created:    11 minutes ago
    Status:     Complete
    Replicas:   0 current / 0 desired
No events.

@fabianofranz fabianofranz force-pushed the 614_deployment_history branch from b647a12 to 41b7c88 Compare May 12, 2015 23:34
@smarterclayton
Copy link
Contributor

I don't like the layout of the single deployment line for the deploy command. We're taking five lines to convey what can be done in one.

Should be

database #5 deployed 7 minutes ago

If there's a failure, show back to the last successful. I don't think the describe line helps.

@fabianofranz fabianofranz force-pushed the 614_deployment_history branch from 41b7c88 to f786fa0 Compare May 13, 2015 18:35
@fabianofranz
Copy link
Member Author

@smarterclayton Fixed, using just one line now. Showing back to the last successful in case there's a failure or deployment pending. Examples:

$ osc deploy frontend
frontend #5 deployment failed 3 seconds ago
frontend #4 deployed 2 minutes ago

or

$ osc deploy frontend
frontend #5 deployment pending 4 seconds ago
frontend #4 deployed 2 minutes ago

$ osc deploy frontend
frontend #5 deployment deployed 12 seconds ago

@smarterclayton
Copy link
Contributor

looks good.

@fabianofranz fabianofranz force-pushed the 614_deployment_history branch from f786fa0 to af07093 Compare May 13, 2015 19:17
@fabianofranz
Copy link
Member Author

Squashed, [merge].

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/2149/) (Image: devenv-fedora_1506)

@openshift-bot
Copy link
Contributor

[Test]ing while waiting on the merge queue

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/2149/)

@fabianofranz fabianofranz force-pushed the 614_deployment_history branch from af07093 to b217ed6 Compare May 13, 2015 21:24
@openshift-bot
Copy link
Contributor

Evaluated for origin up to b217ed6

openshift-bot pushed a commit that referenced this pull request May 14, 2015
@openshift-bot openshift-bot merged commit 97815d3 into openshift:master May 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants