feat: implement namespace management and improve build process
This commit is contained in:
@@ -2,6 +2,7 @@ import { defineCommand } from "citty";
|
||||
import { Listr } from "listr2";
|
||||
import { ctx } from "../lib/context";
|
||||
import {
|
||||
assertManagedNamespace,
|
||||
deleteResource,
|
||||
listManagedResources,
|
||||
sortResources,
|
||||
@@ -21,6 +22,7 @@ export const down = defineCommand({
|
||||
},
|
||||
async run({ args }) {
|
||||
const { project } = ctx();
|
||||
await assertManagedNamespace(project);
|
||||
const resources = sortResources(await listManagedResources(project)).filter(
|
||||
(resource) =>
|
||||
args.full ||
|
||||
|
||||
+3
-1
@@ -1,6 +1,7 @@
|
||||
import { defineCommand } from "citty";
|
||||
import { Listr } from "listr2";
|
||||
import { listManagedDeployments, scaleDeployment } from "../lib/shared";
|
||||
import { assertManagedNamespace } from "../lib/apply";
|
||||
import { getProject, listManagedDeployments, scaleDeployment } from "../lib/shared";
|
||||
|
||||
export const stop = defineCommand({
|
||||
meta: {
|
||||
@@ -8,6 +9,7 @@ export const stop = defineCommand({
|
||||
description: "Scale managed deployments to zero",
|
||||
},
|
||||
async run() {
|
||||
await assertManagedNamespace(getProject());
|
||||
const deployments = await listManagedDeployments();
|
||||
|
||||
await new Listr([
|
||||
|
||||
+11
-2
@@ -3,6 +3,7 @@ import { Listr } from "listr2";
|
||||
import type { ComposeSpecification } from "../schema/docker.d";
|
||||
import { ctx } from "../lib/context";
|
||||
import {
|
||||
assertManagedNamespace,
|
||||
applyResource,
|
||||
deleteResource,
|
||||
getStaleResources,
|
||||
@@ -19,6 +20,7 @@ type UpContext = {
|
||||
|
||||
export async function runUp(build: boolean) {
|
||||
const { project, compose, cwd } = ctx();
|
||||
await assertManagedNamespace(project);
|
||||
|
||||
await new Listr<UpContext>([
|
||||
{
|
||||
@@ -30,14 +32,21 @@ export async function runUp(build: boolean) {
|
||||
},
|
||||
{
|
||||
title: "Build images",
|
||||
rendererOptions: {
|
||||
outputBar: 10,
|
||||
persistentOutput: true,
|
||||
},
|
||||
enabled: () => build,
|
||||
skip: (taskCtx) =>
|
||||
Object.values(taskCtx.compose?.services ?? {}).some((service) => service.build)
|
||||
? false
|
||||
: "No buildable services",
|
||||
task: async (taskCtx, task) => {
|
||||
const built = await buildServices(project, taskCtx.compose!, cwd, (message) => {
|
||||
task.output = message;
|
||||
const built = await buildServices(project, taskCtx.compose!, cwd, {
|
||||
progress: (message) => {
|
||||
task.output = message;
|
||||
},
|
||||
stream: task.stdout(),
|
||||
});
|
||||
task.output = `Built ${built} image${built === 1 ? "" : "s"}`;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user