HibernateProject hibernates a project by tearing down its deployment.
(ctx context.Context, proj *database.Project)
| 407 | |
| 408 | // HibernateProject hibernates a project by tearing down its deployment. |
| 409 | func (s *Service) HibernateProject(ctx context.Context, proj *database.Project) (*database.Project, error) { |
| 410 | depls, err := s.DB.FindDeploymentsForProject(ctx, proj.ID, "", "") |
| 411 | if err != nil { |
| 412 | return nil, err |
| 413 | } |
| 414 | |
| 415 | for _, depl := range depls { |
| 416 | err = s.StopDeployment(ctx, depl) |
| 417 | if err != nil { |
| 418 | return nil, err |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | proj, err = s.DB.UpdateProject(ctx, proj.ID, &database.UpdateProjectOptions{ |
| 423 | Name: proj.Name, |
| 424 | Description: proj.Description, |
| 425 | Public: proj.Public, |
| 426 | DirectoryName: proj.DirectoryName, |
| 427 | Provisioner: proj.Provisioner, |
| 428 | ArchiveAssetID: proj.ArchiveAssetID, |
| 429 | GitRemote: proj.GitRemote, |
| 430 | GithubInstallationID: proj.GithubInstallationID, |
| 431 | GithubRepoID: proj.GithubRepoID, |
| 432 | ManagedGitRepoID: proj.ManagedGitRepoID, |
| 433 | ProdVersion: proj.ProdVersion, |
| 434 | PrimaryBranch: proj.PrimaryBranch, |
| 435 | Subpath: proj.Subpath, |
| 436 | PrimaryDeploymentID: nil, |
| 437 | ProdSlots: proj.ProdSlots, |
| 438 | ProdTTLSeconds: proj.ProdTTLSeconds, |
| 439 | DevSlots: proj.DevSlots, |
| 440 | DevTTLSeconds: proj.DevTTLSeconds, |
| 441 | OverrideDiskGB: proj.OverrideDiskGB, |
| 442 | Annotations: proj.Annotations, |
| 443 | }) |
| 444 | if err != nil { |
| 445 | return nil, err |
| 446 | } |
| 447 | |
| 448 | return proj, nil |
| 449 | } |
| 450 | |
| 451 | // TriggerParser triggers the deployment's project parser to do a new pull and parse. |
| 452 | func (s *Service) TriggerParser(ctx context.Context, depl *database.Deployment) (err error) { |
nothing calls this directly
no test coverage detected