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

Commit ff826f0

Browse files
committed
Add Azure Pipelines support
1 parent 158a38e commit ff826f0

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

codecov/__init__.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ def main(*argv, **kwargs):
505505

506506
else:
507507
write("==> Detecting CI provider")
508+
508509
# -------
509510
# Jenkins
510511
# -------
@@ -845,6 +846,39 @@ def main(*argv, **kwargs):
845846

846847
write(" GitHub Actions CI Detected")
847848

849+
# -------
850+
# Azure Pipelines
851+
# -------
852+
elif os.getenv("SYSTEM_TEAMFOUNDATIONSERVERURI"):
853+
# https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=vsts
854+
# https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&viewFallbackFrom=vsts&tabs=yaml
855+
# https://github.com/codecov/codecov-bash/blob/ce0eb066b997622ff071255e8aa4c239099c17fc/codecov#L895
856+
query.update(
857+
dict(
858+
service="azure_pipelines",
859+
commit=os.getenv("BUILD_SOURCEVERSION"),
860+
build=os.getenv("BUILD_BUILDNUMBER"),
861+
project=os.getenv("SYSTEM_TEAMPROJECT"),
862+
server_uri=os.getenv("SYSTEM_TEAMFOUNDATIONSERVERURI"),
863+
job=os.getenv("BUILD_BUILDID"),
864+
branch=os.getenv("BUILD_SOURCEBRANCH", "").replace("refs/heads/", ""),
865+
build_url="".join([
866+
os.getenv("SYSTEM_TEAMFOUNDATIONSERVERURI", ""),
867+
os.getenv("SYSTEM_TEAMPROJECT", ""),
868+
"/_build/results?buildId=",
869+
os.getenv("BUILD_BUILDID", "")
870+
])
871+
)
872+
)
873+
874+
if os.getenv("SYSTEM_PULLREQUEST_PULLREQUESTNUMBER"):
875+
query.update(dict(pr=os.getenv("SYSTEM_PULLREQUEST_PULLREQUESTID")))
876+
else:
877+
query.update(dict(pr=os.getenv("SYSTEM_PULLREQUEST_PULLREQUESTNUMBER")))
878+
879+
root = os.getenv("BUILD_SOURCESDIRECTORY") or root
880+
write(" Azure Pipelines detected")
881+
848882
else:
849883
query.update(
850884
dict(

0 commit comments

Comments
 (0)