jenkins-x / jx

Jenkins X provides automated CI+CD for Kubernetes with Preview Environments on Pull Requests using Cloud Native pipelines from Tekton
https://jenkins-x.io/
Apache License 2.0
4.58k stars 788 forks source link

`jx get build log --wait` does not work in Prow while build-step-jenkins in PodInitializing #2751

Closed jglick closed 5 years ago

jglick commented 5 years ago

Summary

jx get build log fails when a Knative Build pod is still initializing, typically up to a minute after triggering the job, even if --wait is supplied.

Steps to reproduce the behavior

jx get build log -w -r whatever

in a --prow cluster.

Jx version

The output of jx version is:

NAME               VERSION
jx                 1.3.754
jenkins x platform 0.0.3193
Kubernetes cluster v1.11.5-gke.5
kubectl            v1.13.1
helm client        v2.12.1+g02a47c7
helm server        v2.12.1+g02a47c7
git                git version 2.19.1
Operating System   Ubuntu 18.10

Kubernetes cluster

GKE

Operating system / Environment

Ubuntu Cosmic

Expected behavior

The command would wait for the jenkinsfile-runner pod to start, and then begin printing its messages.

Actual behavior

Getting the pod log for pod … and init container build-step-credential-initializer
{"level":"warn","ts":…,"logger":"fallback-logger","caller":"logging/config.go:65","msg":"Fetch GitHub commit ID from kodata failed: \"ref: refs/heads/test\" is not a valid GitHub commit ID"}
{"level":"info","ts":…,"logger":"fallback-logger","caller":"creds-init/main.go:40","msg":"Credentials initialized."}
Getting the pod log for pod … and init container build-step-git-source-0
{"level":"warn","ts":…,"logger":"fallback-logger","caller":"logging/config.go:65","msg":"Fetch GitHub commit ID from kodata failed: \"ref: refs/heads/test\" is not a valid GitHub commit ID"}
{"level":"info","ts":…,"logger":"fallback-logger","caller":"git-init/main.go:92","msg":"Successfully cloned \"https://github.com/…/….git\" @ \"…\" in path \"/workspace\""}
Getting the pod log for pod … and init container build-step-jenkins
Error from server (BadRequest): container "build-step-jenkins" in pod "…" is waiting to start: PodInitializing

and the command exits. I need to keep on retrying the command until it starts to run:

Picked up _JAVA_OPTIONS: -Xmx400m
Started
Running in Durability level: PERFORMANCE_OPTIMIZED
…
jstrachan commented 5 years ago

this is a really annoying bug BTW! :) I tried to figure out the magic status check on the Pod to spot then it's really initialising and wait for a possible log - but so far have failed.

Anyone fancy taking a stab at it? :)

jglick commented 5 years ago

Confirmed working in 1.3.801. :tada: