Skip to content

Commit 4437fdd

Browse files
authored
Fix codecov system-test coverage upload instability, absence of reporting for master branch (#2014)
* pass token to codecov-action * Update system-test coverage uploading
1 parent a4a3fcd commit 4437fdd

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# WHY DO WE NEED THIS TOKEN WHEN THE ACTION DOCUMENTATION CLAIMS NO TOKEN IS NEEDED FOR PUBLIC REPOSITORIES?
2+
See ISSUE #2013: codecov-action does not reliably upload system-test coverage to codecov
3+
According to community discussion, failed uploads often occur due to "Codecov’s inability to check the validity
4+
of a coverage upload when using tokenless uploads. The underlying issue is rate-limiting from GitHub."
5+
6+
There are 2 possible fixes:
7+
1. Pass the token, when uploading
8+
2. Implement a retry on upload failure (we do this for travis-ci)
9+
10+
# OKAY, BUT WHY AREN'T WE STORING THIS TOKEN IN A SECRET?
11+
According to GitHub: "With the exception of GITHUB_TOKEN, secrets are not passed to the runner when a workflow is triggered from a forked repository."
12+
We require contributors to fork this repository, so that rules out secrets.
13+
14+
# WHAT ARE THE SECURITY RAMIFICATIONS OF MAKING THIS TOKEN PUBLICLY VISIBLE?
15+
From the community discussion:
16+
"The scope of the Codecov token is only to confirm that the coverage uploaded comes from a specific repository,
17+
not to pull down source code or make any code changes."
18+
"A malicious actor would be able to upload incorrect or misleading coverage reports to a specific repository if
19+
they have access to your upload token, but would not be able to pull down source code or make any code changes."

.github/workflows/github_actions_aws_rhel_python64.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ jobs:
3737
- name: upload coverage
3838
uses: codecov/codecov-action@v3
3939
with:
40+
# See ../PUBLIC_CODECOV_TOKEN_README.md
41+
token: 4c58f03d-b74c-489a-889a-ab0a77b7809f
4042
flags: ${{ matrix.module_name }}systemtests
4143
name: ${{ matrix.module_name }}
4244
files: ./generated/${{ matrix.module_name }}/coverage.xml

.github/workflows/github_actions_aws_windows_python32.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ jobs:
4949
- name: upload coverage
5050
uses: codecov/codecov-action@v3
5151
with:
52+
# See ../PUBLIC_CODECOV_TOKEN_README.md
53+
token: 4c58f03d-b74c-489a-889a-ab0a77b7809f
5254
flags: ${{ matrix.module_name }}systemtests
5355
name: ${{ matrix.module_name }}
5456
files: ./generated/${{ matrix.module_name }}/coverage.xml

.github/workflows/github_actions_aws_windows_python64.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ on:
1313
- VERSION
1414
types: [ opened, synchronize, reopened ]
1515

16+
# For this action, also trigger on a merge to master, because
17+
# the coverage badge tracks coverage of master, not PRs.
18+
# Doing this for windows_python32 and rhel_python64 is unlikely to
19+
# add any coverage, so don't bother triggering those on pushes to master.
20+
push:
21+
branches:
22+
- master
23+
paths-ignore:
24+
- CHANGELOG.md
25+
- CONTRIBUTING.md
26+
- .gitattributes
27+
- LICENSE
28+
- VERSION
29+
1630
# Allows you to run this workflow manually from the Actions tab.
1731
workflow_dispatch:
1832

@@ -49,6 +63,8 @@ jobs:
4963
- name: upload coverage
5064
uses: codecov/codecov-action@v3
5165
with:
66+
# See ../PUBLIC_CODECOV_TOKEN_README.md
67+
token: 4c58f03d-b74c-489a-889a-ab0a77b7809f
5268
flags: ${{ matrix.module_name }}systemtests
5369
name: ${{ matrix.module_name }}
5470
files: ./generated/${{ matrix.module_name }}/coverage.xml

0 commit comments

Comments
 (0)