From 73271695d5e8ab2d6538a06e63b400f163f26487 Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Thu, 12 Sep 2019 02:05:27 -0400 Subject: [PATCH] support Azure Pipelines https://github.com/codecov/codecov-python/pull/194 --- codecov/__init__.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/codecov/__init__.py b/codecov/__init__.py index 2c2b50f3..b2ff8bec 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -338,6 +338,27 @@ def main(*argv, **kwargs): if language: _add_env_if_not_empty(include_env, 'TRAVIS_%s_VERSION' % language.upper()) + # --------------- + # Azure Pipelines + # --------------- + elif os.getenv("TF_BUILD") == "True" and os.getenv("SHIPPABLE") != "true": + # https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml + # https://docs.microsoft.com/en-us/azure/devops/pipelines/migrate/from-travis?view=azure-devops#predefined-variables + query.update(dict(branch=os.getenv("BUILD_SOURCEBRANCH", + os.getenv("SYSTEM_PULLREQUEST_TARGETBRANCH")), + service="azure_pipelines", + build=os.getenv("AGENT_JOBNAME"), + pr=os.getenv("SYSTEM_PULLREQUEST_PULLREQUESTID", + os.getenv("SYSTEM_PULLREQUEST_PULLREQUESTNUMBER")), + tag=os.getenv("BUILD_SOURCEBRANCH"), + slug=os.getenv("BUILD_REPOSITORYNAME"), + commit=os.getenv("BUILD_SOURCEVERSION"), + ), + ) + root = os.getenv("BUILD_SOURCESDIRECTORY") or root + write(" Azure Pipelines Detected") + _add_env_if_not_empty(include_env, "AGENT_OS") + # -------- # Codeship # --------