Skip to content

Commit

Permalink
chore: adjust base on comments
Browse files Browse the repository at this point in the history
  • Loading branch information
l-qing authored and tekton-robot committed Jan 21, 2025
1 parent 816bad4 commit acc6fcd
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions pkg/reconciler/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ func PipelineReady(informer informer.TektonPipelineInformer) (*v1alpha1.TektonPi
}
return nil, err
}
readyCondition := ppln.GetStatus().GetCondition(apis.ConditionReady)
if readyCondition != nil && strings.Contains(readyCondition.Message, v1alpha1.UpgradePending) {
if isUpgradePending(ppln.GetStatus()) {
return nil, v1alpha1.DEPENDENCY_UPGRADE_PENDING_ERR
}
if !ppln.Status.IsReady() {
Expand All @@ -53,6 +52,18 @@ func PipelineReady(informer informer.TektonPipelineInformer) (*v1alpha1.TektonPi
return ppln, nil
}

// isUpgradePending checks if the component status indicates an upgrade is pending
func isUpgradePending(status v1alpha1.TektonComponentStatus) bool {
if status == nil {
return false
}
readyCondition := status.GetCondition(apis.ConditionReady)
if readyCondition == nil {
return false
}
return strings.Contains(readyCondition.Message, v1alpha1.UpgradePending)
}

func PipelineTargetNamspace(informer informer.TektonPipelineInformer) (string, error) {
ppln, err := getPipelineRes(informer)
if err != nil {
Expand Down

0 comments on commit acc6fcd

Please sign in to comment.