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

Function execDeploy

morph.go:364–467  ·  view source on GitHub ↗
(hosts []nix.Host)

Source from the content-addressed store, hash-verified

362}
363
364func execDeploy(hosts []nix.Host) (string, error) {
365 doPush := false
366 doUploadSecrets := false
367 doActivate := false
368
369 if !*dryRun {
370 switch deploySwitchAction {
371 case "dry-activate":
372 doPush = true
373 doActivate = true
374 case "test":
375 fallthrough
376 case "switch":
377 fallthrough
378 case "boot":
379 doPush = true
380 doUploadSecrets = deployUploadSecrets
381 doActivate = true
382 }
383 }
384
385 resultPath, err := buildHosts(hosts)
386 if err != nil {
387 return "", err
388 }
389
390 fmt.Fprintln(os.Stderr)
391
392 sshContext := createSSHContext()
393
394 for _, host := range hosts {
395 if host.BuildOnly {
396 fmt.Fprintf(os.Stderr, "Deployment steps are disabled for build-only host: %s\n", host.Name)
397 continue
398 }
399
400 singleHostInList := []nix.Host{host}
401
402 if doPush {
403 err = pushPaths(sshContext, singleHostInList, resultPath)
404 if err != nil {
405 return "", err
406 }
407 }
408 fmt.Fprintln(os.Stderr)
409
410 if doUploadSecrets {
411 phase := "pre-activation"
412 err = execUploadSecrets(sshContext, singleHostInList, &phase)
413 if err != nil {
414 return "", err
415 }
416
417 fmt.Fprintln(os.Stderr)
418 }
419
420 if !skipPreDeployChecks {
421 err := healthchecks.PerformPreDeployChecks(sshContext, &host, timeout)

Callers 1

mainFunction · 0.85

Calls 9

PerformPreDeployChecksFunction · 0.92
ExitFunction · 0.92
PerformHealthChecksFunction · 0.92
buildHostsFunction · 0.85
createSSHContextFunction · 0.85
pushPathsFunction · 0.85
execUploadSecretsFunction · 0.85
activateConfigurationFunction · 0.85
RebootMethod · 0.80

Tested by

no test coverage detected