MCPcopy Create free account
hub / github.com/DBCDK/morph / main

Function main

morph.go:260–306  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

258}
259
260func main() {
261
262 clause := kingpin.MustParse(app.Parse(os.Args[1:]))
263
264 //TODO: Remove deprecation warning when removing --build-arg flag
265 if len(nixBuildArg) > 0 {
266 fmt.Fprintln(os.Stderr, "Deprecation: The --build-arg flag will be removed in a future release.")
267 }
268
269 defer utils.RunFinalizers()
270 setup()
271
272 // evaluate without building hosts
273 switch clause {
274 case eval.FullCommand():
275 _, err := execEval()
276 handleError(err)
277 return
278 }
279
280 // setup hosts
281 hosts, err := getHosts(deployment)
282 handleError(err)
283
284 switch clause {
285 case build.FullCommand():
286 _, err = execBuild(hosts)
287 case push.FullCommand():
288 _, err = execPush(hosts)
289 case deploy.FullCommand():
290 _, err = execDeploy(hosts)
291 case healthCheck.FullCommand():
292 err = execHealthCheck(hosts)
293 case uploadSecrets.FullCommand():
294 err = execUploadSecrets(createSSHContext(), hosts, nil)
295 case listSecrets.FullCommand():
296 if asJson {
297 err = execListSecretsAsJson(hosts)
298 } else {
299 execListSecrets(hosts)
300 }
301 case execute.FullCommand():
302 err = execExecute(hosts)
303 }
304
305 handleError(err)
306}
307
308func handleError(err error) {
309 //Stupid handling of catch-all errors for now

Callers

nothing calls this directly

Calls 14

RunFinalizersFunction · 0.92
setupFunction · 0.85
execEvalFunction · 0.85
handleErrorFunction · 0.85
getHostsFunction · 0.85
execBuildFunction · 0.85
execPushFunction · 0.85
execDeployFunction · 0.85
execHealthCheckFunction · 0.85
execUploadSecretsFunction · 0.85
createSSHContextFunction · 0.85
execListSecretsAsJsonFunction · 0.85

Tested by

no test coverage detected