Skip to content

Commit 52aba10

Browse files
committed
added --env argument for uploader
1 parent 274bda8 commit 52aba10

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

codecov/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def try_to_run(cmd):
6161
except:
6262
pass
6363

64-
def upload(url, root, **kwargs):
64+
def upload(url, root, env=None, **kwargs):
6565
try:
6666
if not root:
6767
root = os.getcwd()
@@ -77,6 +77,9 @@ def upload(url, root, **kwargs):
7777

7878
assert reports, "error no coverage report found, could not upload to codecov"
7979

80+
if env:
81+
reports = "\n<<<<<< ENV\n".join(("\n".join(["%s=%s"%(k,os.getenv(k,'')) for k in env]), reports))
82+
8083
kwargs['package'] = "codecov-v%s" % VERSION
8184

8285
url = "%s/upload/v2?%s" % (url, urlencode(dict([(k, v.strip()) for k, v in kwargs.items() if v is not None])))
@@ -175,14 +178,15 @@ def main(*argv):
175178
parser.add_argument('--min-coverage', default="0", help="min coverage goal, otherwise build fails")
176179
parser.add_argument('--branch', default=defaults.pop('branch'), help="commit branch name")
177180
parser.add_argument('--json', action="store_true", default=False, help="output json data only")
181+
parser.add_argument('--env', nargs="*", help="store config variables for coverage builds")
178182
parser.add_argument('--token', '-t', default=os.getenv("CODECOV_TOKEN"), help="codecov repository token")
179183
parser.add_argument('--url', default=os.getenv("CODECOV_ENDPOINT", "https://codecov.io"), help="url for enteprise customers")
180184
if argv:
181185
codecov = parser.parse_args(argv)
182186
else:
183187
codecov = parser.parse_args()
184188

185-
data = upload(url=codecov.url, branch=codecov.branch, commit=codecov.commit, token=codecov.token, **defaults)
189+
data = upload(url=codecov.url, branch=codecov.branch, commit=codecov.commit, token=codecov.token, env=codecov.env, **defaults)
186190
return data, codecov
187191

188192
def cli():

0 commit comments

Comments
 (0)