-
Notifications
You must be signed in to change notification settings - Fork 155
Travis: use $TRAVIS_PULL_REQUEST_BRANCH for branch if non-empty #190
Conversation
CI failure appears to be unrelated (at least mostly).. appears to be broken on/for master already since 2018.. :/ |
360d5a0
to
d818646
Compare
@drazisil Do you think this change is good as-is? What about the fact that it uses
|
@blueyed I'm not a Travis user normally. Could you possibly explain what the old code was picking up before? I suspect it would help me understand why push tests passed, but pull ones failed. |
It is explained in the list: But currently it will use "branch=master" for PRs to master, and this then makes the commit/coverage then show up within the list for that branch (https://codecov.freshdesk.com/helpdesk/tickets/1990). |
Sorry, I mean the |
@blueyed Can you also edit the test here https://github.com/blueyed/codecov-bash/blob/travis-pr-branch/tests/test#L260 so the branches match? (Thoughts on why I can't get the commits to match would be welcomed too) |
From
|
From a quick look at the tests, they are a bit borked - they should run in a clean environment, e.g. via |
I don't disagree. I'm not sure how to do that though, been trying. |
Using I think most of the latest changes to the tests should be reverted.. e.g. 6b1e835 does not make it clearer/better. I suggest fixing the tests in a branch, that you create 2 PRs from then: from "origin", and from your fork. You can take the |
Done, put it back to the way it was before I started fighting with commit SHAs |
@blueyed Does it look good now? |
0e8625e
to
d67770f
Compare
Ok. But you've noticed that you've force-pushed, right? (which is discouraged for master branches) I suggest to calm down with merging a bit.. :) |
d67770f
to
68d5272
Compare
Pulled out the env commit into #194. |
I know. I wasn't sure the best way to reverse them. Should I have created a revert PR instead? |
But it is needed here. |
You should either have reverted them (via PR or by directly pushing to master, although a PR is always good for review), or have removed them (i.e. then force-push the old state - but that is usually discouraged for public repos / master branches, though might have been ok here). |
This change here looks good as-is, but it is still not clear why it is not done for tags (unlike codecov-python does it for example), and how the backend handles the given branch name from a fork then. |
Well, if I don't get them we probably won't get them, and who knows when I'll next have time, so code diving time: Unless branch is one of As for tags? Probably because nobody wrote tests for them yet ;) |
The special handing for tags was done without more information in ca1d4a7.
How is "part of a PR" determined? Via the "pr" param?
For PRs only? |
Yes, for that check. Afterwards, the branch param is checked to see of it have
It's still being submitted as an empty string by the uploader
Yes, via the PR param, sorry.
Yes. If not part of a PR, it's used as is. |
No, currently the uploader uses "master" for PRs (if they are for "master"). It is not clear to me though still what that means in the end. Since "pr" param is sent only those cases should be interesting: how is the branch used then? So I really think it is more a backend issue (not handling/excluding PR commits properly). |
I didn't mean to be confusing. What I mean was that's a case to handle if IE: If you tell us the branch is something, that what we will mark the commit as being on. |
So it should be empty for PRs then? |
..but why does it do this if it is known to be a PR in the first place? |
Do what? Check the It looks like, if you set Otherwise, regardless of Sorry if we keep going in circles, It's very likely I either don't understand what you are asking, or am doing a poor job explaining it. |
The initial problem is that commits from PRs show up on the "master" branch list of commits in the Codecov UI, although they have not been merged.
So we could send an empty branch for PRs here, but that needs to be done for all providers and other implementation like codecov-python then. |
I'm thinking that sending an empty branch is counter to the desired behavior, we should ensure the uploader always sends the correct branch. Regarding things like |
But what is the correct branch for a pull request? |
I think I'm still confused where there is an issue on the backend. The initial issue, as I understood it, was the uploader passing the wrong branch name, which this PR should fix. Can you explain what you think the backend is doing wrong? |
With this PR the uploader would still pass "master" when the PR is from a branch named master, resulting in the same issue. |
A PR is a pull request, i.e. it is asked for to be merged, and not yet in the target branch. |
Then imo, the uploader should be changed to send the correct branch to the server. The server does no detection, it trusts the uploader to send it the correct information |
And I think that's more the responsibility of the backend: if it gets told it is for a PR, it should not map it to a (repo) branch. |
I think I see your point now. So, assuming that the commit is not mapped to a branch, what views do you envision the commit showing in? |
With the PR's commits, e.g. https://codecov.io/gh/neovim/neovim/pull/10749/commits. |
@drazisil is there anything else to do here? I think a big use-case is with forks that are merging |
@thomasrockhu I really don't remember this PR. Probably best to close and start fresh. |
I'll admit, I don't quite grok everything in this thread. However, the change makes sense to me. I'm going to fix the SHAs and merge. |
Ref: https://codecov.freshdesk.com/helpdesk/tickets/1990