Skip to content
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

Fix CIRCLE_BUILD_NUM bug and allows users to specify env vars as flags #167

Merged
merged 7 commits into from
Jul 26, 2023

Conversation

joseph-sentry
Copy link
Contributor

This PR fixes the ${CIRCLE_BUILD_NUM} bug in the upload name.

This PR allows users to specify environment variables that specify the
flags to be used in the uploader.

Fixes: codecov/engineering-team#83

This commit fixes the ${CIRCLE_BUILD_NAME} upload name bug
by changing the upload_name parameter default string from
"${CIRCLE_BUILD_NUM}" to the empty string, then modifying
`upload.sh` to replace the PARAM_UPLOAD_NAME env var with
the contents of CIRCLE_BUILD_NUM if PARAM_UPLOAD_NAME
is the empty string.

Signed-off-by: joseph-sentry <joseph.sawaya@sentry.io>
This commit allows users to specify an environment
variable as a flag. The codecov uploader will
use the contents of the environment variable as
the flags when it runs.

This commit checks if the string specified in
PARAM_FLAGS corresponds to an env var and if
it does it passes the contents to the flags option
of the uploader. If it doesn't then it uses the
PARAM_FLAGS string itself.

Signed-off-by: joseph-sentry <joseph.sawaya@sentry.io>
Signed-off-by: joseph-sentry <joseph.sawaya@sentry.io>
Signed-off-by: joseph-sentry <joseph.sawaya@sentry.io>
@codecov
Copy link

codecov bot commented Jul 20, 2023

Codecov Report

Merging #167 (91dbc64) into master (8c5bec2) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##            master      #167   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines            4         4           
=========================================
  Hits             4         4           
Flag Coverage Δ
alpine 100.00% <ø> (ø)
backend ∅ <ø> (∅)
env_var_flag 100.00% <ø> (?)
frontend ∅ <ø> (∅)
linux 100.00% <ø> (ø)
macos 100.00% <ø> (ø)
string_flag 100.00% <ø> (?)
windows 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Signed-off-by: joseph-sentry <joseph.sawaya@sentry.io>
@joseph-sentry joseph-sentry force-pushed the joseph/circle-build-num-and-env-var-flags branch from 85c0d6d to 3360850 Compare July 20, 2023 21:38
@@ -13,7 +13,9 @@ parameters:
default: ""
flags:
description: Flag the upload to group coverage metrics (e.g. unittests
| integration | ui,chrome)
| integration | ui,chrome). If the name of an environment
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the name of an environment variable is provided as a flag then the value of that environment environment variable will be used.

This is a bit wordy. Can we do something like

Flags can be input as strings or environment variables.

src/scripts/upload.sh Show resolved Hide resolved
@@ -80,6 +84,10 @@ jobs:
file: coverage/coverage-final.json
flags: linux
version: v0.1.0_8880
- codecov/upload:
flags: frontend,ENV_VAR_FLAG
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use flag names that are more relevant here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the flags themselves, or for the name of the environment variable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

names of the flags. backend and frontend are already used

Signed-off-by: joseph-sentry <joseph.sawaya@sentry.io>
@joseph-sentry joseph-sentry force-pushed the joseph/circle-build-num-and-env-var-flags branch from 557bcca to 7f38290 Compare July 24, 2023 13:42
Signed-off-by: joseph-sentry <joseph.sawaya@sentry.io>
@joseph-sentry joseph-sentry merged commit 85246e6 into master Jul 26, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modify the Codecov CircleCI orb to allow for environmental variables to be passed into the "flags" section
2 participants