Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Upload from Azure Pipelines doesn't have correct PR number set #189

Closed
astrofrog opened this issue Aug 8, 2019 · 6 comments
Closed

Upload from Azure Pipelines doesn't have correct PR number set #189

astrofrog opened this issue Aug 8, 2019 · 6 comments

Comments

@astrofrog
Copy link

astrofrog commented Aug 8, 2019

I am trying to use the bash script from https://codecov.io/bash to upload coverage reports from Azure Pipelines, and the upload itself works, but in the codecov dashboard it looks like the commit came from a merge into master when in fact it came from a pull request. I think one of the issues might be the naming of the environment variables. In the script, I see:

  # https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=vsts
  service="azure_pipelines"
  commit="$BUILD_SOURCEVERSION"
  build="$BUILD_BUILDNUMBER"
  if [  -z "$PULL_REQUEST_NUMBER"];
  then
    pr="$PULL_REQUEST_ID"
  else
    pr="$PULL_REQUEST_NUMBER"
  fi
  job="${BUILD_BUILDID}"
  branch="$BUILD_SOURCEBRANCHNAME"

Whereas running env on Azure Pipelines gives (removed many variables for clarity):

BUILD_SOURCEVERSION=3db4e76b2e74ef53116fcc2a0af47eabeef4c1a9
BUILD_BUILDNUMBER=20190808.2
SYSTEM_PULLREQUEST_PULLREQUESTNUMBER=84
SYSTEM_PULLREQUEST_PULLREQUESTID=304845562
BUILD_BUILDID=31
BUILD_SOURCEBRANCHNAME=merge
SYSTEM_TEAMFOUNDATIONSERVERURI=https://dev.azure.com/astropy-project/
SYSTEM_TEAMPROJECT=sphinx-automodapi

So it looks like $PULL_REQUEST_NUMBER should be $SYSTEM_PULLREQUEST_PULLREQUESTNUMBER and $PULL_REQUEST_ID should be $SYSTEM_PULLREQUEST_PULLREQUESTID?

@astrofrog
Copy link
Author

Just to confirm, making these changes fixes the reporting of the coverage. It looks like the bash script in this repository is out of date compared to https://codecov.io/bash so I wasn't able to open a PR.

@armano2
Copy link

armano2 commented Jan 19, 2020

@drazisil is there anythink that we can do to help fix this issue, we recently moved out some projects from node uploader to bash.

@drazisil
Copy link
Contributor

Hi @armano2

I'm not sure why #158 was closed, looks like there was some discussion about the envs, but it was before i started focusing on this repo.

If you want to fix this in a PR, I'd be happy to review and merge if it works and passes tests. Otherwise it's on my backlog behind normal support duties.

@armano2
Copy link

armano2 commented Jan 26, 2020

i did some small fix to it but i'm unsure how to test this, and as for my repo
for now i will set up something like this in CI (as it fixes this issue)

- bash: bash <(curl -s https://codecov.io/bash) -P "$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER"
  env:
    CODECOV_TOKEN: $(CODECOV_TOKEN)
  displayName: 'Publish code coverage report'

@drazisil
Copy link
Contributor

Thanks, @armano2

This got lost in my email inbox.

@thomasrockhu
Copy link
Contributor

Resolved via #256

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants