Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/pipelineascode/pipelineascode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions pkg/provider/gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand Down
3 changes: 3 additions & 0 deletions pkg/reconciler/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
15 changes: 15 additions & 0 deletions pkg/reconciler/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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)
}
}
Loading