raV720
raV720

Reputation: 594

Minver not working on Azure devops - sets the default version 0.0.0-alpha.0

When version tag is set on last commit it works ok. But when version tag is set on some of parent commit the resulting version is 0.0.0-alpha.0

Upvotes: 0

Views: 450

Answers (1)

raV720
raV720

Reputation: 594

The problem is with the way azure devops does checkout. It fetches only last commit (depth=1). Log from devops checkout:

git --config-env=http.extraheader=env_var_http.extraheader fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin --depth=1 .....

and minver cannot infer version from only last commit. The fix is to set appropriate depth in azure-pipelines.yml:

steps:
- checkout: self
  fetchDepth: 50  # the depth of commits to ask Git to fetch
  fetchTags: true

Now log looks good:

git --config-env=http.extraheader=env_var_http.extraheader fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin --depth=50

and minver does its job.

Upvotes: 1

Related Questions