-
Notifications
You must be signed in to change notification settings - Fork 75
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
Misdetection of latest HEAD in PRs on Github Action CI #525
Comments
Some more info: I see you use
This shouldn't be done, and |
Thanks for the report and research , @Flamefire We'll see what we can do to resolve this. As a workaround, you should be able to pass the correct value to PRs welcome! :) |
I'm not sure how to fix this as I don't know the correct value for the Here he URL used for Drone: As you can see they are fundamentally different. In both cases the PR is detected correctly, so the above mentioned thing is just incidental as it "may" cause issues too. So basically it boils down to: What are the expected values for "branch" and "commit"? |
ah, I misunderstood. In this case, I believe you want to only upload coverage. for pushes, not pull_request. boostorg/boost-ci@20f52fe sats it's not part of any branch, which usually means it's either been squashed or otherwise deleted. This can cause issues, but it looks like it's showing correctly on Codecovm so it might be a caching issue with updating the PR. How long ago did it complete? https://app.codecov.io/gh/boostorg/boost-ci/compare/114/commits |
Erm, no? Of course I want to have coverage info for PRs as that is part of CI testing: That a change does have decent coverage which is a condition for the merge.
Just check the link above or the whole PR: boostorg/boost-ci#114 So again: What are the expected values for "branch" and "commit"? There has to be some specification somewhere. I'd guess that the commit-sha for PR builds should be that of the merge commit. Which means the Drone "plugin" is wrong and the GHA one is correct. Edit: uploader/src/ci_providers/provider_githubactions.ts Lines 36 to 38 in 7d4690e
|
@drazisil-codecov Can you comment on what the expected values for the "branch" and "commit" parameters are for PR builds? Or at least forward that question to someone who knows?
|
Ok some update: Checking the code for Github Actions: uploader/src/ci_providers/provider_githubactions.ts Lines 72 to 87 in 7d4690e
This means an effort is made to get the branch HEAD commit SHA, i.e. not the merge commit SHA.
But I don't and the SHA is wrong. I can't tell why without further logging information. |
Add logging information for the fix of merge commits or when it was not done/required See codecov#525 for context
Add logging information for the fix of merge commits or when it was not done/required See codecov#525 for context
I was on vacation, sorry for the delay in responding. The commit SHA and branch should be whatever is the current location of the commit you are uploading coverage for, with one exception: In some CI pipelines, a "test merge" commit is made in CI to see what the changed merged would look like. In this case, Codecov will fail if we try to process a report uploaded on that commit since that SHA is never pushed to the repo from CI and thus doesn't exist. That is why you may see some weirdness around setting the Does that help? |
Yes it helps. So:
Let's see what the logs show for GHA. For appveyor the fix is simply to use |
Add logging information for the fix of merge commits or when it was not done/required See #525 for context
It looks like the documentation has recently been updated with new environment variables:1
Footnotes |
What is new here? |
Add logging information for the fix of merge commits or when it was not done/required See #525 for context
@Flamefire you can get it with github.event.pull_request.head.sha when github.event_name == 'pull_request' |
While this is true, it only works in the GHA context, i.e. in the yaml file as there is no environment variable with that value (yet, IIRC I requested that from the GHA team) So it can't be used for us here without requiring modifications to the workflows and is impossible in scripting (e.g. we have CI scripts in a central repo for all sub-projects) |
What is the quick fix for users here? Detect if Edit: I can confirm that doing the above fixed the warning message for me. I have added an environment variable with the commit and then used that: - name: Codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
COMMIT_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || env.GITHUB_SHA }}
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x ./codecov
./codecov -t ${CODECOV_TOKEN} -C ${COMMIT_SHA} |
I'm having this same problem when trying to pass through my GitHub Action env variables to a Docker Container using Codecov's provided script:
I can see in the GitHub action logs that all of the env variables were passed into the container properly when I open a PR, but the Codecov uploader throws an error Came across this issue and tried the fix suggested by @JCMais. Solved the problem for me. Looks like this is still a live bug (or missing from the docs)? |
This issue has been fixed since 0.1.18 with #649 @JSv4 Your issue seems to be different. Run the uploader in verbose mode to check for issues and open a new issue if there seems to be a bug with the uploader. To me it looks like the relevant variables are not passed to the script, e.g. not passed into your container if you run the script inside it. Anyway: As the issue is different please open a new issue providing all information required to help you. |
The reason why we were running CI on the unmerged commit in the first place was a now fixed codecov issue. See codecov/uploader#525 Reverts: 6c242e9
The reason why we were running CI on the unmerged commit in the first place was a now fixed codecov issue. See codecov/uploader#525 Reverts: 6c242e9
Describe the bug
I have a warning in the codecov comment on Github after running CI on Github Actions:
The mentioned SHAsums are those of the merge-commit-to-be and the latest commit on the branch.
I'm not sure if that is a bug in the uploader or the reporting later on so pass this on to the correct team if wrong.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No warning. It makes sense to that coverage for the merge-commit is uploaded, not that from the branch.
Additional context
The uploader is used "vanilla", i.e.
However I see that on Github actions the commit mentioned in the upload URL (log output) is the merge-SHA while on Drone CI it is the branch-SHA. So I'd say either one is wrong?
The text was updated successfully, but these errors were encountered: