Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uploadStatuses triggers a "Ref not found" issue when adding a comment #1635

Closed
afrittoli opened this issue Nov 27, 2019 · 7 comments
Closed
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@afrittoli
Copy link
Member

Expected Behavior

When I add a comment to a PR, the resource add the comments and succeeds.

Actual Behavior

The comment is added to GitHub, however the upload step fails:

[pr-source-pr-kthbv-hwg5q] {"level":"info","ts":1574867159.0571039,"logger":"fallback-logger","caller":"logging/config.go:69","msg":"Fetch GitHub commit ID from kodata failed: open /var/run/ko/refs/heads/pr: no such file or directory"}
[pr-source-pr-kthbv-hwg5q] {"level":"info","ts":1574867159.0572007,"logger":"fallback-logger","caller":"pullrequest-init/main.go:56","msg":"RUNNING UPLOAD!"}
[pr-source-pr-kthbv-hwg5q] {"level":"info","ts":1574867159.0585206,"logger":"fallback-logger","caller":"pullrequest-init/api.go:107","msg":"Syncing resource: &{PR:0xc0000f1000 Status:0xc00027a600 Comments:[0xc0000fa1c0 0xc0000fa2a0 0xc0000fa380 0xc0000fa460 0xc0000fa540 0xc0000fa620 0xc0000fa700 0xc0000fa7e0 0xc0000fa8c0 0xc0000fa9a0 0xc0000faa80 0xc0000fab60 0xc0000fac40 0xc0000fad20 0xc0000fae00 0xc0000faee0] Manifests:map[comments:map[558338792:true 558362340:true 558362585:true 558767701:true 558767955:true 559051232:true 559051381:true 559051425:true 559118226:true 559118754:true 559119294:true 559120015:true 559120381:true 559121085:true 559124620:true] labels:map[]]}"}
[pr-source-pr-kthbv-hwg5q] {"level":"info","ts":1574867159.418764,"logger":"fallback-logger","caller":"pullrequest-init/api.go:144","msg":"Current labels: map[]"}
[pr-source-pr-kthbv-hwg5q] {"level":"info","ts":1574867159.4188342,"logger":"fallback-logger","caller":"pullrequest-init/api.go:155","msg":"Creating labels [] for PR 1"}
[pr-source-pr-kthbv-hwg5q] {"level":"info","ts":1574867159.571745,"logger":"fallback-logger","caller":"pullrequest-init/api.go:177","msg":"Setting comments for PR 1 to: [0xc0000fa1c0 0xc0000fa2a0 0xc0000fa380 0xc0000fa460 0xc0000fa540 0xc0000fa620 0xc0000fa700 0xc0000fa7e0 0xc0000fa8c0 0xc0000fa9a0 0xc0000faa80 0xc0000fab60 0xc0000fac40 0xc0000fad20 0xc0000fae00 0xc0000faee0]"}
[pr-source-pr-kthbv-hwg5q] {"level":"info","ts":1574867159.749752,"logger":"fallback-logger","caller":"pullrequest-init/api.go:248","msg":"Creating comment <img width=\"200\" alt=\"mario\" src=\"https://storage.googleapis.com/mario-bot/pics/mario.png\"> at your service! </p>Here is the image you requested: <a href=\"https://us.icr.io/knative/tkn:mario\">built image</a>|<a href=\"http://35.222.249.224/?buildid=7b9d3840-e4ce-410e-9178-07f8bbe71fea&namespace=mario\">build logs</a> for PR 1"}
[pr-source-pr-kthbv-hwg5q] {"level":"fatal","ts":1574867160.4215937,"logger":"fallback-logger","caller":"pullrequest-init/main.go:62","msg":"1 error occurred:\n\t* Ref not found\n\n","stacktrace":"main.main\n\t/go/src/github.com/tektoncd/pipeline/cmd/pullrequest-init/main.go:62\nruntime.main\n\t/usr/local/Cellar/go/1.13.4/libexec/src/runtime/proc.go:203"}

I narrowed down the issue to this block of code:

cs, _, err := h.client.Repositories.FindCombinedStatus(ctx, h.repo, status.Sha)
if err != nil {
return err

Something goes wrong when retrieving the status.

Steps to Reproduce the Problem

  1. I used the task defined in Setup a mario bot to build images on demand plumbing#118

Additional Info

@afrittoli
Copy link
Member Author

@wlynch Perhaps you have an idea? I added some logging and found out that after the FromDisk, r.Status.Sha is "", State is unknown and Statuses an empty list.

@wlynch
Copy link
Member

wlynch commented Nov 27, 2019

Looks like GitHub returns 404 if there are no statuses on the PR yet for both GetCombinedStatus and ListStatuses: https://gist.github.com/wlynch/223c1720a12fcbed92668fa5b988291d

Should be an easy fix.

/assign wlynch

@wlynch
Copy link
Member

wlynch commented Nov 27, 2019

Nevermind, that last gist was wrong. Here's the one showing it works: https://gist.github.com/wlynch/1fe05245b990cb2b0505c51fcd4712d7

Is the PR URL something you can share? I'm curious what the download thinks the status/SHA actually is, or if it's missing altogether.

@wlynch
Copy link
Member

wlynch commented Nov 27, 2019

Ahhhh. I see what's going on. The SHA is missing here:

return &scm.CombinedStatus{
Statuses: statuses,
}, nil

Good news is that #1550 will fix this: https://github.com/tektoncd/pipeline/pull/1550/files#diff-76f60b9c5045c6d153fdb07b04cc699eR303-R304

@vdemeester
Copy link
Member

@wlynch I'm gonna close this as #1550 is merged now 👼
/close

@tekton-robot
Copy link
Collaborator

@vdemeester: Closing this issue.

In response to this:

@wlynch I'm gonna close this as #1550 is merged now 👼
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@vdemeester
Copy link
Member

/kind bug

@tekton-robot tekton-robot added the kind/bug Categorizes issue or PR as related to a bug. label Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

4 participants