# CodeCov Uploads from Azure Pipelines are failing with 'Build numbers do not match'

**URL:** <https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100>\
**Category:** Bug Fixes\
**Created:** [March 2, 2020, 8:48pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100 "2020-03-02T20:48:58Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![X-Guardian](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/x-guardian/32/1238_2.png) [@X-Guardian](https://community.codecov.com/u/X-Guardian)\
**Post date:** [March 2, 2020, 8:48pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/1 "2020-03-02T20:48:58Z")

</div>

### Description

CodeCov uploads from Azure Pipeline CI runs on the GitHub ActiveDirectoryDsc repo have been failing for the last two weeks with the error ‘Build numbers do not match. Please upload with the Codecov repository upload token to resolve issue.’. They were working previously.

Example error: [https://dev.azure.com/dsccommunity/ActiveDirectoryDsc/\_build/results?buildId=1157&view=logs&j=f83e3f09-a299-5b31-26ad-d8f96216e5fb&t=a4cfa163-c668-5abb-1e34-ccd4fe91a617&l=41](https://dev.azure.com/dsccommunity/ActiveDirectoryDsc/_build/results?buildId=1157&view=logs&j=f83e3f09-a299-5b31-26ad-d8f96216e5fb&t=a4cfa163-c668-5abb-1e34-ccd4fe91a617&l=41)

### Repository

> **[GitHub - dsccommunity/ActiveDirectoryDsc: This module contains DSC resources for deployment...](https://github.com/dsccommunity/ActiveDirectoryDsc)**
>
> This module contains DSC resources for deployment and configuration of Active Directory Domain Services.

---

<div class="post-metadata">

**Author:** ![drazisil](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/drazisil/32/496_2.png) [@drazisil](https://community.codecov.com/u/drazisil)\
**Post date:** [March 4, 2020, 2:52pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/3 "2020-03-04T14:52:02Z")

</div>

Hi @X-Guardian

Let me check over at the bash uploader repo [GitHub - codecov/codecov-bash: Global coverage report uploader for Codecov](https://github.com/codecov/codecov-bash) and see if we recently caused something that could cause this.

---

<div class="post-metadata">

**Author:** ![drazisil](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/drazisil/32/496_2.png) [@drazisil](https://community.codecov.com/u/drazisil)\
**Post date:** [March 10, 2020, 2:01pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/4 "2020-03-10T14:01:49Z")

</div>

hi @X-Guardian

I wasn’t able to see anything. Is this still happening?

---

<div class="post-metadata">

**Author:** ![X-Guardian](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/x-guardian/32/1238_2.png) [@X-Guardian](https://community.codecov.com/u/X-Guardian)\
**Post date:** [March 10, 2020, 2:15pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/5 "2020-03-10T14:15:26Z")

</div>

Yes, afraid so. This one is from a new PR: [https://dev.azure.com/dsccommunity/ActiveDirectoryDsc/\_build/results?buildId=1229&view=logs&jobId=f83e3f09-a299-5b31-26ad-d8f96216e5fb&j=f83e3f09-a299-5b31-26ad-d8f96216e5fb&t=a4cfa163-c668-5abb-1e34-ccd4fe91a617](https://dev.azure.com/dsccommunity/ActiveDirectoryDsc/_build/results?buildId=1229&view=logs&jobId=f83e3f09-a299-5b31-26ad-d8f96216e5fb&j=f83e3f09-a299-5b31-26ad-d8f96216e5fb&t=a4cfa163-c668-5abb-1e34-ccd4fe91a617)

---

<div class="post-metadata">

**Author:** ![drazisil](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/drazisil/32/496_2.png) [@drazisil](https://community.codecov.com/u/drazisil)\
**Post date:** [March 10, 2020, 2:25pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/6 "2020-03-10T14:25:53Z")

</div>

This is strange. When I call the API for that build: [https://dev.azure.com/dsccommunity/ActiveDirectoryDsc/\_apis/build/builds/1229?api-version=5.0](https://dev.azure.com/dsccommunity/ActiveDirectoryDsc/_apis/build/builds/1229?api-version=5.0)

It does indeed return a different SHA:

`sourceVersion	"467ebb76f54fc5fd2a5c4156d2878abf35612b77"`

Any idea why that may be? It looks like the SHA you are passing us is `28934a337b6ac8b60ba101deec6e3278f41f5c7e`

---

<div class="post-metadata">

**Author:** ![X-Guardian](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/x-guardian/32/1238_2.png) [@X-Guardian](https://community.codecov.com/u/X-Guardian)\
**Post date:** [March 10, 2020, 2:46pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/7 "2020-03-10T14:46:44Z")

</div>

We are not explicitly specifying the SHA. We just call the codecov bash script like so:

`bash <(curl -s https://codecov.io/bash) -f "./$(buildArtifactName)/$(codecovTestArtifactName)/JaCoCo_coverage.xml"`

---

<div class="post-metadata">

**Author:** ![drazisil](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/drazisil/32/496_2.png) [@drazisil](https://community.codecov.com/u/drazisil)\
**Post date:** [March 10, 2020, 2:52pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/8 "2020-03-10T14:52:28Z")

</div>

Right, sorry for being unclear. `28934a337b6ac8b60ba101deec6e3278f41f5c7e` is the SHA being picked up by the uploader from env variables.

`467ebb76f54fc5fd2a5c4156d2878abf35612b77` is the SHA the Azure API says it is. Which is correct and can you tell me the relationship between the two SHAs?

---

<div class="post-metadata">

**Author:** ![X-Guardian](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/x-guardian/32/1238_2.png) [@X-Guardian](https://community.codecov.com/u/X-Guardian)\
**Post date:** [March 10, 2020, 3:04pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/9 "2020-03-10T15:04:42Z")

</div>

OK,

28934a3 is the commit from the remote forked branch that is the source of the PR: [ADGroup: Add MSA Member Support · dsccommunity/ActiveDirectoryDsc@28934a3 · GitHub](https://github.com/dsccommunity/ActiveDirectoryDsc/commit/28934a337b6ac8b60ba101deec6e3278f41f5c7e).

I’m not sure what 467ebb76 is: [Merge 28934a337b6ac8b60ba101deec6e3278f41f5c7e into 811eef557ad5841d6… · dsccommunity/ActiveDirectoryDsc@467ebb7 · GitHub](https://github.com/dsccommunity/ActiveDirectoryDsc/commit/467ebb76f54fc5fd2a5c4156d2878abf35612b77). Description is “Merge 28934a3 into 811eef5”. 811eef5 is the latest commit in the master branch.

---

<div class="post-metadata">

**Author:** ![X-Guardian](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/x-guardian/32/1238_2.png) [@X-Guardian](https://community.codecov.com/u/X-Guardian)\
**Post date:** [March 10, 2020, 3:09pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/10 "2020-03-10T15:09:19Z")

</div>

Both of these SHA’s appear in the response from [https://dev.azure.com/dsccommunity/ActiveDirectoryDsc/\_apis/build/builds/1229?api-version=5.0](https://dev.azure.com/dsccommunity/ActiveDirectoryDsc/_apis/build/builds/1229?api-version=5.0).

28934a3 is the “triggerInfo.pr.sourceSha”  
467ebb76 is the “sourceVersion”

---

<div class="post-metadata">

**Author:** ![drazisil](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/drazisil/32/496_2.png) [@drazisil](https://community.codecov.com/u/drazisil)\
**Post date:** [March 13, 2020, 3:35pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/11 "2020-03-13T15:35:31Z")

</div>

Ok.

`sourceVersion` is what we check for tokenless.

commit="$BUILD\_SOURCEVERSION" is what the bash uploader grabs for the commit.

@ibrahim0814, any thoughts here?

---

<div class="post-metadata">

**Author:** ![OriolAbril](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/oriolabril/32/340_2.png) [@OriolAbril](https://community.codecov.com/u/OriolAbril)\
**Post date:** [March 16, 2020, 6:36pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/12 "2020-03-16T18:36:32Z")

</div>

We are encountering the same issue. In case it helps, here is some info that may help debug the issue.

[PR arviz#1123](https://github.com/arviz-devs/arviz/pull/1123) tries to merge commit `5ec1c2c3802382d4be2847053ebb1e57ef0c76cb` into master (at time of writing and running CI at commit `e5208d14ec89a1970b0d3be9f55e1147d97fd1e4`). It looks like Azure creates an extra commit from merging `5ec...` into `e52...`: commit `051f6d88e4d980c72cef76b0e1e6cde1758b4d7f`.

The commit message from `051...` is `Merge 5ec1c2c3802382d4be2847053ebb1e57ef0c76cb into e5208d14ec89a1970b0d3be9f55e1147d97fd1e4`. All environment variables for the Azure build are shown [here](https://dev.azure.com/ArviZ/ArviZ/_build/results?buildId=2137&view=logs&j=e4994452-efbb-51bd-c9fc-f1d030f5bbfb&t=c1eeceb2-6c24-5bdd-302e-729dae527439&l=51).

- `SYSTEM_PULLREQUEST_SOURCECOMMITID` and “triggerInfo.pr.sourceSha” are `5ec...`
- `BUILD_SOURCEVERSION` is `051...`

---

<div class="post-metadata">

**Author:** ![ahartikainen](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/ahartikainen/32/635_2.png) [@ahartikainen](https://community.codecov.com/u/ahartikainen)\
**Post date:** [March 20, 2020, 10:28am UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/13 "2020-03-20T10:28:49Z")

</div>

We were able to fix this by manually defining the sha

```
bash <(curl -s https://codecov.io/bash) -n "$(NAME)" -C $BUILD_SOURCEVERSION

```

I think something wrong happens here (in [codecov.io/bash](https://codecov.io/bash))

```auto
if ["$commit_o" = ""];
then
  # merge commit -> actual commit
  mc=
  if [-n "$pr"] && ["$pr" != false];
  then
    mc=$(git show --no-patch --format="%P" 2>/dev/null || echo "")
  fi
  if [["$mc" =~ ^[a-z0-9]{40}[[:space:]][a-z0-9]{40}$ ]];
  then
    say " Fixing merge commit SHA"
    commit=$(echo "$mc" | cut -d' ' -f2)
  elif ["$GIT_COMMIT" != ""];
  then
    commit="$GIT_COMMIT"
  elif ["$commit" = ""];
  then
    commit=$(git log -1 --format="%H" 2>/dev/null || hg id -i --debug 2>/dev/null | tr -d '+' || echo "")
  fi
else
  commit="$commit_o"
fi

```

Here `-C` skips this if by using `commit="$commit_o"`

---

<div class="post-metadata">

**Author:** ![johlju](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/johlju/32/456_2.png) [@johlju](https://community.codecov.com/u/johlju)\
**Post date:** [March 24, 2020, 4:31pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/14 "2020-03-24T16:31:02Z")

</div>

Using `-C` does not work for the scenario in the DSC Community repos (we have this issue over all repos in the org that we are enable this for). This DID work before. So something has change somewhere. 🙂

**NOTE: This example below is from a branch, not a PR. So the error occurs for branch commits too.** _Testing on a fork of xFailOverCluster repo._

Using argument `-C` is the same as the script already does. At line 790 it does

```auto
commit="$BUILD_SOURCEVERSION"

```

Which when the block that is mentioned above it hits which is skipped since `commit` was set at line 790.

```auto
elif ["$commit" = ""];

```

Running the bash script with debug messages (a copy with added `say` lines) I see that both returns the same commit at the end. First run is _without_ `-C`, and the second run is with `-C`.

[https://dev.azure.com/viscalyx/xFailOverCluster/\_build/results?buildId=524&view=logs&j=9c98dabf-a506-5435-4ead-dace7c1625a8&t=c251aece-c156-5cd3-dcec-645d5e596fc0](https://dev.azure.com/viscalyx/xFailOverCluster/_build/results?buildId=524&view=logs&j=9c98dabf-a506-5435-4ead-dace7c1625a8&t=c251aece-c156-5cd3-dcec-645d5e596fc0)

```auto
==> END merge commit -> actual commit. COMMIT: 616ceb491c568b110b5b9f78af9f33fa61c734d3

```

And from the API the source version is  
[https://dev.azure.com/viscalyx/xFailOverCluster/\_apis/build/builds/524?api-version=5.0](https://dev.azure.com/viscalyx/xFailOverCluster/_apis/build/builds/524?api-version=5.0)

```auto
    "sourceBranch": "refs/heads/debug-codecov",
    "sourceVersion": "616ceb491c568b110b5b9f78af9f33fa61c734d3",

```

---

<div class="post-metadata">

**Author:** ![johlju](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/johlju/32/456_2.png) [@johlju](https://community.codecov.com/u/johlju)\
**Post date:** [March 24, 2020, 4:43pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/15 "2020-03-24T16:43:25Z")

</div>

@drazisil what does the error message “Build numbers do not match.” mean? It can’t have to do with the commits. Is something else going on? 🤔

---

<div class="post-metadata">

**Author:** ![jackgerrits](https://avatars.discourse-cdn.com/v4/letter/j/c68b51/32.png) [@jackgerrits](https://community.codecov.com/u/jackgerrits)\
**Post date:** [April 5, 2020, 12:29am UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/16 "2020-04-05T00:29:14Z")

</div>

I am also hitting this issue, I had just created an issue when I found this thread

> <https://github.com/codecov/codecov-bash/issues/287>
>
> I am trying to use CodeCov with Azure Devops Pipelines and I am not able to get …the tokenless authentication working. 
> 
> When I run the bash uploader I get the following error:
> 
> https://dev.azure.com/vowpalwabbit/Vowpal%20Wabbit/\_build/results?buildId=7919&view=logs&j=12f1170f-54f2-53f3-20dd-22fc7dff55f9&t=9c939e41-62c2-5605-5e05-fc3554afc9f5&l=27177 
> \`\`\`sh
> ==\> Uploading reports
> url: https://codecov.io
> query: branch=merge&commit=4c0ba2d79c63569605e85e5e12bf2ff7c9cadc47&build=20200404.18&build\_url=https%3A%2F%2Fdev.azure.com%2Fvowpalwabbit%2FVowpal%20Wabbit%2F\_build%2Fresults%3FbuildId%3D7919&name=&tag=&slug=VowpalWabbit%2Fvowpal\_wabbit&service=azure\_pipelines&flags=&pr=2385&job=7919&project=VowpalWabbit&server\_uri=https://dev.azure.com/vowpalwabbit/
> -\> Pinging Codecov
> https://codecov.io/upload/v4?package=bash-tbd&token=secret&branch=merge&commit=4c0ba2d79c63569605e85e5e12bf2ff7c9cadc47&build=20200404.18&build\_url=https%3A%2F%2Fdev.azure.com%2Fvowpalwabbit%2FVowpal%20Wabbit%2F\_build%2Fresults%3FbuildId%3D7919&name=&tag=&slug=VowpalWabbit%2Fvowpal\_wabbit&service=azure\_pipelines&flags=&pr=2385&job=7919&project=VowpalWabbit&server\_uri=https://dev.azure.com/vowpalwabbit/
> HTTP 400
> Unable to locate build via Azure API. Please upload with the Codecov repository upload token to resolve issue.
> \`\`\`
> 
> I have tried this in a PR build from a fork as well as a push triggered build on a branch on the main upstream repo.
> 
> I also tried setting CODECOV\_TOKEN (which I would really like to avoid), and I get a different error:
> https://dev.azure.com/vowpalwabbit/Vowpal%20Wabbit/\_build/results?buildId=7952&view=logs&j=12f1170f-54f2-53f3-20dd-22fc7dff55f9&t=9c939e41-62c2-5605-5e05-fc3554afc9f5&l=27178
> \`\`\`sh
> ==\> Uploading reports
> url: https://codecov.io
> query: branch=merge&commit=89b8cb1f099e85a09d2fd298a5c2234d12f0829d&build=20200405.2&build\_url=https%3A%2F%2Fdev.azure.com%2Fvowpalwabbit%2FVowpal%20Wabbit%2F\_build%2Fresults%3FbuildId%3D7952&name=&tag=&slug=VowpalWabbit%2Fvowpal\_wabbit&service=azure\_pipelines&flags=&pr=2385&job=7952&project=VowpalWabbit&server\_uri=https://dev.azure.com/vowpalwabbit/
> -\> Pinging Codecov
> https://codecov.io/upload/v4?package=bash-tbd&token=secret&branch=merge&commit=89b8cb1f099e85a09d2fd298a5c2234d12f0829d&build=20200405.2&build\_url=https%3A%2F%2Fdev.azure.com%2Fvowpalwabbit%2FVowpal%20Wabbit%2F\_build%2Fresults%3FbuildId%3D7952&name=&tag=&slug=VowpalWabbit%2Fvowpal\_wabbit&service=azure\_pipelines&flags=&pr=2385&job=7952&project=VowpalWabbit&server\_uri=https://dev.azure.com/vowpalwabbit/
> HTTP 400
> Provided token is not a UUID.
> \`\`\`

---

<div class="post-metadata">

**Author:** ![vtbassmatt](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/vtbassmatt/32/692_2.png) [@vtbassmatt](https://community.codecov.com/u/vtbassmatt)\
**Post date:** [April 17, 2020, 5:37pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/17 "2020-04-17T17:37:42Z")

</div>

👋 PM from Azure Pipelines here. I’m suspicious of the timing and code change in this PR: [[CE-1318] Update to system format for Azure by drazisil · Pull Request #256 · codecov/codecov-bash · GitHub](https://github.com/codecov/codecov-bash/pull/256)

Previously, $pr would always have been empty, because we never had environment variables called $PULL\_REQUEST\_NUMBER or $PULL\_REQUEST\_ID. I bet that correcting that assignment to $SYSTEM\_PULLREQUEST\_PULLREQUEST\* broke the logic further down the page.

We’re also investigating on our side, but we believe we haven’t changed the contents/semantics of any of the variables the Bash uploader looks for.

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [May 22, 2020, 2:56am UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/18 "2020-05-22T02:56:04Z")

</div>

Hi everyone, thanks for reaching out here. I’m not exactly sure what happened, but I’m no longer seeing this issue on the repositories above. I would guess that maybe there was an issue with the bash uploader that has since been resolved. Please let me know if this issue has not been resolved for you.

Also thanks @vtbassmatt for reaching out here, we always appreciate the help.

---

<div class="post-metadata">

**Author:** ![johlju](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/johlju/32/456_2.png) [@johlju](https://community.codecov.com/u/johlju)\
**Post date:** [May 22, 2020, 6:08am UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/19 "2020-05-22T06:08:09Z")

</div>

This issue still exist [Azure DevOps Services | Sign In](https://dev.azure.com/dsccommunity/xFailOverCluster/_build/results?buildId=2113&view=logs&j=9c98dabf-a506-5435-4ead-dace7c1625a8&t=c251aece-c156-5cd3-dcec-645d5e596fc0)

PR: [xCluster: Fix Describe-block descriptions by johlju · Pull Request #242 · dsccommunity/FailoverClusterDsc · GitHub](https://github.com/dsccommunity/xFailOverCluster/pull/242)

Since there was no response on this issue we had to start workaround it by adding the upload token to a few repos that really needed this. We rather see a correct fix to this issue so we can remove the upload token variable again.

Did you look into the suggestion by @vtbassmatt?

---

<div class="post-metadata">

**Author:** ![johlju](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/johlju/32/456_2.png) [@johlju](https://community.codecov.com/u/johlju)\
**Post date:** [May 22, 2020, 12:49pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/20 "2020-05-22T12:49:13Z")

</div>

@tom can you give us what you are seeing on your end? What value is Codecov API expecting in the example PR I linked to above? That would help narrowing down if the wrong value is sent or if your end is expecting the wrong value.

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [May 22, 2020, 11:03pm UTC](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100/21 "2020-05-22T23:03:00Z")

</div>

Yes, I think I misspoke last night. Thanks @johlju for the logs, this is extremely helpful. I need to add some logging on our side and play around to see why this is happening.

[Next page](https://community.codecov.com/t/codecov-uploads-from-azure-pipelines-are-failing-with-build-numbers-do-not-match/1100.md?page=2)
