Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloudBuild.buildNumber.enabled is set to false yet still updates the build number #691

Closed
TomekLesniak opened this issue Nov 19, 2021 · 3 comments

Comments

@TomekLesniak
Copy link

TomekLesniak commented Nov 19, 2021

Environment:

  • Azure Pipelines with linux agents
  • nbgv in latest version (3.4.244)

Having version.json defined in a repository root:

{
  "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
  "version": "1.3",
  "pathFilters": ["./"],
  "cloudBuild": {
    "setVersionVariables": true,
    "buildNumber": {
      "enabled": true
    }
  }
}

And, for example, one of the version.json in a project under root folder:

{
  "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
  "version": "1.1",
  "pathFilters": ["./"],
  "cloudBuild": {
    "setVersionVariables": true,
    "buildNumber": {
      "enabled": false
    }
  }
}

After running nbgv cloud command firstly on root, then in project, desired (target) behavior would be as following

  1. in root - buildNumber.enabled is set to true, so buildNumber is set to 1.3.x
  2. in project - buildNumber.enabled is set to false, so buildNumber remains as 1.3.x

But actual behavior is that:

  1. BuildNumber is set to 1.3.x
  2. BuildNumber is set once again to 1.1.x (override)

Even if buildNumber.enabled=false is set in root version.json, and in all projects, it`s still overriding buildNumber in each step ( each run of nbgv cloud command).

Tried:

  • setting cloudBuild.buildNumber.enabled = false in root, inherit file in project and set to true
  • setting cloudBuild.buildNumber.enabled = false in each version.json file

But it looks like it`s just ignoring this property.

@AArnott
Copy link
Collaborator

AArnott commented Nov 22, 2021

The nbgv cloud command is used explicitly to set the cloud build number. See its usage doc:

❯ nbgv cloud -h
cloud:
  Communicates with the ambient cloud build to set the build number and/or other cloud build variables.

The cloudBuild.buildNumber.enabled setting doesn't disable this command. Rather, it influences whether msbuild building of that project will set the build number when it computes the version for that project.

@Leosori
Copy link

Leosori commented Apr 26, 2023

I've just stumbled across the same problem. I just need the variables set by the tool but not the build number.
The help text of the cloud command is a little bit misleading there because it says 'and/or' and therefore implicating I could choose between both options.

Since I only need three variables I'm gonna extract them from the get-version command output

@AArnott
Copy link
Collaborator

AArnott commented Apr 26, 2023

That's good feedback. If you'd like to send a PR to fix the doc, and even add a switch to suppress the cloud build number from being set, I'd take it.

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

No branches or pull requests

3 participants