Skip to content

Commit

Permalink
dbg
Browse files Browse the repository at this point in the history
rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED
  • Loading branch information
gabemontero committed Feb 26, 2024
1 parent 3ab33e7 commit 8483240
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/watcher/reconciler/dynamic/dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func (r *Reconciler) sendLog(ctx context.Context, o results.Object) error {
return nil
}

func (r *Reconciler) getPodLogs(ctx context.Context, ns, pod, container, pipeline, task string) ([]byte, error) {
func (r *Reconciler) getPodLogs(ctx context.Context, ns, pod, container, labelKey, task string) ([]byte, error) {
logger := logging.FromContext(ctx)
podLogOpts := corev1.PodLogOptions{
Container: container,
Expand All @@ -372,7 +372,7 @@ func (r *Reconciler) getPodLogs(ctx context.Context, ns, pod, container, pipelin
zap.String("ns", ns),
zap.String("pod", pod),
zap.String("container", container),
zap.String("pipeline", pipeline),
zap.String("labelKey", labelKey),
zap.String("task", task),
)
rdr := bufio.NewReader(podLogs)
Expand All @@ -394,7 +394,7 @@ func (r *Reconciler) getPodLogs(ctx context.Context, ns, pod, container, pipelin
s := ""
stepName := strings.TrimPrefix(container, "step-")
s = fmt.Sprintf("[%s : %s] %s", task, stepName, string(line))
if len(pipeline) == 0 {
if labelKey == pipeline.TaskRunLabelKey {
s = fmt.Sprintf("[%s] %s", container, string(line))
}
logger.Infow("GGM readLine formatted line",
Expand Down Expand Up @@ -440,7 +440,11 @@ func (r *Reconciler) streamLogs(ctx context.Context, o results.Object, labelKey,
for _, container := range containers {
pipelineName := pod.Labels[pipeline.PipelineLabelKey]
taskName := pod.Labels[pipeline.TaskLabelKey]
ba, podLogsErr := r.getPodLogs(ctx, o.GetNamespace(), pod.Name, container.Name, pipelineName, taskName)
logger.Infow("GGMGGM labels",
zap.String("pipeline", pipelineName),
zap.String("task", taskName))

ba, podLogsErr := r.getPodLogs(ctx, o.GetNamespace(), pod.Name, container.Name, labelKey, taskName)
if podLogsErr != nil {
return podLogsErr
}
Expand Down

0 comments on commit 8483240

Please sign in to comment.