(hosts []nix.Host)
| 362 | } |
| 363 | |
| 364 | func 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) |
no test coverage detected