TriggerParser triggers the deployment's project parser to do a new pull and parse.
(ctx context.Context, depl *database.Deployment)
| 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) { |
| 453 | s.Logger.Info("reconcile: triggering pull", zap.String("deployment_id", depl.ID), observability.ZapCtx(ctx)) |
| 454 | defer func() { |
| 455 | if err != nil { |
| 456 | s.Logger.Error("reconcile: trigger pull failed", zap.String("deployment_id", depl.ID), zap.Error(err), observability.ZapCtx(ctx)) |
| 457 | } else { |
| 458 | s.Logger.Info("reconcile: trigger pull completed", zap.String("deployment_id", depl.ID), observability.ZapCtx(ctx)) |
| 459 | } |
| 460 | }() |
| 461 | |
| 462 | rt, err := s.OpenRuntimeClient(depl) |
| 463 | if err != nil { |
| 464 | return err |
| 465 | } |
| 466 | defer rt.Close() |
| 467 | |
| 468 | _, err = rt.CreateTrigger(ctx, &runtimev1.CreateTriggerRequest{ |
| 469 | InstanceId: depl.RuntimeInstanceID, |
| 470 | Parser: true, |
| 471 | }) |
| 472 | return err |
| 473 | } |
| 474 | |
| 475 | // TriggerParserAndAwaitResource triggers the parser and polls the runtime until the given resource's spec version has been updated (or ctx is canceled). |
| 476 | func (s *Service) TriggerParserAndAwaitResource(ctx context.Context, depl *database.Deployment, name, kind string) error { |
no test coverage detected