-
Notifications
You must be signed in to change notification settings - Fork 267
/
cluster-init.ts
44 lines (36 loc) · 1.3 KB
/
cluster-init.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* Copyright (C) 2018-2023 Garden Technologies, Inc. <info@garden.io>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import type { PluginCommand } from "../../../plugin/command.js"
import { prepareEnvironment, getEnvironmentStatus } from "../init.js"
import chalk from "chalk"
import { emitNonRepeatableWarning } from "../../../warnings.js"
// TODO: remove in 0.14
export const clusterInit: PluginCommand = {
name: "cluster-init",
description: "[DEPRECATED] Initialize or update cluster-wide Garden services.",
title: ({ environmentName }) => {
return `Initializing/updating cluster-wide services for ${chalk.white(environmentName)} environment`
},
handler: async ({ ctx, log }) => {
emitNonRepeatableWarning(log, "This command is now deprecated and will be removed in Garden 0.14.")
const status = await getEnvironmentStatus({ ctx, log })
let result = {}
if (status.ready) {
log.info("All services already initialized!")
} else {
result = await prepareEnvironment({
ctx,
log,
force: true,
status,
})
}
log.info(chalk.green("\nDone!"))
return { result }
},
}