jx icon indicating copy to clipboard operation
jx copied to clipboard

jx-build-controller should not block on log gathering

Open JordanGoasdoue opened this issue 2 years ago • 2 comments

jx-build-controller is stuck on "logging pod" from here https://github.com/jenkins-x-plugins/jx-build-controller/blob/35b904eeb00de306120975c6e0408cb2d4268c6b/pkg/cmd/controller/tekton/tekton.go#L361

This is this function from jx-pipeline: https://github.com/jenkins-x-plugins/jx-pipeline/blob/76d8eb75c20e614f0759160bf25481ff9dcaad94/pkg/tektonlog/tektonlog.go#L200

func (t *TektonLogger) GetRunningBuildLogs(ctx context.Context, pa *v1.PipelineActivity, pipelineRuns []*tektonapis.PipelineRun, buildName string) <-chan LogLine {
	ch := make(chan LogLine)
	go func() {
		defer close(ch)
		err := t.getRunningBuildLogs(ctx, pa, pipelineRuns, buildName, ch)
		if err != nil {
			t.err = err
		}
	}()
	return ch
}

On the case the Pod being logged takes time to complete, or is even stuck on a state because one of his container is in Error, then the jx-build-controller will be stuck at this state

{"timestamp":"2022-03-29T14:35:23.899278788Z","message":"logging pod: jx3-preview-integration-tests-r6525-test-fail-tfs9f-pod-c7qn6 for task test-fail","severity":"INFO","context":{}}

The log gathering needs to be non blocking

JordanGoasdoue avatar Mar 31 '22 15:03 JordanGoasdoue

I will start working on this

rajatgupta24 avatar Sep 16 '22 13:09 rajatgupta24

Thanks @rajatgupta24, if you need to talk about this, to be able to reproduce etc, I am on slack :)

JordanGoasdoue avatar Sep 20 '22 16:09 JordanGoasdoue