From 6adc79e75f7989e87546edeaabbe59443ce59ebb Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 2 Oct 2024 18:18:03 -0500 Subject: [PATCH 01/31] fix: try 0.0.2 --- src/commands/upload.yml | 26 +++----------------------- src/scripts | 2 +- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index 3294717..270f7d2 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -61,28 +61,8 @@ parameters: steps: - run: - name: Download Codecov Uploader - command: <> + name: Upload to Codecov + command: <> when: << parameters.when >> environment: - PARAM_VERSION: << parameters.version >> - - when: - condition: << parameters.validate >> - steps: - - run: - name: Validate Codecov Uploader - command: <> - environment: - CODECOV_PUBLIC_PGP_KEY: <> - - run: - name: Upload Coverage Results - command: <> - environment: - PARAM_CLI_ARGS: << parameters.cli_args >> - PARAM_COMMIT_ARGS: << parameters.commit_args >> - PARAM_FILE: << parameters.file >> - PARAM_FLAGS: << parameters.flags >> - PARAM_REPORT_ARGS: << parameters.report_args >> - PARAM_TOKEN: << parameters.token >> - PARAM_UPLOAD_ARGS: << parameters.upload_args >> - PARAM_UPLOAD_NAME: << parameters.upload_name >> + CODECOV_TOKEN: << parameters.token >> diff --git a/src/scripts b/src/scripts index c0d5281..28149f9 160000 --- a/src/scripts +++ b/src/scripts @@ -1 +1 @@ -Subproject commit c0d5281863d5b66eaa60c69539c174c71de68e46 +Subproject commit 28149f9b8a1143b5f5c3ba84b9ee80d8912840f6 From e5aa1a3589b60dea7dcc3d94000619542b4c4e36 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 2 Oct 2024 18:21:01 -0500 Subject: [PATCH 02/31] fix: add yaml --- --- src/@orb.yml | 1 + src/commands/upload.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/src/@orb.yml b/src/@orb.yml index 0b873a1..6fe0882 100644 --- a/src/@orb.yml +++ b/src/@orb.yml @@ -1,3 +1,4 @@ +--- version: 2.1 description: > diff --git a/src/commands/upload.yml b/src/commands/upload.yml index 270f7d2..d4c8e2e 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -1,3 +1,4 @@ +--- description: | Upload your coverage reports to Codecov without dealing with complex configurations. This orb helps you get coverage results quickly so that you From f8311f9876deaf2b2331474e86808a3f95315644 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 2 Oct 2024 18:26:14 -0500 Subject: [PATCH 03/31] fix: try 0.0.3 --- src/scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts b/src/scripts index 28149f9..45da126 160000 --- a/src/scripts +++ b/src/scripts @@ -1 +1 @@ -Subproject commit 28149f9b8a1143b5f5c3ba84b9ee80d8912840f6 +Subproject commit 45da126af2e955289db4a4aad7036f6f22f1e201 From 637ea8410b6f21cd9e4671d5a3ca13ad636fc2d7 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 2 Oct 2024 18:37:21 -0500 Subject: [PATCH 04/31] fix: try 0.0.5 --- src/commands/upload.yml | 3 ++- src/scripts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index d4c8e2e..0dbff8a 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -63,7 +63,8 @@ parameters: steps: - run: name: Upload to Codecov - command: <> + command: <> when: << parameters.when >> + working_directory: scripts/ environment: CODECOV_TOKEN: << parameters.token >> diff --git a/src/scripts b/src/scripts index 45da126..03c7cf6 160000 --- a/src/scripts +++ b/src/scripts @@ -1 +1 @@ -Subproject commit 45da126af2e955289db4a4aad7036f6f22f1e201 +Subproject commit 03c7cf6c9a6350e24f6c12d6472a8e4bddbb51ae From 2b17b834b54ac3e15d450be92e55206edf80248a Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 2 Oct 2024 18:41:06 -0500 Subject: [PATCH 05/31] fix: include scripts in the env --- src/commands/upload.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index 0dbff8a..58a9c4f 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -63,8 +63,17 @@ parameters: steps: - run: name: Upload to Codecov - command: <> + command: <> when: << parameters.when >> working_directory: scripts/ environment: CODECOV_TOKEN: << parameters.token >> + script_download: <> + script_set_cli_args: <> + script_set_create_commit_args: <> + script_set_create_report_args: <> + script_set_defaults: <> + script_set_do_upload_args: <> + script_upload: <> + script_validate: <> + script_version: <> From 436f412509b4f093c583bc3750ed5832572638ee Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 2 Oct 2024 18:44:25 -0500 Subject: [PATCH 06/31] fix: yamllint --- src/commands/upload.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index 58a9c4f..a8326ae 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -67,13 +67,13 @@ steps: when: << parameters.when >> working_directory: scripts/ environment: - CODECOV_TOKEN: << parameters.token >> script_download: <> script_set_cli_args: <> - script_set_create_commit_args: <> - script_set_create_report_args: <> + script_set_create_commit_args: <> # yamllint disable-line rule:line-length + script_set_create_report_args: <> # yamllint disable-line rule:line-length script_set_defaults: <> - script_set_do_upload_args: <> + script_set_do_upload_args: <> # yamllint disable-line rule:line-length script_upload: <> script_validate: <> script_version: <> + CODECOV_TOKEN: << parameters.token >> From 6e35daa6483f3c704a46621fb4b4cc605ca3784b Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 2 Oct 2024 19:14:19 -0500 Subject: [PATCH 07/31] fix: 0.0.6 --- src/commands/upload.yml | 12 +----------- src/scripts | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index a8326ae..3312a1c 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -63,17 +63,7 @@ parameters: steps: - run: name: Upload to Codecov - command: <> + command: <> when: << parameters.when >> - working_directory: scripts/ environment: - script_download: <> - script_set_cli_args: <> - script_set_create_commit_args: <> # yamllint disable-line rule:line-length - script_set_create_report_args: <> # yamllint disable-line rule:line-length - script_set_defaults: <> - script_set_do_upload_args: <> # yamllint disable-line rule:line-length - script_upload: <> - script_validate: <> - script_version: <> CODECOV_TOKEN: << parameters.token >> diff --git a/src/scripts b/src/scripts index 03c7cf6..495da45 160000 --- a/src/scripts +++ b/src/scripts @@ -1 +1 @@ -Subproject commit 03c7cf6c9a6350e24f6c12d6472a8e4bddbb51ae +Subproject commit 495da451ef19b68b3582054a6d0d5b853f39f381 From 45c63b171a88d3a52e5b78e1b5669b53a5dd8d2d Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 2 Oct 2024 19:23:14 -0500 Subject: [PATCH 08/31] fix: 0.0.7 --- src/scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts b/src/scripts index 495da45..4f8df08 160000 --- a/src/scripts +++ b/src/scripts @@ -1 +1 @@ -Subproject commit 495da451ef19b68b3582054a6d0d5b853f39f381 +Subproject commit 4f8df0891502ef9f7035a425793a7473766c7b28 From 7027f0e46d56ff045c16acfb120755871453dd0a Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 2 Oct 2024 19:27:26 -0500 Subject: [PATCH 09/31] fix: try to pass it in as a var --- src/commands/upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index 3312a1c..8929540 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -66,4 +66,4 @@ steps: command: <> when: << parameters.when >> environment: - CODECOV_TOKEN: << parameters.token >> + CODECOV_TOKEN: ${<< parameters.token >>} From 4c8f05ff9f6fc3173884bc5158f377b20a77dbd8 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 2 Oct 2024 19:38:41 -0500 Subject: [PATCH 10/31] fix: try 0.0.8 --- src/commands/upload.yml | 2 +- src/scripts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index 8929540..e0fd05a 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -66,4 +66,4 @@ steps: command: <> when: << parameters.when >> environment: - CODECOV_TOKEN: ${<< parameters.token >>} + CODECOV_TOKEN_VAR: << parameters.token >> diff --git a/src/scripts b/src/scripts index 4f8df08..99fc7a6 160000 --- a/src/scripts +++ b/src/scripts @@ -1 +1 @@ -Subproject commit 4f8df0891502ef9f7035a425793a7473766c7b28 +Subproject commit 99fc7a624616ec537aa7b60ac5798b27f61d490b From a54ba8981f6acc48f1829b8ea5107d2e46f4b693 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 2 Oct 2024 19:45:10 -0500 Subject: [PATCH 11/31] fix: 0.0.9 --- src/scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts b/src/scripts index 99fc7a6..7ef191d 160000 --- a/src/scripts +++ b/src/scripts @@ -1 +1 @@ -Subproject commit 99fc7a624616ec537aa7b60ac5798b27f61d490b +Subproject commit 7ef191d562cf05002896ed57d25cf10f35d12c3d From d8fb455006b5127344db4390fd5d8b69676008f4 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 2 Oct 2024 20:51:19 -0500 Subject: [PATCH 12/31] fix: 0.0.10 --- src/scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts b/src/scripts index 7ef191d..9e9b0fc 160000 --- a/src/scripts +++ b/src/scripts @@ -1 +1 @@ -Subproject commit 7ef191d562cf05002896ed57d25cf10f35d12c3d +Subproject commit 9e9b0fcfdc55713c15368204225a6ef484821a69 From f0d7531ff9d5b05fdbffbcccb6caf04d094c2568 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 2 Oct 2024 21:23:38 -0500 Subject: [PATCH 13/31] fix: 0.0.11 --- src/commands/upload.yml | 2 +- src/scripts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index e0fd05a..9647297 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -66,4 +66,4 @@ steps: command: <> when: << parameters.when >> environment: - CODECOV_TOKEN_VAR: << parameters.token >> + CC_TOKEN_VAR: << parameters.token >> diff --git a/src/scripts b/src/scripts index 9e9b0fc..7d6ec13 160000 --- a/src/scripts +++ b/src/scripts @@ -1 +1 @@ -Subproject commit 9e9b0fcfdc55713c15368204225a6ef484821a69 +Subproject commit 7d6ec135a0c0616afbc7320cf951087fad654d2e From 551c677a0b2fb7e9f5c36317d0d2e554de82731d Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 2 Oct 2024 22:19:19 -0500 Subject: [PATCH 14/31] fix: 0.0.13 --- src/scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts b/src/scripts index 7d6ec13..ad30c54 160000 --- a/src/scripts +++ b/src/scripts @@ -1 +1 @@ -Subproject commit 7d6ec135a0c0616afbc7320cf951087fad654d2e +Subproject commit ad30c549387a470db2b60a0b532f9934367d71f7 From 03fe76774e688ae34d6d7f848d3692f6d8410304 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 3 Oct 2024 20:12:04 -0500 Subject: [PATCH 15/31] fix: update all the args --- .circleci/test-deploy.yml | 18 ++-- src/commands/upload.yml | 173 ++++++++++++++++++++++++++++++++------ src/scripts | 2 +- 3 files changed, 154 insertions(+), 39 deletions(-) diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index 3e7168b..63592f5 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -56,10 +56,10 @@ jobs: - codecov/upload: flags: backend - codecov/upload: - cli_args: -v + fail_on_error: true file: coverage/coverage-final.json flags: frontend - upload_args: -Z + verbose: true - codecov/upload: file: coverage/coverage-final.json flags: alpine @@ -79,12 +79,10 @@ jobs: - codecov/upload: flags: backend - codecov/upload: - cli_args: -v - commit_args: -Z + fail_on_error: true file: coverage/coverage-final.json flags: frontend - report_args: -Z - upload_args: -Z + verbose: true - codecov/upload: file: coverage/coverage-final.json flags: linux @@ -104,10 +102,10 @@ jobs: - codecov/upload: flags: backend - codecov/upload: - cli_args: -v + fail_on_error: true file: coverage/coverage-final.json flags: frontend - upload_args: -Z + verbose: true - codecov/upload: file: coverage/coverage-final.json flags: macos @@ -128,10 +126,10 @@ jobs: - codecov/upload: flags: backend - codecov/upload: - cli_args: -v + fail_on_error: true file: coverage/coverage-final.json flags: frontend - upload_args: -Z + verbose: true - codecov/upload: file: coverage/coverage-final.json flags: windows diff --git a/src/commands/upload.yml b/src/commands/upload.yml index 9647297..e21448e 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -8,50 +8,133 @@ description: | `gnupg` in order to validate. parameters: - cli_args: - description: Any extra arguments provided to the CLI the CLI - (e.g. `-v`). + binary: + description: The file location of a pre-downloaded version of the CLI. If specified, integrity checking will be bypassed. type: string default: "" - commit_args: - description: Any arguments provided to the create-commit step of the CLI - (e.g. `--git-service github-enterprise`). + branch: + description: Branch to which this commit belongs to type: string default: "" - file: - description: Path to the code coverage data file to upload. + build: + description: Specify the build number manually + type: string + default: "" + build_url: + description: The URL of the build where this is running + type: string + default: "" + code: + description: The code of the report. If unsure, leave default. + type: string + default: "" + dir: + description: Folder where to search for coverage files. Default to current working directory + type: string + default: "" + disable_file_fixes: + description: Disable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets). Set to "true", defaults to "false". + type: string + default: "false" + disable_search: + description: Disable search for coverage files. This is helpful when specifying what files you want to upload with the files option. Set to "true", defaults to "false". + type: string + default: "false" + dry_run: + description: Don't upload files to Codecov. Set to "true", defaults to "false". + type: string + default: "false" + enterprise_url: + description: (Enterprise only). Set to the Codecov instance URL. + type: string + default: "" + env: + description: Specify environment variables to be included with this build + type: string + default: "" + excludes: + description: Comma-separated list of folders to exclude from search. + type: string + default: "" + fail_on_error: + description: Exit with non-zero code in case of error. Set to "true", defaults to "false". + type: string + default: "false" + files: + description: Comma-separated list of explicit files to upload. These will be added to the coverage files found for upload. If you wish to only upload the specified files, please consider using disable-search to disable uploading other files. type: string default: "" flags: - description: Flag the upload to group coverage metrics (e.g. unittests - | integration | ui,chrome). Flags can be input as strings or - environment variables. + description: Comma-separated list of flags to upload to group coverage metrics. type: string default: "" - report_args: - description: Any arguments provided to the create-report step of the CLI - (e.g. `--git-service github-enterprise`). + git_service: + description: One of [github|gitlab|bitbucket|github_enterprise|gitlab_enterprise|bitbucket_server] type: string default: "" - token: - description: Set the private repository token as the value of the - variable CODECOV_TOKEN using CircleCI Environment Variables. - type: env_var_name - default: CODECOV_TOKEN - upload_name: - description: Custom defined name of the upload. Visible in Codecov UI + handle_no_reports_found: + description: Raise no exceptions when no coverage reports are found. Set to "true", defaults to "false". + type: string + default: "false" + job_code: + description: type: string default: "" - upload_args: - description: Any extra flags as provided to the `do-upload` step of the CLI + legacy: + description: Use the legacy upload endpoint. Set to "true", defaults to "false" + type: string + default: "false" + name: + description: Custom defined name of the upload. Visible in the Codecov UI + type: string + default: "" + network_filter: + description: Specify a filter on the files listed in the network section of the Codecov report. This will only add files whose path begin with the specified filter. Useful for upload-specific path fixing. + type: string + default: "" + network_prefix: Specify a prefix on files listed in the network section of the Codecov report. Useful to help resolve path fixing. + description: + type: string + default: "" + network_root_folder: + description: Root folder from which to consider paths on the network section. Defaults to current working directory. + type: string + default: "" + parent_sha: + description: SHA (with 40 chars) of what should be the parent of this commit. type: string default: "" - validate: - description: Validate the uploader before uploading the codecov result. - type: boolean - default: true + plugins: + description: Comma-separated list of plugins to run. Specify `noop` to turn of all plugins + type: string + default: "" + pr: + description: Specify the pull request number manually. Used to override pre-existing CI environment variables. + type: string + default: "" + report_type: + description: The type of file to upload, coverage by default. Possible values are: testing, coverage. + type: string + default: "coverage" + sha: + description: Commit SHA (with 40 chars) + type: string + default: "" + skip_validation: + description: Skip integrity checking of the CLI. This is NOT recommended. Set to "true", default is "false" + type: string + default: "false" + slug: + description: (Enterprise only) owner/repo slug used instead of the private repo token + type: string + default: "" + token_var: + description: Set the private repository token as the value of the + variable CODECOV_TOKEN using CircleCI Environment Variables. + type: env_var_name + default: CODECOV_TOKEN version: - description: Which version of the Codecov Uploader to use (defaults to + description: Which version of the Codecov CLI to use (defaults to 'latest') type: string default: "latest" @@ -66,4 +149,38 @@ steps: command: <> when: << parameters.when >> environment: + CC_AUTO_LOAD_PARAMS_FROM: << parameters.auto_load_params_from >> + CC_BINARY: << parameters.binary >> + CC_BRANCH: << parameters.branch >> + CC_BUILD: << parameters.build >> + CC_BUILD_URL: << parameters.build_url >> + CC_CODE: << parameters.code >> + CC_DIR: << parameters.dir >> + CC_DISABLE_FILE_FIXES: << parameters.disable_file_fixes >> + CC_DISABLE_SEARCH: << parameters.disable_search >> + CC_DRY_RUN: << parameters.dry_run >> + CC_ENTERPRISE_URL: << parameters.enterprise_url >> + CC_ENV: << parameters.env >> + CC_EXCLUDES: << parameters.excludes >> + CC_FAIL_ON_ERROR: << parameters.fail_on_error >> + CC_FILES: << parameters.files >> + CC_FLAGS: << parameters.flags >> + CC_GIT_SERVICE: << parameters.git_service >> + CC_HANDLE_NO_REPORTS_FOUND: << parameters.handle_no_reports_found >> + CC_JOB_CODE: << parameters.job_code >> + CC_LEGACY: << parameters.legacy >> + CC_NAME: << parameters.name >> + CC_NETWORK_FILTER: << parameters.network_filter >> + CC_NETWORK_PREFIX: << parameters.network_prefix >> + CC_NETWORK_ROOT_FOLDER: << parameters.network_root_folder >> + CC_PARENT_SHA: << parameters.parent_sha >> + CC_PLUGINS: << parameters.plugins >> + CC_PR: << parameters.pr >> + CC_PUBLIC_PGP_KEY: << parameters.public_pgp_key >> + CC_PULL_REQUEST: << parameters.pull_request >> + CC_REPORT_TYPE: << parameters.report_type >> + CC_SHA: << parameters.sha >> + CC_SKIP_VALIDATION: << parameters.skip_validation >> + CC_SLUG: << parameters.slug >> CC_TOKEN_VAR: << parameters.token >> + CC_VERSION: << parameters.version >> diff --git a/src/scripts b/src/scripts index ad30c54..e146e84 160000 --- a/src/scripts +++ b/src/scripts @@ -1 +1 @@ -Subproject commit ad30c549387a470db2b60a0b532f9934367d71f7 +Subproject commit e146e847da0001b5c99c145119675229b29c0bea From 33afeb4e3b101911160cd0fc47c2b73f4c4b874c Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 3 Oct 2024 20:14:33 -0500 Subject: [PATCH 16/31] fix: line-length --- src/commands/upload.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index e21448e..fd29257 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -1,4 +1,5 @@ --- +# yamllint disable rule:line-length description: | Upload your coverage reports to Codecov without dealing with complex configurations. This orb helps you get coverage results quickly so that you @@ -92,8 +93,8 @@ parameters: description: Specify a filter on the files listed in the network section of the Codecov report. This will only add files whose path begin with the specified filter. Useful for upload-specific path fixing. type: string default: "" - network_prefix: Specify a prefix on files listed in the network section of the Codecov report. Useful to help resolve path fixing. - description: + network_prefix: + description: Specify a prefix on files listed in the network section of the Codecov report. Useful to help resolve path fixing. type: string default: "" network_root_folder: From 7f3082c53a13ab803664c8f2fa9f3c71f5551206 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 3 Oct 2024 20:32:25 -0500 Subject: [PATCH 17/31] fix: linting --- src/commands/upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index fd29257..5e85354 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -114,7 +114,7 @@ parameters: type: string default: "" report_type: - description: The type of file to upload, coverage by default. Possible values are: testing, coverage. + description: The type of file to upload, coverage by default. Possible values are "testing", "coverage". type: string default: "coverage" sha: From ec332cd76b83c0e0f82d8446b89d57203a684cd5 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 3 Oct 2024 20:36:03 -0500 Subject: [PATCH 18/31] fix: upload_name --- src/commands/upload.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index 5e85354..954bea5 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -85,10 +85,6 @@ parameters: description: Use the legacy upload endpoint. Set to "true", defaults to "false" type: string default: "false" - name: - description: Custom defined name of the upload. Visible in the Codecov UI - type: string - default: "" network_filter: description: Specify a filter on the files listed in the network section of the Codecov report. This will only add files whose path begin with the specified filter. Useful for upload-specific path fixing. type: string @@ -134,6 +130,10 @@ parameters: variable CODECOV_TOKEN using CircleCI Environment Variables. type: env_var_name default: CODECOV_TOKEN + upload_name: + description: Custom defined name of the upload. Visible in the Codecov UI + type: string + default: "" version: description: Which version of the Codecov CLI to use (defaults to 'latest') @@ -170,7 +170,7 @@ steps: CC_HANDLE_NO_REPORTS_FOUND: << parameters.handle_no_reports_found >> CC_JOB_CODE: << parameters.job_code >> CC_LEGACY: << parameters.legacy >> - CC_NAME: << parameters.name >> + CC_NAME: << parameters.upload_name >> CC_NETWORK_FILTER: << parameters.network_filter >> CC_NETWORK_PREFIX: << parameters.network_prefix >> CC_NETWORK_ROOT_FOLDER: << parameters.network_root_folder >> From 4814d765e2769ae6dfeed7f996d45a8cdc642009 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 3 Oct 2024 20:48:51 -0500 Subject: [PATCH 19/31] fix: packing --- src/commands/upload.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index 954bea5..bc962fa 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -125,7 +125,7 @@ parameters: description: (Enterprise only) owner/repo slug used instead of the private repo token type: string default: "" - token_var: + token: description: Set the private repository token as the value of the variable CODECOV_TOKEN using CircleCI Environment Variables. type: env_var_name @@ -150,7 +150,6 @@ steps: command: <> when: << parameters.when >> environment: - CC_AUTO_LOAD_PARAMS_FROM: << parameters.auto_load_params_from >> CC_BINARY: << parameters.binary >> CC_BRANCH: << parameters.branch >> CC_BUILD: << parameters.build >> @@ -177,8 +176,6 @@ steps: CC_PARENT_SHA: << parameters.parent_sha >> CC_PLUGINS: << parameters.plugins >> CC_PR: << parameters.pr >> - CC_PUBLIC_PGP_KEY: << parameters.public_pgp_key >> - CC_PULL_REQUEST: << parameters.pull_request >> CC_REPORT_TYPE: << parameters.report_type >> CC_SHA: << parameters.sha >> CC_SKIP_VALIDATION: << parameters.skip_validation >> From 1b2aa01ea155e8b06941ed4e0c2da68189085fe0 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 3 Oct 2024 20:51:20 -0500 Subject: [PATCH 20/31] fix: use boolean --- src/commands/upload.yml | 42 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index bc962fa..094a5a0 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -34,17 +34,17 @@ parameters: type: string default: "" disable_file_fixes: - description: Disable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets). Set to "true", defaults to "false". - type: string - default: "false" + description: Disable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets). + type: boolean + default: false disable_search: - description: Disable search for coverage files. This is helpful when specifying what files you want to upload with the files option. Set to "true", defaults to "false". - type: string - default: "false" + description: Disable search for coverage files. This is helpful when specifying what files you want to upload with the files option. + type: boolean + default: false dry_run: - description: Don't upload files to Codecov. Set to "true", defaults to "false". - type: string - default: "false" + description: Don't upload files to Codecov. + type: boolean + default: false enterprise_url: description: (Enterprise only). Set to the Codecov instance URL. type: string @@ -58,9 +58,9 @@ parameters: type: string default: "" fail_on_error: - description: Exit with non-zero code in case of error. Set to "true", defaults to "false". - type: string - default: "false" + description: Exit with non-zero code in case of error. + type: boolean + default: false files: description: Comma-separated list of explicit files to upload. These will be added to the coverage files found for upload. If you wish to only upload the specified files, please consider using disable-search to disable uploading other files. type: string @@ -74,17 +74,17 @@ parameters: type: string default: "" handle_no_reports_found: - description: Raise no exceptions when no coverage reports are found. Set to "true", defaults to "false". - type: string - default: "false" + description: Raise no exceptions when no coverage reports are found. + type: boolean + default: false job_code: description: type: string default: "" legacy: - description: Use the legacy upload endpoint. Set to "true", defaults to "false" - type: string - default: "false" + description: Use the legacy upload endpoint. + type: boolean + default: false network_filter: description: Specify a filter on the files listed in the network section of the Codecov report. This will only add files whose path begin with the specified filter. Useful for upload-specific path fixing. type: string @@ -118,9 +118,9 @@ parameters: type: string default: "" skip_validation: - description: Skip integrity checking of the CLI. This is NOT recommended. Set to "true", default is "false" - type: string - default: "false" + description: Skip integrity checking of the CLI. This is NOT recommended. + type: boolean + default: false slug: description: (Enterprise only) owner/repo slug used instead of the private repo token type: string From 4b40871020c52e9983a661f1a97d61bab7424948 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 3 Oct 2024 21:03:31 -0500 Subject: [PATCH 21/31] fix: 0.0.15 and small fixes --- .circleci/test-deploy.yml | 23 ++++++++++++----------- src/scripts | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index 63592f5..ba85f8c 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -1,3 +1,4 @@ +--- version: 2.1 orbs: codecov: codecov/codecov@dev:alpha @@ -57,11 +58,11 @@ jobs: flags: backend - codecov/upload: fail_on_error: true - file: coverage/coverage-final.json + files: coverage/coverage-final.json flags: frontend verbose: true - codecov/upload: - file: coverage/coverage-final.json + files: coverage/coverage-final.json flags: alpine version: v0.2.2 - codecov/upload: @@ -80,11 +81,11 @@ jobs: flags: backend - codecov/upload: fail_on_error: true - file: coverage/coverage-final.json + files: coverage/coverage-final.json flags: frontend verbose: true - codecov/upload: - file: coverage/coverage-final.json + files: coverage/coverage-final.json flags: linux version: v0.7.4 - codecov/upload: @@ -103,11 +104,11 @@ jobs: flags: backend - codecov/upload: fail_on_error: true - file: coverage/coverage-final.json + files: coverage/coverage-final.json flags: frontend verbose: true - codecov/upload: - file: coverage/coverage-final.json + files: coverage/coverage-final.json flags: macos version: v0.7.4 - codecov/upload: @@ -127,11 +128,11 @@ jobs: flags: backend - codecov/upload: fail_on_error: true - file: coverage/coverage-final.json + files: coverage/coverage-final.json flags: frontend verbose: true - codecov/upload: - file: coverage/coverage-final.json + files: coverage/coverage-final.json flags: windows version: v0.2.2 - codecov/upload: @@ -147,9 +148,9 @@ workflows: filters: *filters - test-frontend: filters: *filters -# - test-alpine: -# filters: *filters -# requires: [test-backend, test-frontend] + # - test-alpine: + # filters: *filters + # requires: [test-backend, test-frontend] - test-linux: filters: branches: diff --git a/src/scripts b/src/scripts index e146e84..0d536eb 160000 --- a/src/scripts +++ b/src/scripts @@ -1 +1 @@ -Subproject commit e146e847da0001b5c99c145119675229b29c0bea +Subproject commit 0d536eb74380d80e1da92f19b28717c9c8cc8ed0 From 5810c60c4273e8e79c42c757eb9d323c4db3188c Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 3 Oct 2024 21:06:48 -0500 Subject: [PATCH 22/31] fix: add verbose --- src/commands/upload.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index 094a5a0..507a6cc 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -134,6 +134,10 @@ parameters: description: Custom defined name of the upload. Visible in the Codecov UI type: string default: "" + verbose: + description: Use verbose logging in the CLI + type: boolean + default: false version: description: Which version of the Codecov CLI to use (defaults to 'latest') @@ -181,4 +185,5 @@ steps: CC_SKIP_VALIDATION: << parameters.skip_validation >> CC_SLUG: << parameters.slug >> CC_TOKEN_VAR: << parameters.token >> + CC_VERBOSE: << parameters.verbose >> CC_VERSION: << parameters.version >> From 3ef81f2a7720a94fb277a3026583db251b9c0d80 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 3 Oct 2024 21:54:11 -0500 Subject: [PATCH 23/31] fix: 0.0.16 --- src/scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts b/src/scripts index 0d536eb..7f549d5 160000 --- a/src/scripts +++ b/src/scripts @@ -1 +1 @@ -Subproject commit 0d536eb74380d80e1da92f19b28717c9c8cc8ed0 +Subproject commit 7f549d573320fa897349434ebd2c3ce3ebe092cc From aad3a1d82bedbab3f220a212aca2806e0b86eff9 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 3 Oct 2024 21:58:42 -0500 Subject: [PATCH 24/31] fix: is something wrong with verbose? --- src/codecov.sh | 223 ++++++++++++++++++++++++++++++++++++++++ src/commands/upload.yml | 5 +- 2 files changed, 225 insertions(+), 3 deletions(-) create mode 100755 src/codecov.sh diff --git a/src/codecov.sh b/src/codecov.sh new file mode 100755 index 0000000..10474bc --- /dev/null +++ b/src/codecov.sh @@ -0,0 +1,223 @@ +#!/usr/bin/env bash +CC_WRAPPER_VERSION="0.0.16" +say() { + echo -e "$1" +} +exit_if_error() { + say "$r==> $1$x" + if [ $CC_FAIL_ON_ERROR = true ]; + then + say "$r Exiting...$x" + exit 1; + fi +} +lower() { + echo $(echo $1 | sed 's/CC//' | sed 's/_/-/g' | tr '[:upper:]' '[:lower:]') +} +write_existing_args() { + if [ -n "$(eval echo \$$1)" ]; + then + echo " -$(lower "$1") $(eval echo \$$1)" + fi +} +write_truthy_args() { + if [ "$(eval echo \$$1)" = "true" ]; + then + echo " -$(lower $1)" + fi +} +b="\033[0;36m" # variables/constants +g="\033[0;32m" # info/debug +r="\033[0;31m" # errors +x="\033[0m" +say " _____ _ + / ____| | | + | | ___ __| | ___ ___ _____ __ + | | / _ \\ / _\` |/ _ \\/ __/ _ \\ \\ / / + | |___| (_) | (_| | __/ (_| (_) \\ V / + \\_____\\___/ \\__,_|\\___|\\___\\___/ \\_/ + $r Wrapper-$CC_WRAPPER_VERSION$x + " +CC_VERSION="${CC_VERSION:-latest}" +CC_FAIL_ON_ERROR="${CC_FAIL_ON_ERROR:-false}" +if [ -n "$CC_BINARY" ]; +then + if [ -f "$CC_BINARY" ]; + then + cc_filename=$CC_BINARY + else + exit_if_error "Could not find binary file $CC_BINARY" + fi +else + family=$(uname -s | tr '[:upper:]' '[:lower:]') + cc_os="windows" + [[ $family == "darwin" ]] && cc_os="macos" + [[ $family == "linux" ]] && cc_os="linux" + [[ $cc_os == "linux" ]] && \ + osID=$(grep -e "^ID=" /etc/os-release | cut -c4-) + [[ $osID == "alpine" ]] && cc_os="alpine" + [[ $(arch) == "aarch64" && $family == "linux" ]] && cc_os+="-arm64" + say "$g==>$x Detected $b${cc_os}$x" + export cc_os=${cc_os} + export cc_version=${CC_VERSION} + cc_filename="codecov" + [[ $cc_os == "windows" ]] && cc_filename+=".exe" + export cc_filename=${cc_filename} + [[ $cc_os == "macos" ]] && \ + ! command -v gpg 2>&1 >/dev/null && \ + HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg + cc_url="https://cli.codecov.io" + cc_url="$cc_url/${CC_VERSION}" + cc_url="$cc_url/${cc_os}/${cc_filename}" + say "$g ->$x Downloading $b${cc_url}$x" + curl -Os $cc_url + say "$g==>$x Finishing downloading $b${cc_os}:${CC_VERSION}$x" + say " " +fi +if [ "$CC_SKIP_VALIDATION" = "true" ] || [ -n "$CC_BINARY" ]; +then + say "$r==>$x Bypassing validation as requested by user" +else +CC_PUBLIC_PGP_KEY=$(curl https://keybase.io/codecovsecurity/pgp_keys.asc) + echo "${CC_PUBLIC_PGP_KEY}" | \ + gpg --no-default-keyring --import + # One-time step + say "$g==>$x Verifying GPG signature integrity" + sha_url="https://cli.codecov.io" + sha_url="${sha_url}/${cc_version}/${cc_os}" + sha_url="${sha_url}/${cc_filename}.SHA256SUM" + say "$g ->$x Downloading $b${sha_url}$x" + say "$g ->$x Downloading $b${sha_url}.sig$x" + say " " + curl -Os "$sha_url" + curl -Os "${sha_url}.sig" + if ! gpg --verify "${cc_filename}.SHA256SUM.sig" "${cc_filename}.SHA256SUM"; + then + exit_if_error "Could not verify signature. Please contact Codecov if problem continues" + fi + if ! (shasum -a 256 -c "${cc_filename}.SHA256SUM" || \ + sha256sum -c "${cc_filename}.SHA256SUM"); + then + exit_if_error "Could not verify SHASUM. Please contact Codecov if problem continues" + fi + say "$g==>$x CLI integrity verified" + say +fi +cc_cli_args=() +cc_cli_args+=( $(write_existing_args CC_AUTO_LOAD_PARAMS_FROM) ) +cc_cli_args+=( $(write_existing_args CC_ENTERPRISE_URL) ) +cc_cli_args+=( $(write_existing_args CC_YML_PATH) ) +say "$rCC_VERBOSE = $CC_VERBOSE$x" +cc_cli_args+=( $(write_truthy_args CC_VERBOSE) ) +cc_cc_args=() +cc_cc_args+=( $(write_truthy_args CC_FAIL_ON_ERROR) ) +cc_cc_args+=( $(write_existing_args CC_GIT_SERVICE) ) +cc_cc_args+=( $(write_existing_args CC_PARENT_SHA) ) +cc_cc_args+=( $(write_existing_args CC_PR) ) +cc_cc_args+=( $(write_existing_args CC_SHA) ) +cc_cc_args+=( $(write_existing_args CC_SLUG) ) +cc_create_report_args=() +cc_cr_args+=( $(write_existing_args CC_CODE) ) +cc_cr_args+=( $(write_truthy_args CC_FAIL_ON_ERROR) ) +cc_cr_args+=( $(write_existing_args CC_GIT_SERVICE) ) +cc_cr_args+=( $(write_existing_args CC_PR) ) +cc_cr_args+=( $(write_existing_args CC_SHA) ) +cc_cr_args+=( $(write_existing_args CC_SLUG) ) +cc_du_args=() +OLDIFS=$IFS;IFS=, +cc_du_args+=( $(write_existing_args CC_BRANCH) ) +cc_du_args+=( $(write_existing_args CC_BUILD) ) +cc_du_args+=( $(write_existing_args CC_BUILD_URL) ) +cc_du_args+=( $(write_existing_args CC_CODE) ) +cc_du_args+=( $(write_existing_args CC_DIR) ) +cc_du_args+=( $(write_truthy_args CC_DISABLE_FILE_FIXES) ) +cc_du_args+=( $(write_truthy_args CC_DISABLE_SEARCH) ) +cc_du_args+=( $(write_truthy_args CC_DRY_RUN) ) +cc_du_args+=( $(write_existing_args CC_ENV) ) +if [ -n "$CC_EXCLUDES" ]; +then + for directory in $CC_EXCLUDES; do + cc_du_args+=( " --exclude " "$directory" ) + done +fi +cc_du_args+=( $(write_truthy_args CC_FAIL_ON_ERROR) ) +if [ -n "$CC_FILES" ]; +then + for file in $CC_FILES; do + cc_du_args+=( " --file " "$file" ) + done +fi +if [ -n "$CC_FLAGS" ]; +then + for flag in $CC_FLAGS; do + cc_du_args+=( " --flag " "$flag" ) + done +fi +cc_du_args+=( $(write_existing_args CC_GIT_SERVICE) ) +cc_du_args+=( $(write_truthy_args CC_HANDLE_NO_REPORTS_FOUND) ) +cc_du_args+=( $(write_existing_args CC_JOB_CODE) ) +cc_du_args+=( $(write_truthy_args CC_LEGACY) ) +cc_du_args+=( $(write_existing_args CC_NAME) ) +cc_du_args+=( $(write_existing_args CC_NETWORK_FILTER) ) +cc_du_args+=( $(write_existing_args CC_NETWORK_PREFIX) ) +cc_du_args+=( $(write_existing_args CC_NETWORK_ROOT_FOLDER) ) +if [ -n "$CC_PLUGINS" ]; +then + for plugin in $CC_PLUGINS; do + cc_du_args+=( " --plugin " "$plugin" ) + done +fi +cc_du_args+=( $(write_existing_args CC_PR) ) +cc_du_args+=( $(write_existing_args CC_REPORT_TYPE) ) +cc_du_args+=( $(write_existing_args CC_SHA) ) +cc_du_args+=( $(write_existing_args CC_SLUG) ) +IFS=$OLDIFS +unset NODE_OPTIONS +# See https://github.com/codecov/uploader/issues/475 +chmod +x $cc_filename +if [ -n "$CC_TOKEN_VAR" ]; +then + token="$(eval echo \$$CC_TOKEN_VAR)" +else + token="$(eval echo $CC_TOKEN)" +fi +say "$g ->$x Token of length ${#token} detected" +token_str="" +token_arg=() +if [ -n "$token" ]; +then + token_str+=" -t " + token_arg+=( " -t " "$token") +fi +say "$g==>$x Running create-commit" +say " $b./$cc_filename $(echo "${cc_cli_args[@]}") create-commit$token_str $(echo "${cc_cc_args[@]}")$x" +if ! ./$cc_filename \ + ${cc_cli_args[*]} \ + create-commit \ + ${token_arg[*]} \ + ${cc_cc_args[*]}; +then + exit_if_error "Failed to create-commit" +fi +say " " +say "$g==>$x Running create-report" +say " $b./$cc_filename $(echo "${cc_cli_args[@]}") create-report$token_str $(echo "${cc_cr_args[@]}")$x" +if ! ./$cc_filename \ + ${cc_cli_args[*]} \ + create-report \ + ${token_arg[*]} \ + ${cc_cr_args[*]}; +then + exit_if_error "Failed to create-report" +fi +say " " +say "$g==>$x Running do-upload" +say " $b./$cc_filename $(echo "${cc_cli_args[@]}") do-upload$token_str $(echo "${cc_du_args[@]}")$x" +if ! ./$cc_filename \ + ${cc_cli_args[*]} \ + do-upload \ + ${token_arg[*]} \ + ${cc_du_args[*]}; +then + exit_if_error "Failed to upload" +fi diff --git a/src/commands/upload.yml b/src/commands/upload.yml index 507a6cc..0c5fb6a 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -139,8 +139,7 @@ parameters: type: boolean default: false version: - description: Which version of the Codecov CLI to use (defaults to - 'latest') + description: Which version of the Codecov CLI to use (defaults to 'latest') type: string default: "latest" when: @@ -151,7 +150,7 @@ parameters: steps: - run: name: Upload to Codecov - command: <> + command: <> when: << parameters.when >> environment: CC_BINARY: << parameters.binary >> From 5b3f9418835e07f3dd742cbde4133997a2c64aed Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 3 Oct 2024 22:00:35 -0500 Subject: [PATCH 25/31] fix: truthy is 1? --- src/codecov.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/codecov.sh b/src/codecov.sh index 10474bc..a94cea1 100755 --- a/src/codecov.sh +++ b/src/codecov.sh @@ -21,7 +21,7 @@ write_existing_args() { fi } write_truthy_args() { - if [ "$(eval echo \$$1)" = "true" ]; + if [ "$(eval echo \$$1)" = "true" ] || [ "$(eval echo \$$1)" = "1" ]; then echo " -$(lower $1)" fi @@ -107,7 +107,7 @@ cc_cli_args=() cc_cli_args+=( $(write_existing_args CC_AUTO_LOAD_PARAMS_FROM) ) cc_cli_args+=( $(write_existing_args CC_ENTERPRISE_URL) ) cc_cli_args+=( $(write_existing_args CC_YML_PATH) ) -say "$rCC_VERBOSE = $CC_VERBOSE$x" +say "$r CC_VERBOSE = $CC_VERBOSE$x" cc_cli_args+=( $(write_truthy_args CC_VERBOSE) ) cc_cc_args=() cc_cc_args+=( $(write_truthy_args CC_FAIL_ON_ERROR) ) From f5f6b848719995724449bcc5e3acab838c98f09d Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 3 Oct 2024 22:05:24 -0500 Subject: [PATCH 26/31] fix: 0.0.17 --- src/scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts b/src/scripts index 7f549d5..9a9fbc3 160000 --- a/src/scripts +++ b/src/scripts @@ -1 +1 @@ -Subproject commit 7f549d573320fa897349434ebd2c3ce3ebe092cc +Subproject commit 9a9fbc32fdbffe470ca2536570e1100dfc11189c From 5d54ab37d20dbd5c9471e8c535a825def013489d Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 3 Oct 2024 22:06:05 -0500 Subject: [PATCH 27/31] fix: use the script version --- src/codecov.sh | 223 ---------------------------------------- src/commands/upload.yml | 2 +- 2 files changed, 1 insertion(+), 224 deletions(-) delete mode 100755 src/codecov.sh diff --git a/src/codecov.sh b/src/codecov.sh deleted file mode 100755 index a94cea1..0000000 --- a/src/codecov.sh +++ /dev/null @@ -1,223 +0,0 @@ -#!/usr/bin/env bash -CC_WRAPPER_VERSION="0.0.16" -say() { - echo -e "$1" -} -exit_if_error() { - say "$r==> $1$x" - if [ $CC_FAIL_ON_ERROR = true ]; - then - say "$r Exiting...$x" - exit 1; - fi -} -lower() { - echo $(echo $1 | sed 's/CC//' | sed 's/_/-/g' | tr '[:upper:]' '[:lower:]') -} -write_existing_args() { - if [ -n "$(eval echo \$$1)" ]; - then - echo " -$(lower "$1") $(eval echo \$$1)" - fi -} -write_truthy_args() { - if [ "$(eval echo \$$1)" = "true" ] || [ "$(eval echo \$$1)" = "1" ]; - then - echo " -$(lower $1)" - fi -} -b="\033[0;36m" # variables/constants -g="\033[0;32m" # info/debug -r="\033[0;31m" # errors -x="\033[0m" -say " _____ _ - / ____| | | - | | ___ __| | ___ ___ _____ __ - | | / _ \\ / _\` |/ _ \\/ __/ _ \\ \\ / / - | |___| (_) | (_| | __/ (_| (_) \\ V / - \\_____\\___/ \\__,_|\\___|\\___\\___/ \\_/ - $r Wrapper-$CC_WRAPPER_VERSION$x - " -CC_VERSION="${CC_VERSION:-latest}" -CC_FAIL_ON_ERROR="${CC_FAIL_ON_ERROR:-false}" -if [ -n "$CC_BINARY" ]; -then - if [ -f "$CC_BINARY" ]; - then - cc_filename=$CC_BINARY - else - exit_if_error "Could not find binary file $CC_BINARY" - fi -else - family=$(uname -s | tr '[:upper:]' '[:lower:]') - cc_os="windows" - [[ $family == "darwin" ]] && cc_os="macos" - [[ $family == "linux" ]] && cc_os="linux" - [[ $cc_os == "linux" ]] && \ - osID=$(grep -e "^ID=" /etc/os-release | cut -c4-) - [[ $osID == "alpine" ]] && cc_os="alpine" - [[ $(arch) == "aarch64" && $family == "linux" ]] && cc_os+="-arm64" - say "$g==>$x Detected $b${cc_os}$x" - export cc_os=${cc_os} - export cc_version=${CC_VERSION} - cc_filename="codecov" - [[ $cc_os == "windows" ]] && cc_filename+=".exe" - export cc_filename=${cc_filename} - [[ $cc_os == "macos" ]] && \ - ! command -v gpg 2>&1 >/dev/null && \ - HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg - cc_url="https://cli.codecov.io" - cc_url="$cc_url/${CC_VERSION}" - cc_url="$cc_url/${cc_os}/${cc_filename}" - say "$g ->$x Downloading $b${cc_url}$x" - curl -Os $cc_url - say "$g==>$x Finishing downloading $b${cc_os}:${CC_VERSION}$x" - say " " -fi -if [ "$CC_SKIP_VALIDATION" = "true" ] || [ -n "$CC_BINARY" ]; -then - say "$r==>$x Bypassing validation as requested by user" -else -CC_PUBLIC_PGP_KEY=$(curl https://keybase.io/codecovsecurity/pgp_keys.asc) - echo "${CC_PUBLIC_PGP_KEY}" | \ - gpg --no-default-keyring --import - # One-time step - say "$g==>$x Verifying GPG signature integrity" - sha_url="https://cli.codecov.io" - sha_url="${sha_url}/${cc_version}/${cc_os}" - sha_url="${sha_url}/${cc_filename}.SHA256SUM" - say "$g ->$x Downloading $b${sha_url}$x" - say "$g ->$x Downloading $b${sha_url}.sig$x" - say " " - curl -Os "$sha_url" - curl -Os "${sha_url}.sig" - if ! gpg --verify "${cc_filename}.SHA256SUM.sig" "${cc_filename}.SHA256SUM"; - then - exit_if_error "Could not verify signature. Please contact Codecov if problem continues" - fi - if ! (shasum -a 256 -c "${cc_filename}.SHA256SUM" || \ - sha256sum -c "${cc_filename}.SHA256SUM"); - then - exit_if_error "Could not verify SHASUM. Please contact Codecov if problem continues" - fi - say "$g==>$x CLI integrity verified" - say -fi -cc_cli_args=() -cc_cli_args+=( $(write_existing_args CC_AUTO_LOAD_PARAMS_FROM) ) -cc_cli_args+=( $(write_existing_args CC_ENTERPRISE_URL) ) -cc_cli_args+=( $(write_existing_args CC_YML_PATH) ) -say "$r CC_VERBOSE = $CC_VERBOSE$x" -cc_cli_args+=( $(write_truthy_args CC_VERBOSE) ) -cc_cc_args=() -cc_cc_args+=( $(write_truthy_args CC_FAIL_ON_ERROR) ) -cc_cc_args+=( $(write_existing_args CC_GIT_SERVICE) ) -cc_cc_args+=( $(write_existing_args CC_PARENT_SHA) ) -cc_cc_args+=( $(write_existing_args CC_PR) ) -cc_cc_args+=( $(write_existing_args CC_SHA) ) -cc_cc_args+=( $(write_existing_args CC_SLUG) ) -cc_create_report_args=() -cc_cr_args+=( $(write_existing_args CC_CODE) ) -cc_cr_args+=( $(write_truthy_args CC_FAIL_ON_ERROR) ) -cc_cr_args+=( $(write_existing_args CC_GIT_SERVICE) ) -cc_cr_args+=( $(write_existing_args CC_PR) ) -cc_cr_args+=( $(write_existing_args CC_SHA) ) -cc_cr_args+=( $(write_existing_args CC_SLUG) ) -cc_du_args=() -OLDIFS=$IFS;IFS=, -cc_du_args+=( $(write_existing_args CC_BRANCH) ) -cc_du_args+=( $(write_existing_args CC_BUILD) ) -cc_du_args+=( $(write_existing_args CC_BUILD_URL) ) -cc_du_args+=( $(write_existing_args CC_CODE) ) -cc_du_args+=( $(write_existing_args CC_DIR) ) -cc_du_args+=( $(write_truthy_args CC_DISABLE_FILE_FIXES) ) -cc_du_args+=( $(write_truthy_args CC_DISABLE_SEARCH) ) -cc_du_args+=( $(write_truthy_args CC_DRY_RUN) ) -cc_du_args+=( $(write_existing_args CC_ENV) ) -if [ -n "$CC_EXCLUDES" ]; -then - for directory in $CC_EXCLUDES; do - cc_du_args+=( " --exclude " "$directory" ) - done -fi -cc_du_args+=( $(write_truthy_args CC_FAIL_ON_ERROR) ) -if [ -n "$CC_FILES" ]; -then - for file in $CC_FILES; do - cc_du_args+=( " --file " "$file" ) - done -fi -if [ -n "$CC_FLAGS" ]; -then - for flag in $CC_FLAGS; do - cc_du_args+=( " --flag " "$flag" ) - done -fi -cc_du_args+=( $(write_existing_args CC_GIT_SERVICE) ) -cc_du_args+=( $(write_truthy_args CC_HANDLE_NO_REPORTS_FOUND) ) -cc_du_args+=( $(write_existing_args CC_JOB_CODE) ) -cc_du_args+=( $(write_truthy_args CC_LEGACY) ) -cc_du_args+=( $(write_existing_args CC_NAME) ) -cc_du_args+=( $(write_existing_args CC_NETWORK_FILTER) ) -cc_du_args+=( $(write_existing_args CC_NETWORK_PREFIX) ) -cc_du_args+=( $(write_existing_args CC_NETWORK_ROOT_FOLDER) ) -if [ -n "$CC_PLUGINS" ]; -then - for plugin in $CC_PLUGINS; do - cc_du_args+=( " --plugin " "$plugin" ) - done -fi -cc_du_args+=( $(write_existing_args CC_PR) ) -cc_du_args+=( $(write_existing_args CC_REPORT_TYPE) ) -cc_du_args+=( $(write_existing_args CC_SHA) ) -cc_du_args+=( $(write_existing_args CC_SLUG) ) -IFS=$OLDIFS -unset NODE_OPTIONS -# See https://github.com/codecov/uploader/issues/475 -chmod +x $cc_filename -if [ -n "$CC_TOKEN_VAR" ]; -then - token="$(eval echo \$$CC_TOKEN_VAR)" -else - token="$(eval echo $CC_TOKEN)" -fi -say "$g ->$x Token of length ${#token} detected" -token_str="" -token_arg=() -if [ -n "$token" ]; -then - token_str+=" -t " - token_arg+=( " -t " "$token") -fi -say "$g==>$x Running create-commit" -say " $b./$cc_filename $(echo "${cc_cli_args[@]}") create-commit$token_str $(echo "${cc_cc_args[@]}")$x" -if ! ./$cc_filename \ - ${cc_cli_args[*]} \ - create-commit \ - ${token_arg[*]} \ - ${cc_cc_args[*]}; -then - exit_if_error "Failed to create-commit" -fi -say " " -say "$g==>$x Running create-report" -say " $b./$cc_filename $(echo "${cc_cli_args[@]}") create-report$token_str $(echo "${cc_cr_args[@]}")$x" -if ! ./$cc_filename \ - ${cc_cli_args[*]} \ - create-report \ - ${token_arg[*]} \ - ${cc_cr_args[*]}; -then - exit_if_error "Failed to create-report" -fi -say " " -say "$g==>$x Running do-upload" -say " $b./$cc_filename $(echo "${cc_cli_args[@]}") do-upload$token_str $(echo "${cc_du_args[@]}")$x" -if ! ./$cc_filename \ - ${cc_cli_args[*]} \ - do-upload \ - ${token_arg[*]} \ - ${cc_du_args[*]}; -then - exit_if_error "Failed to upload" -fi diff --git a/src/commands/upload.yml b/src/commands/upload.yml index 0c5fb6a..e837b8a 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -150,7 +150,7 @@ parameters: steps: - run: name: Upload to Codecov - command: <> + command: <> when: << parameters.when >> environment: CC_BINARY: << parameters.binary >> From 6ce41e039e391bb3a14af665d7a9eec406b26bed Mon Sep 17 00:00:00 2001 From: Tom Hu <88201630+thomasrockhu-codecov@users.noreply.github.com> Date: Fri, 4 Oct 2024 07:35:41 -0500 Subject: [PATCH 28/31] Update src/commands/upload.yml Co-authored-by: Joe Becher --- src/commands/upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index e837b8a..43f66ef 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -102,7 +102,7 @@ parameters: type: string default: "" plugins: - description: Comma-separated list of plugins to run. Specify `noop` to turn of all plugins + description: Comma-separated list of plugins to run. Specify `noop` to turn off all plugins type: string default: "" pr: From c3703116e7a5509179518bcc44fb00a36de2db8e Mon Sep 17 00:00:00 2001 From: Tom Hu <88201630+thomasrockhu-codecov@users.noreply.github.com> Date: Fri, 4 Oct 2024 07:37:11 -0500 Subject: [PATCH 29/31] Update src/commands/upload.yml Co-authored-by: Joe Becher --- src/commands/upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index 43f66ef..769f030 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -30,7 +30,7 @@ parameters: type: string default: "" dir: - description: Folder where to search for coverage files. Default to current working directory + description: Folder to search for coverage files. Default to the current working directory type: string default: "" disable_file_fixes: From 0fde1915fd13026604b203cd3b8ed22a92c7b339 Mon Sep 17 00:00:00 2001 From: Joe Becher Date: Fri, 4 Oct 2024 08:40:22 -0400 Subject: [PATCH 30/31] Update src/commands/upload.yml --- src/commands/upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index 769f030..c41fe05 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -14,7 +14,7 @@ parameters: type: string default: "" branch: - description: Branch to which this commit belongs to + description: Branch to which this commit belongs type: string default: "" build: From b6d9aa85b3b343e09f132f7368ea8e447c1a266a Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Fri, 4 Oct 2024 14:01:07 -0500 Subject: [PATCH 31/31] fix: fixes based on comments --- src/commands/upload.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/commands/upload.yml b/src/commands/upload.yml index c41fe05..d2790b4 100644 --- a/src/commands/upload.yml +++ b/src/commands/upload.yml @@ -26,7 +26,7 @@ parameters: type: string default: "" code: - description: The code of the report. If unsure, leave default. + description: The code of the report if using local upload. If unsure, leave default. Read more here https://docs.codecov.com/docs/the-codecov-cli#how-to-use-local-upload type: string default: "" dir: @@ -34,7 +34,7 @@ parameters: type: string default: "" disable_file_fixes: - description: Disable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets). + description: Disable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets). Read more here https://docs.codecov.com/docs/fixing-reports type: boolean default: false disable_search: @@ -46,7 +46,7 @@ parameters: type: boolean default: false enterprise_url: - description: (Enterprise only). Set to the Codecov instance URL. + description: Set to the Codecov instance URl. Only applicable to some Enterprise users. type: string default: "" env: @@ -122,7 +122,7 @@ parameters: type: boolean default: false slug: - description: (Enterprise only) owner/repo slug used instead of the private repo token + description: Set to the owner/repo slug used instead of the private repo token. Only applicable to some Enterprise users. type: string default: "" token: