feat: implement rollback command for deployments
- Added a new `rollback` command to roll back deployments to their previous release. - Introduced `findRollbackCandidates` and `rollbackDeployment` functions to handle rollback logic. - Updated CLI command definitions to include the new `rollback` command with an alias. - Enhanced deployment conversion to use resolved images for buildable services. - Introduced a new `graph` module to visualize Kubernetes resources and their relationships. - Added tests for the new rollback functionality and graph rendering. - Updated package version to 1.3.0.
This commit is contained in:
+9
-9
@@ -1,6 +1,10 @@
|
||||
import { defineCommand } from "citty";
|
||||
import { listDeployments } from "../lib/shared";
|
||||
import { toTable } from "../lib/format";
|
||||
import {
|
||||
buildNamespaceGraphs,
|
||||
fetchNamespaceObjects,
|
||||
renderNamespaceGraphs,
|
||||
} from "../lib/graph";
|
||||
import { getProject } from "../lib/shared";
|
||||
|
||||
export const ps = defineCommand({
|
||||
meta: {
|
||||
@@ -16,14 +20,10 @@ export const ps = defineCommand({
|
||||
},
|
||||
},
|
||||
async run({ args: { all } }) {
|
||||
const objects = await fetchNamespaceObjects(getProject());
|
||||
console.log(
|
||||
toTable(
|
||||
(await listDeployments())
|
||||
.filter((d) => all || d.status?.replicas)
|
||||
.map((d) => ({
|
||||
name: d.metadata?.name,
|
||||
status: `${d.status?.availableReplicas}/${d.status?.replicas}`,
|
||||
})),
|
||||
renderNamespaceGraphs(
|
||||
buildNamespaceGraphs(objects, { includeIdle: all }),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user