Skip to content
This repository was archived by the owner on Jun 14, 2019. It is now read-only.
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: 0 additions & 4 deletions TEMPLATES.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ overall result of the job.
Comma-separated list of container names for which ci-operator will wait until complete,
to gather the artifacts.

`ci-operator.openshift.io/always-show-output`:
Will output the logs of all the containers in the pod, no matter what the exit code was.
The value should be `true` to enable this feature.

`ci-operator.openshift.io/containers-logged-on-failure`:
Comma-separated list of container names for which ci-operator will collect and log their output if pod fails.
By default, only the logs from the failed containers will be output.
15 changes: 5 additions & 10 deletions pkg/steps/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ type templateExecutionStep struct {
}

const (
showOutputAnnotation string = "ci-operator.openshift.io/always-show-output"
showContainerOutputAnnotation string = "ci-operator.openshift.io/containers-logged-on-failure"
)

Expand Down Expand Up @@ -593,10 +592,8 @@ func waitForPodCompletionOrTimeout(podClient coreclientset.PodInterface, name st
return false, nil
}
if podJobIsFailed(pod) {
if pod.ObjectMeta.Annotations[showOutputAnnotation] != "true" {
if err := outputAnnotatedContainerLogs(podClient, pod); err != nil {
log.Printf("%v", err)
}
if err := outputAnnotatedContainerLogs(podClient, pod); err != nil {
log.Printf("%v", err)
}
return false, appendLogToError(fmt.Errorf("the pod %s/%s failed after %s (failed containers: %s): %s", pod.Namespace, pod.Name, podDuration(pod).Truncate(time.Second), strings.Join(failedContainerNames(pod), ", "), podReason(pod)), podMessages(pod))
}
Expand All @@ -623,10 +620,8 @@ func waitForPodCompletionOrTimeout(podClient coreclientset.PodInterface, name st
return false, nil
}
if podJobIsFailed(pod) {
if pod.ObjectMeta.Annotations[showOutputAnnotation] != "true" {
if err := outputAnnotatedContainerLogs(podClient, pod); err != nil {
log.Printf("%v", err)
}
if err := outputAnnotatedContainerLogs(podClient, pod); err != nil {
log.Printf("%v", err)
}
return false, appendLogToError(fmt.Errorf("the pod %s/%s failed after %s (failed containers: %s): %s", pod.Namespace, pod.Name, podDuration(pod).Truncate(time.Second), strings.Join(failedContainerNames(pod), ", "), podReason(pod)), podMessages(pod))
}
Expand Down Expand Up @@ -816,7 +811,7 @@ func podLogNewContainers(podClient coreclientset.PodInterface, pod *coreapi.Pod,
completed[status.Name] = s.FinishedAt.Time
notifier.Notify(pod, status.Name)

if pod.ObjectMeta.Annotations[showOutputAnnotation] != "true" && s.ExitCode == 0 {
if s.ExitCode == 0 {
log.Printf("Container %s in pod %s completed successfully", status.Name, pod.Name)
continue
}
Expand Down