Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show logs in creation time order #278

Merged
merged 2 commits into from
Sep 4, 2023
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
42 changes: 0 additions & 42 deletions .github/workflows/jenkins-x-pr.yaml

This file was deleted.

11 changes: 8 additions & 3 deletions pkg/cmd/joblog/joblog.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,13 @@ func (o *Options) viewJobLog(client kubernetes.Interface, ns string, selector st
}

var answer error
for i := range podList.Items {
pod := &podList.Items[i]
pos := podList.Items
// Sort pods in creation time order
sort.Slice(pos, func(i, j int) bool {
return pos[i].CreationTimestamp.Before(&pos[j].CreationTimestamp)
})
for i := range pos {
pod := &pos[i]

// lets verify the container name
err = verifyContainerName(pod, containerName)
Expand All @@ -264,7 +269,7 @@ func (o *Options) viewJobLog(client kubernetes.Interface, ns string, selector st
return errors.Wrapf(err, "failed to wait for pod %s to be running", pod.Name)
}
podName := pod.Name
logger.Logger().Infof("\ntailing boot Job pod %s\n\n", info(podName))
logger.Logger().Infof("\ntailing boot Job pod %s created %s\n\n", info(podName), info(pod.CreationTimestamp))

err = podlogs.TailLogs(ns, podName, containerName, o.ErrOut, o.Out)
if err != nil {
Expand Down
Loading