build icon indicating copy to clipboard operation
build copied to clipboard

Strange logs when the git repo doesn't exist

Open dgageot opened this issue 6 years ago • 4 comments

/kind bug

Expected Behavior

If I provide a non-existent git repository as a source. I expect to get a clear error message when the build fails.

Actual Behavior

I see this in the build-step-git-source step logs:

F0528 13:49:59.616422       1 main.go:38] Unexpected error running git [fetch --depth=1 --recurse-submodules=yes origin refs/heads/master]: exit status 128
fatal: could not read Username for 'https://github.com': No such device or address
goroutine 1 [running]:
github.com/elafros/build/vendor/github.com/golang/glog.stacks(0xc420066600, 0xc4200b4000, 0xef, 0x145)
	/go/src/github.com/elafros/build/vendor/github.com/golang/glog/glog.go:766 +0xcf
github.com/elafros/build/vendor/github.com/golang/glog.(*loggingT).output(0x580100, 0xc400000003, 0xc4200ae000, 0x5681e6, 0x7, 0x26, 0x0)
	/go/src/github.com/elafros/build/vendor/github.com/golang/glog/glog.go:717 +0x30f
github.com/elafros/build/vendor/github.com/golang/glog.(*loggingT).printf(0x580100, 0xc400000003, 0x4f2dd0, 0x25, 0xc420043eb0, 0x4, 0x4)
	/go/src/github.com/elafros/build/vendor/github.com/golang/glog/glog.go:655 +0x14b
github.com/elafros/build/vendor/github.com/golang/glog.Fatalf(0x4f2dd0, 0x25, 0xc420043eb0, 0x4, 0x4)
	/go/src/github.com/elafros/build/vendor/github.com/golang/glog/glog.go:1145 +0x67
main.runOrFail(0x4ecffa, 0x3, 0xc42007c4b0, 0x5, 0x5)
	/go/src/github.com/elafros/build/cmd/git-init/main.go:38 +0x2da
main.main()
	/go/src/github.com/elafros/build/cmd/git-init/main.go:57 +0x259

To Reproduce

$ cat << EOD | kubectl apply -f -
apiVersion: build.dev/v1alpha1
kind: Build
metadata:
  name: git-build
spec:
  source:
    git:
      url: https://github.com/GoogleContainerTools/UNKNOWN.git
      branch: master
  steps:
  - image: ubuntu
    args: ["cat", "README.md"]
EOD
build "git-build" created

$ kubectl logs $(kubectl get build git-build -ojsonpath={.status.cluster.podName}) -c build-step-git-source

dgageot avatar May 28 '18 13:05 dgageot

I'm not sure anymore the issue is with the repo being unknown. I'm having the problem now with a valid repo url. This worked 5 minutes ago...

dgageot avatar May 28 '18 13:05 dgageot

Forget about my last comment. It was my bad. It works when the url is valid

dgageot avatar May 28 '18 14:05 dgageot

The error seems to be that the git creds aren't annotated so that creds init can write them to .gitconfig. That's a bug in my open auth PR.

Other related bugs I should fix:

  • should detect that we won't have creds for the repo and print some warning like "falling back to anonymous access"
  • detect the git fetch error output and give a better error message (this would fix for unknown repos)
  • glog.Fatal -> log.Fatal which wouldn't print an ugly stack trace (and glog is just bad anyway)

imjasonh avatar May 28 '18 14:05 imjasonh

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.\n If this issue is safe to close now please do so with /close.\n Send feedback to Knative Productivity Slack channel or knative/test-infra. /lifecycle stale