如何从命令行获取 openshift 部署历史记录?
How to get the openshift deployment history from the commandine?
我们正在使用 Openshift Online Pro。
我想要记录/编写如何在命令行上查看 openshift 部署修订的脚本,以便于回滚到特定修订。在 Web 控制台上,部署有一个 "History" 选项卡,其中显示了修订号及其执行时间:
https://www.dropbox.com/s/12z4gmuqdzlnurg/File%2005-03-2018%2C%2007%2048%2053.jpeg?dl=0
如果我使用命令行 oc get dc/backend
它只显示当前修订版。
命令行有没有办法获取部署历史数据,以便轻松编写回滚工具脚本以返回到特定修订版?
(注意:我知道 oc rollback backend
会回滚以前的版本,但在测试中存在一些极端情况,这无济于事,我们需要跳过两个或更多版本。)
使用:
oc describe dc/prometheus
它会向您显示如下内容:
Deployment #11 (latest):
Name: prometheus-11
Created: 3 hours ago
Status: Complete
Replicas: 1 current / 1 desired
Selector: app=prometheus,deployment=prometheus-11,deploymentconfig=prometheus
Labels: app=prometheus,openshift.io/deployment-config.name=prometheus
Pods Status: 1 Running / 0 Waiting / 0 Succeeded / 0 Failed
Deployment #10:
Created: 5 hours ago
Status: Complete
Replicas: 0 current / 0 desired
Deployment #9:
Created: 6 hours ago
Status: Complete
Replicas: 0 current / 0 desired
对于精简版,使用:
oc rollout history dc/prometheus
这会给你:
deploymentconfigs "prometheus"
REVISION STATUS CAUSE
9 Complete manual change
10 Complete manual change
11 Complete manual change
我们正在使用 Openshift Online Pro。
我想要记录/编写如何在命令行上查看 openshift 部署修订的脚本,以便于回滚到特定修订。在 Web 控制台上,部署有一个 "History" 选项卡,其中显示了修订号及其执行时间:
https://www.dropbox.com/s/12z4gmuqdzlnurg/File%2005-03-2018%2C%2007%2048%2053.jpeg?dl=0
如果我使用命令行 oc get dc/backend
它只显示当前修订版。
命令行有没有办法获取部署历史数据,以便轻松编写回滚工具脚本以返回到特定修订版?
(注意:我知道 oc rollback backend
会回滚以前的版本,但在测试中存在一些极端情况,这无济于事,我们需要跳过两个或更多版本。)
使用:
oc describe dc/prometheus
它会向您显示如下内容:
Deployment #11 (latest):
Name: prometheus-11
Created: 3 hours ago
Status: Complete
Replicas: 1 current / 1 desired
Selector: app=prometheus,deployment=prometheus-11,deploymentconfig=prometheus
Labels: app=prometheus,openshift.io/deployment-config.name=prometheus
Pods Status: 1 Running / 0 Waiting / 0 Succeeded / 0 Failed
Deployment #10:
Created: 5 hours ago
Status: Complete
Replicas: 0 current / 0 desired
Deployment #9:
Created: 6 hours ago
Status: Complete
Replicas: 0 current / 0 desired
对于精简版,使用:
oc rollout history dc/prometheus
这会给你:
deploymentconfigs "prometheus"
REVISION STATUS CAUSE
9 Complete manual change
10 Complete manual change
11 Complete manual change