codecov / codecov-action

GitHub Action that uploads coverage to Codecov :open_umbrella:
https://www.codecov.io
MIT License
1.49k stars 210 forks source link

Codecov on PR not using upstream commit_parent #1704

Open AndreKurait opened 8 hours ago

AndreKurait commented 8 hours ago

Using codecov version 5.0.7, on a PR, commit_parent is defaulting to the previous commit instead of the upstream.

Within codecov showing This commit f9d9180 compared to fed6cb1 which is the comparing against the previous commit on the PR instead of anything on the upstream branch.

When overriding with parameter commit_parent: ${{ github.event.pull_request.base.sha || github.event.before || github.base.sha }} I got

debug - 2024-11-22 18:33:46,377 -- Report creating result --- {"result": "RequestResult(error=RequestError(code='HTTP Error 400', params={}, description='{\"message\":\"Token required because branch is protected\"}\\n'), warnings=[], status_code=400, text='{\"message\":\"Token required because branch is protected\"}\\n')"}

Testing: https://github.com/opensearch-project/opensearch-migrations/pull/1155

Example Logs:

Run codecov/codecov-action@v5
Run CC_ACTION_VERSION=$(cat ${GITHUB_ACTION_PATH}/src/version | grep 'CODECOV_ACTION_VERSION=' | cut -d\" -f2)
==> Running Action version 5.0.7
Run git config --global --add safe.directory /home/runner/work/opensearch-migrations/opensearch-migrations
Run if [ "false" == 'true' ];
Run if [ -z "$CC_BRANCH" ] && [ -z "$CC_TOKEN" ] && [ -n "$GITHUB_EVENT_PULL_REQUEST_HEAD_REPO_FULL_NAME" ] && [ "${GITHUB_EVENT_PULL_REQUEST_HEAD_REPO_FULL_NAME}" != "$GITHUB_REPOSITORY" ];
==> Fork detected, tokenless uploading used
Run if [ -z "$CC_SHA" ];
Run ${GITHUB_ACTION_PATH}/dist/codecov.sh
     _____          _
    / ____|        | |
   | |     ___   __| | ___  ___ _____   __
   | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
   | |___| (_) | (_| |  __/ (_| (_) \ V /
    \_____\___/ \__,_|\___|\___\___/ \_/
                            Wrapper-0.0.27

==> Detected linux
 -> Downloading https://cli.codecov.io/latest/linux/codecov
==> Finishing downloading linux:latest
parse error: Invalid numeric literal at line 1, column 10
      Version: 

gpg: directory '/home/runner/.gnupg' created
gpg: keybox '/home/runner/.gnupg/pubring.kbx' created
gpg: /home/runner/.gnupg/trustdb.gpg: trustdb created
gpg: key 806BB28AED779869: public key "Codecov Uploader (Codecov Uploader Verification Key) <security@codecov.io>" imported
gpg: Total number processed: 1
gpg:               imported: 1
==> Verifying GPG signature integrity
 -> Downloading https://cli.codecov.io/latest/linux/codecov.SHA256SUM
 -> Downloading https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig

gpg: Signature made Fri Nov 15 18:59:14 2024 UTC
gpg:                using RSA key 27034E7FDB850E0BBC2C62FF806BB28AED779869
gpg: Good signature from "Codecov Uploader (Codecov Uploader Verification Key) <security@codecov.io>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 2703 4E7F DB85 0E0B BC2C  62FF 806B B28A ED77 9869
codecov: OK
==> CLI integrity verified

 -> Token of length 0 detected
==> Running create-commit
      ./codecov --verbose create-commit --fail-on-error --git-service github --sha f9d9180da5aaf1cf0cdac9d8f249c0ff30adfd90
info - 2024-11-25 16:51:45,644 -- ci service found: github-actions
debug - 2024-11-25 16:51:45,648 -- versioning system found: <class 'codecov_cli.helpers.versioning_systems.NoVersioningSystem'>
debug - 2024-11-25 16:51:45,650 -- versioning system found: <class 'codecov_cli.helpers.versioning_systems.NoVersioningSystem'>
warning - 2024-11-25 16:51:45,650 -- No config file could be found. Ignoring config.
debug - 2024-11-25 16:51:45,650 -- No codecov_yaml found
debug - 2024-11-25 16:51:45,651 -- Starting create commit process --- {"verbose": true, "auto_load_params_from": null, "codecov_yml_path": null, "enterprise_url": null, "version": "cli-0.9.4", "command": "create-commit", "fail_on_error": true, "git_service": "github", "commit_sha": "f9d9180da5aaf1cf0cdac9d8f249c0ff30adfd90", "parent_sha": null, "pull_request_number": "1155", "branch": "CodeCovNoTokenTest", "slug": "opensearch-project/opensearch-migrations"}
info - 2024-11-25 16:51:45,651 -- The PR is happening in a forked repo. Using tokenless upload.
info - 2024-11-25 16:51:46,075 -- Process Commit creating complete
debug - 2024-11-25 16:51:46,076 -- Commit creating result --- {"result": "RequestResult(error=None, warnings=[], status_code=202, text='{\"status\":\"queued\"}\\n')"}

==> Running create-report
      ./codecov --verbose create-report --fail-on-error --git-service github --sha f9d9180da5aaf1cf0cdac9d8f249c0ff30adfd90
info - 2024-11-25 16:51:46,805 -- ci service found: github-actions
debug - 2024-11-25 16:51:46,808 -- versioning system found: <class 'codecov_cli.helpers.versioning_systems.NoVersioningSystem'>
debug - 2024-11-25 16:51:46,810 -- versioning system found: <class 'codecov_cli.helpers.versioning_systems.NoVersioningSystem'>
warning - 2024-11-25 16:51:46,810 -- No config file could be found. Ignoring config.
debug - 2024-11-25 16:51:46,810 -- No codecov_yaml found
debug - 2024-11-25 16:51:46,811 -- Starting create report process --- {"verbose": true, "auto_load_params_from": null, "codecov_yml_path": null, "enterprise_url": null, "version": "cli-0.9.4", "command": "create-report", "fail_on_error": true, "git_service": "github", "commit_sha": "f9d9180da5aaf1cf0cdac9d8f249c0ff30adfd90", "code": "default", "pull_request_number": "1155", "slug": "opensearch-project/opensearch-migrations"}
info - 2024-11-25 16:51:47,[23](https://github.com/opensearch-project/opensearch-migrations/actions/runs/12014758839/job/33491574458?pr=1155#step:3:24)8 -- Process Report creating complete
debug - 2024-11-25 16:51:47,238 -- Report creating result --- {"result": "RequestResult(error=None, warnings=[], status_code=202, text='{\"status\":\"queued\"}\\n')"}
info - 2024-11-25 16:51:47,238 -- Finished creating report successfully --- {"response": "{\"status\":\"queued\"}\n"}

==> Running do-upload
      ./codecov --verbose do-upload --branch AndreKurait:CodeCovNoTokenTest --fail-on-error --file /**/coverage-reports/**/*.* --flag unittests --gcov-executable gcov --git-service github --sha f9d9180da5aaf1cf0cdac9d8f249c0ff30adfd90
info - 2024-11-25 16:51:47,961 -- ci service found: github-actions
debug - 2024-11-25 16:51:47,965 -- versioning system found: <class 'codecov_cli.helpers.versioning_systems.NoVersioningSystem'>
debug - 2024-11-25 16:51:47,967 -- versioning system found: <class 'codecov_cli.helpers.versioning_systems.NoVersioningSystem'>
warning - 2024-11-25 16:51:47,967 -- No config file could be found. Ignoring config.
debug - 2024-11-25 16:51:47,967 -- No codecov_yaml found
debug - 2024-11-25 16:51:47,969 -- Starting upload processing --- {"verbose": true, "auto_load_params_from": null, "codecov_yml_path": null, "enterprise_url": null, "version": "cli-0.9.4", "command": "do-upload", "branch": "AndreKurait:CodeCovNoTokenTest", "fail_on_error": true, "flags": ["unittests"], "gcov_executable": "gcov", "git_service": "github", "commit_sha": "f9d9180da5aaf1cf0cdac9d8f249c0ff30adfd90", "report_code": "default", "network_root_folder": "/home/runner/work/opensearch-migrations/opensearch-migrations", "files_search_root_folder": "/home/runner/work/opensearch-migrations/opensearch-migrations", "files_search_exclude_folders": [], "disable_search": false, "disable_file_fixes": false, "build_code": "12014758839", "build_url": "https://github.com/opensearch-project/opensearch-migrations/actions/runs/12014758839", "job_code": "CI", "name": "12014758839", "pull_request_number": "1155", "env_vars": {}, "plugin_names": ["xcode", "gcov", "pycoverage"], "dry_run": false, "use_legacy_uploader": false, "handle_no_reports_found": false, "report_type": "coverage", "network_filter": null, "network_prefix": null, "gcov_args": null, "gcov_ignore": null, "gcov_include": null, "swift_project": null, "slug": "opensearch-project/opensearch-migrations"}
debug - 2024-11-25 16:51:47,969 -- Selected preparation plugins --- {"selected_plugins": ["<class 'codecov_cli.plugins.xcode.XcodePlugin'>", "<class 'codecov_cli.plugins.gcov.GcovPlugin'>", "<class 'codecov_cli.plugins.pycoverage.Pycoverage'>"], "cli_config": {}}
debug - 2024-11-25 16:51:47,969 -- Running preparation plugin: <class 'codecov_cli.plugins.xcode.XcodePlugin'>
debug - 2024-11-25 16:51:47,969 -- Running xcode plugin...
warning - 2024-11-25 16:51:47,969 -- xcrun is not installed or can't be found.
debug - 2024-11-25 16:51:47,969 -- Running preparation plugin: <class 'codecov_cli.plugins.gcov.GcovPlugin'>
debug - 2024-11-25 16:51:47,969 -- Running gcov plugin...
warning - 2024-11-25 16:51:47,970 -- No gcov data found.
debug - 2024-11-25 16:51:47,970 -- Running preparation plugin: <class 'codecov_cli.plugins.pycoverage.Pycoverage'>
warning - 2024-11-25 16:51:47,970 -- coverage.py is not installed or can't be found.
debug - 2024-11-25 16:51:47,970 -- Collecting relevant files
warning - 2024-11-25 16:51:47,976 -- Some files were not found --- {"not_found_files": ["/**/coverage-reports/**/*.*"]}
info - 2024-11-25 16:51:47,977 -- Found 4 coverage files to report
info - 2024-11-25 16:51:47,977 -- > /home/runner/work/opensearch-migrations/opensearch-migrations/coverage-reports/coverage-reports-python-tests-lib-console_link/coverage.xml
info - 2024-11-25 16:51:47,977 -- > /home/runner/work/opensearch-migrations/opensearch-migrations/coverage-reports/coverage-reports-gradle-tests/build/reports/jacoco/mergedReport/jacocoMergedReport.xml
info - 2024-11-25 16:51:47,978 -- > /home/runner/work/opensearch-migrations/opensearch-migrations/coverage-reports/coverage-reports-python-tests-cluster_tools/coverage.xml
info - 2024-11-25 16:51:47,978 -- > /home/runner/work/opensearch-migrations/opensearch-migrations/coverage-reports/coverage-reports-python-tests-console_api/coverage.xml
debug - 2024-11-25 16:51:47,978 -- Selected uploader to use: <class 'codecov_cli.services.upload.upload_sender.UploadSender'>
debug - 2024-11-25 16:51:48,009 -- Sending upload request to Codecov
info - 2024-11-25 16:51:48,470 -- Your upload is now processing. When finished, results will be available at: https://app.codecov.io/github/opensearch-project/opensearch-migrations/commit/f9d9180da5aaf1cf0cdac9d8f249c0ff30adfd90
debug - 2024-11-25 16:51:48,470 -- Upload request to Codecov complete. --- {"response": {"raw_upload_location": "https://storage.googleapis.com/codecov/shelter/github/opensearch-project%3A%3A%3A%3Aopensearch-migrations/f9d9180da5aaf1cf0cdac9d8f249c0ff30adfd90/b813953b-ed72-410e-a797-3f19d4429c3e.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=GOOG1EJWQHUGIBILH4J7Q6ZUSCIFNEOLYSNDS7L3B4N5SIBQ2J4YLYE5CRFCD%2F20241125%2Fus%2Fs3%2Faws4_request&X-Amz-Date=20241125T165148Z&X-Amz-Expires=30&X-Amz-SignedHeaders=host&X-Amz-Signature=c9725bd56a[32](https://github.com/opensearch-project/opensearch-migrations/actions/runs/12014758839/job/33491574458?pr=1155#step:3:34)c7f1ddec19a9baab528e86933e512cd8e6db7a1852ac58b21f40", "url": "https://app.codecov.io/github/opensearch-project/opensearch-migrations/commit/f9d9180da5aaf1cf0cdac9d8f249c0ff30adfd90"}}
debug - 2024-11-25 16:51:48,471 -- Sending upload to storage
info - 2024-11-25 16:51:48,752 -- Process Upload complete
debug - 2024-11-25 16:51:48,753 -- Upload result --- {"result": "RequestResult(error=None, warnings=[], status_code=200, text='')"}
AndreKurait commented 8 hours ago

@thomasrockhu-codecov Can you take a look at this?