diff --git a/pkg/pipelineascode/pipelineascode.go b/pkg/pipelineascode/pipelineascode.go index e0cd70e4b..754780079 100644 --- a/pkg/pipelineascode/pipelineascode.go +++ b/pkg/pipelineascode/pipelineascode.go @@ -301,6 +301,14 @@ func (p *PacRun) startPR(ctx context.Context, match matcher.Match) (*tektonv1.Pi return pr, fmt.Errorf("cannot use the API on the provider platform to create a in_progress status: %w", err) } + // Also update the parent status (without pipeline name) to reflect pipeline is now running. + // This updates the initial "Pipelines as Code CI" status that was set when waiting for /ok-to-test. + parentStatus := status + parentStatus.OriginalPipelineRunName = "" + if err := p.vcx.CreateStatus(ctx, p.event, parentStatus); err != nil { + p.logger.Warnf("failed to update parent status: %v", err) + } + // Patch pipelineRun with logURL annotation, skips for GitHub App as we patch logURL while patching CheckrunID if _, ok := pr.Annotations[keys.InstallationID]; !ok { patchAnnotations[keys.LogURL] = p.run.Clients.ConsoleUI().DetailURL(pr) diff --git a/pkg/provider/gitlab/gitlab.go b/pkg/provider/gitlab/gitlab.go index 145ac1862..4c48add14 100644 --- a/pkg/provider/gitlab/gitlab.go +++ b/pkg/provider/gitlab/gitlab.go @@ -281,6 +281,11 @@ func (v *Provider) CreateStatus(_ context.Context, event *info.Event, statusOpts statusOpts.Conclusion = "success" statusOpts.Title = "completed" case "pending": + statusOpts.Conclusion = "pending" + } + // When the pipeline is actually running (in_progress), show it as running + // not pending. Pending is only for waiting states like /ok-to-test approval. + if statusOpts.Status == "in_progress" { statusOpts.Conclusion = "running" } if statusOpts.DetailsURL != "" { diff --git a/pkg/reconciler/reconciler.go b/pkg/reconciler/reconciler.go index 412047fb0..36ee59818 100644 --- a/pkg/reconciler/reconciler.go +++ b/pkg/reconciler/reconciler.go @@ -360,6 +360,9 @@ func (r *Reconciler) updatePipelineRunToInProgress(ctx context.Context, logger * return nil } + // Also update the parent status (without pipeline name) to reflect pipeline is running. + updateParentStatus(ctx, logger, detectedProvider, event, status) + logger.Info("updated in_progress status on provider platform for pipelineRun ", pr.GetName()) return nil } diff --git a/pkg/reconciler/status.go b/pkg/reconciler/status.go index 46fcc5bb6..243332b68 100644 --- a/pkg/reconciler/status.go +++ b/pkg/reconciler/status.go @@ -158,6 +158,10 @@ func (r *Reconciler) postFinalStatus(ctx context.Context, logger *zap.SugaredLog err = createStatusWithRetry(ctx, logger, vcx, event, status) logger.Infof("pipelinerun %s has a status of '%s'", pr.Name, status.Conclusion) + + // Also update the parent status (without pipeline name) to reflect pipeline completion. + updateParentStatus(ctx, logger, vcx, event, status) + return pr, err } @@ -174,3 +178,14 @@ func createStatusWithRetry(ctx context.Context, logger *zap.SugaredLogger, vcx p } return fmt.Errorf("failed to report status: %w", finalError) } + +// updateParentStatus updates the parent status (without pipeline name) to reflect the current state. +// This ensures the initial "Pipelines as Code CI" status set when waiting for /ok-to-test is updated +// when pipelines start or complete. Uses retry logic for resilience to transient network issues. +func updateParentStatus(ctx context.Context, logger *zap.SugaredLogger, vcx provider.Interface, event *info.Event, status provider.StatusOpts) { + parentStatus := status + parentStatus.OriginalPipelineRunName = "" + if err := createStatusWithRetry(ctx, logger, vcx, event, parentStatus); err != nil { + logger.Warnf("failed to update parent status: %v", err) + } +}