(ctx context.Context, opts *CreateDeploymentOptions)
| 35 | } |
| 36 | |
| 37 | func (s *Service) CreateDeployment(ctx context.Context, opts *CreateDeploymentOptions) (*database.Deployment, error) { |
| 38 | // Create the deployment |
| 39 | depl, err := s.DB.InsertDeployment(ctx, &database.InsertDeploymentOptions{ |
| 40 | ProjectID: opts.ProjectID, |
| 41 | OwnerUserID: opts.OwnerUserID, |
| 42 | Environment: opts.Environment, |
| 43 | Branch: opts.Branch, |
| 44 | Editable: opts.Editable, |
| 45 | RuntimeHost: "", // Will be populated after provisioning in startDeploymentInner |
| 46 | RuntimeInstanceID: "", // Will be populated after provisioning in startDeploymentInner |
| 47 | RuntimeAudience: "", // Will be populated after provisioning in startDeploymentInner |
| 48 | Status: database.DeploymentStatusPending, // Initial status is pending so we can return a valid deployment state immediately |
| 49 | StatusMessage: "Provisioning...", |
| 50 | DesiredStatus: database.DeploymentStatusRunning, |
| 51 | }) |
| 52 | if err != nil { |
| 53 | return nil, err |
| 54 | } |
| 55 | |
| 56 | // Trigger reconcile deployment job |
| 57 | err = s.triggerDeploymentReconcileJob(ctx, depl.ID) |
| 58 | if err != nil { |
| 59 | return nil, err |
| 60 | } |
| 61 | |
| 62 | return depl, nil |
| 63 | } |
| 64 | |
| 65 | func (s *Service) StartDeployment(ctx context.Context, depl *database.Deployment) (*database.Deployment, error) { |
| 66 | // Update the desired deployment status to running |
no test coverage detected