Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit f9ee6eb

Browse files
authored
Merge pull request #152 from codecov/dana/upload-url
add --url use to all commands available
2 parents ee2889a + dc5825f commit f9ee6eb

26 files changed

+156
-62
lines changed

codecov_cli/commands/base_picking.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def pr_base_picking(
5454
token: typing.Optional[uuid.UUID],
5555
service: typing.Optional[str],
5656
):
57+
enterprise_url = ctx.obj.get("enterprise_url")
5758
logger.debug(
5859
"Starting base picking process",
5960
extra=dict(
@@ -62,6 +63,7 @@ def pr_base_picking(
6263
slug=slug,
6364
token=token,
6465
service=service,
66+
enterprise_url=enterprise_url,
6567
)
6668
),
6769
)
@@ -72,4 +74,4 @@ def pr_base_picking(
7274
)
7375
return
7476

75-
base_picking_logic(base_sha, pr, slug, token, service)
77+
base_picking_logic(base_sha, pr, slug, token, service, enterprise_url)

codecov_cli/commands/commit.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def create_commit(
7575
token: typing.Optional[uuid.UUID],
7676
git_service: typing.Optional[str],
7777
):
78+
enterprise_url = ctx.obj.get("enterprise_url")
7879
logger.debug(
7980
"Starting create commit process",
8081
extra=dict(
@@ -86,9 +87,17 @@ def create_commit(
8687
slug=slug,
8788
token=token,
8889
service=git_service,
90+
enterprise_url=enterprise_url,
8991
)
9092
),
9193
)
9294
create_commit_logic(
93-
commit_sha, parent_sha, pull_request_number, branch, slug, token, git_service
95+
commit_sha,
96+
parent_sha,
97+
pull_request_number,
98+
branch,
99+
slug,
100+
token,
101+
git_service,
102+
enterprise_url,
94103
)

codecov_cli/commands/create_report_result.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,19 @@ def create_report_results(
5151
git_service: str,
5252
token: uuid.UUID,
5353
):
54+
enterprise_url = ctx.obj.get("enterprise_url")
5455
logger.debug(
5556
"Creating report results",
5657
extra=dict(
5758
extra_log_attributes=dict(
58-
commit_sha=commit_sha, code=code, slug=slug, service=git_service
59+
commit_sha=commit_sha,
60+
code=code,
61+
slug=slug,
62+
service=git_service,
63+
enterprise_url=enterprise_url,
5964
)
6065
),
6166
)
62-
create_report_results_logic(commit_sha, code, slug, git_service, token)
67+
create_report_results_logic(
68+
commit_sha, code, slug, git_service, token, enterprise_url
69+
)

codecov_cli/commands/empty_upload.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def empty_upload(
5252
token: typing.Optional[uuid.UUID],
5353
git_service: typing.Optional[str],
5454
):
55+
enterprise_url = ctx.obj.get("enterprise_url")
5556
logger.debug(
5657
"Starting empty upload process",
5758
extra=dict(
@@ -60,7 +61,8 @@ def empty_upload(
6061
slug=slug,
6162
token=token,
6263
service=git_service,
64+
enterprise_url=enterprise_url,
6365
)
6466
),
6567
)
66-
return empty_upload_logic(commit_sha, slug, token, git_service)
68+
return empty_upload_logic(commit_sha, slug, token, git_service, enterprise_url)

codecov_cli/commands/get_report_results.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,16 @@ def get_report_results(
5252
git_service: str,
5353
token: uuid.UUID,
5454
):
55+
enterprise_url = ctx.obj.get("enterprise_url")
5556
logger.debug(
5657
"Getting report results",
5758
extra=dict(
5859
extra_log_attributes=dict(
59-
commit_sha=commit_sha, code=code, slug=slug, service=git_service
60+
commit_sha=commit_sha,
61+
code=code,
62+
slug=slug,
63+
service=git_service,
64+
enterprise_url=enterprise_url,
6065
)
6166
),
6267
)
@@ -67,4 +72,5 @@ def get_report_results(
6772
encoded_slug=encoded_slug,
6873
service=git_service,
6974
token=token,
75+
enterprise_url=enterprise_url,
7076
)

codecov_cli/commands/labelanalysis.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import requests
77

88
from codecov_cli.fallbacks import CodecovOption, FallbackFieldEnum
9+
from codecov_cli.helpers.config import CODECOV_API_URL
910
from codecov_cli.runners import get_runner
1011
from codecov_cli.runners.types import (
1112
LabelAnalysisRequestResult,
@@ -55,6 +56,7 @@ def label_analysis(
5556
runner_name: str,
5657
max_wait_time: str,
5758
):
59+
enterprise_url = ctx.obj.get("enterprise_url")
5860
logger.debug(
5961
"Starting label analysis",
6062
extra=dict(
@@ -63,10 +65,12 @@ def label_analysis(
6365
base_commit_sha=base_commit_sha,
6466
token="NOTOKEN" if not token else (str(token)[:1] + 18 * "*"),
6567
runner_name=runner_name,
68+
enterprise_url=enterprise_url,
6669
)
6770
),
6871
)
69-
url = "https://api.codecov.io/labels/labels-analysis"
72+
upload_url = enterprise_url or CODECOV_API_URL
73+
url = f"{upload_url}/labels/labels-analysis"
7074
token_header = f"Repotoken {token}"
7175

7276
codecov_yaml = ctx.obj["codecov_yaml"] or {}
@@ -121,7 +125,7 @@ def label_analysis(
121125
time.sleep(2)
122126
while not has_result:
123127
resp_data = requests.get(
124-
f"https://api.codecov.io/labels/labels-analysis/{eid}",
128+
f"{upload_url}/labels/labels-analysis/{eid}",
125129
headers={"Authorization": token_header},
126130
)
127131
resp_json = resp_data.json()

codecov_cli/commands/report.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,22 @@
5050
def create_report(
5151
ctx, commit_sha: str, code: str, slug: str, git_service: str, token: uuid.UUID
5252
):
53+
enterprise_url = ctx.obj.get("enterprise_url")
5354
logger.debug(
5455
"Starting create report process",
5556
extra=dict(
5657
extra_log_attributes=dict(
57-
commit_sha=commit_sha, code=code, slug=slug, service=git_service
58+
commit_sha=commit_sha,
59+
code=code,
60+
slug=slug,
61+
service=git_service,
62+
enterprise_url=enterprise_url,
5863
)
5964
),
6065
)
61-
res = create_report_logic(commit_sha, code, slug, git_service, token)
66+
res = create_report_logic(
67+
commit_sha, code, slug, git_service, token, enterprise_url
68+
)
6269
if not res.error:
6370
logger.info(
6471
"Finished creating report successfully",

codecov_cli/commands/staticanalysis.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def static_analysis(
5050
force,
5151
folders_to_exclude: typing.List[pathlib.Path],
5252
):
53+
enterprise_url = ctx.obj.get("enterprise_url")
5354
logger.debug(
5455
"Starting Static Analysis processing",
5556
extra=dict(
@@ -61,6 +62,7 @@ def static_analysis(
6162
token="NOTOKEN" if not token else (str(token)[:1] + 18 * "*"),
6263
force=force,
6364
folders_to_exclude=folders_to_exclude,
65+
enterprise_url=enterprise_url,
6466
)
6567
),
6668
)
@@ -74,5 +76,6 @@ def static_analysis(
7476
token,
7577
force,
7678
list(folders_to_exclude),
79+
enterprise_url,
7780
)
7881
)

codecov_cli/commands/upload.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ def do_upload(
203203
codecov_yaml = ctx.obj["codecov_yaml"] or {}
204204
cli_config = codecov_yaml.get("cli", {})
205205
ci_adapter = ctx.obj.get("ci_adapter")
206+
enterprise_url = ctx.obj.get("enterprise_url")
206207
logger.debug(
207208
"Starting upload processing",
208209
extra=dict(
@@ -225,6 +226,7 @@ def do_upload(
225226
slug=slug,
226227
pull_request_number=pull_request_number,
227228
git_service=git_service,
229+
enterprise_url=enterprise_url,
228230
)
229231
),
230232
)
@@ -257,4 +259,5 @@ def do_upload(
257259
fail_on_error=fail_on_error,
258260
dry_run=dry_run,
259261
git_service=git_service,
262+
enterprise_url=enterprise_url,
260263
)

codecov_cli/helpers/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
logger = logging.getLogger("codecovcli")
77

8+
CODECOV_API_URL = "https://api.codecov.io"
9+
LEGACY_CODECOV_API_URL = "https://codecov.io"
10+
811

912
def load_cli_config(codecov_yml_path: pathlib.Path):
1013
if codecov_yml_path.exists() and codecov_yml_path.is_file():

0 commit comments

Comments
 (0)