Skip to content
Merged
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
4 changes: 4 additions & 0 deletions pkg/api/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ const (

APPCIKubeAPIURL = "https://api.ci.l2s4.p1.openshiftapps.com:6443"

// ReasonPending is the error reason for pods not scheduled in time.
// It is generated when pods are for whatever reason not scheduled before
// `podStartTimeout`.
ReasonPending = "pod_pending"
// CliEnv if the env we use to expose the path to the cli
CliEnv = "CLI_DIR"
DefaultLeaseEnv = "LEASED_RESOURCE"
Expand Down
3 changes: 3 additions & 0 deletions pkg/util/builds.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import (

buildapi "github.com/openshift/api/build/v1"

"github.com/openshift/ci-tools/pkg/api"
"github.com/openshift/ci-tools/pkg/kubernetes"
"github.com/openshift/ci-tools/pkg/results"
)

// PendingBuildError fetches scheduling errors from the build pod's events
Expand All @@ -28,5 +30,6 @@ func PendingBuildError(ctx context.Context, client kubernetes.PodClient, build *
} else {
ret = fmt.Errorf("%s:%s\n%s", msg, getReasonsForUnreadyContainers(&pod), getEventsForPod(ctx, &pod, client))
}
ret = results.ForReason(api.ReasonPending).ForError(ret)
return
}
4 changes: 3 additions & 1 deletion pkg/util/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
ctrlruntimeclient "sigs.k8s.io/controller-runtime/pkg/client"

"github.com/openshift/ci-tools/pkg/api"
"github.com/openshift/ci-tools/pkg/kubernetes"
"github.com/openshift/ci-tools/pkg/results"
)

// WaitForPodFlag changes the behavior of the functions which monitor pods
Expand Down Expand Up @@ -431,7 +433,7 @@ func checkPending(pod corev1.Pod, timeout time.Duration, now time.Time) (time.Ti
if t := t0.Add(timeout); now.Before(t) {
return t, nil
}
return time.Time{}, fmt.Errorf("container %q has not started in %s", name, now.Sub(t0))
return time.Time{}, results.ForReason(api.ReasonPending).ForError(fmt.Errorf("container %q has not started in %s", name, now.Sub(t0)))
}
prev := pod.CreationTimestamp.Time
for _, s := range pod.Status.InitContainerStatuses {
Expand Down