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

UseGitVersion task needs config file to be specified #2094

Closed
phatcher opened this issue Feb 11, 2020 · 10 comments
Closed

UseGitVersion task needs config file to be specified #2094

phatcher opened this issue Feb 11, 2020 · 10 comments
Labels

Comments

@phatcher
Copy link
Contributor

Changed over to the new DevOps task, but it fails to pick up the config file

- task: UseGitVersion@5
  displayName: 'GitVersion'
  inputs:
    versionSpec: '5.x'
    updateAssemblyInfo: false

This runs
/opt/hostedtoolcache/GitVersion.Tool/5.1.3/x64/dotnet-gitversion /home/vsts/work/1/s /output buildserver /nofetch

And I get the wrong version number e.g. 0.2.0+55 since it doesn't pick up the config file

Change this to

- task: UseGitVersion@5
  displayName: 'GitVersion'
  inputs:
    versionSpec: '5.x'
    updateAssemblyInfo: false
    useConfigFile: true
    configFilePath: './gitversion.yml'

and we get
/opt/hostedtoolcache/GitVersion.Tool/5.1.3/x64/dotnet-gitversion /home/vsts/work/1/s /output buildserver /nofetch /config /home/vsts/work/1/s/gitversion.yml

which then correctly computes the build number.

I'd expect it to pick up the standard configuration file without being told?

@asbjornu
Copy link
Member

If you execute GitVersion.exe, the config file should indeed be picked up. Perhaps there's a discreapancy between the exe and the dotnet tool, for some reason?

@arturcic
Copy link
Member

Both use the same csproj so it should be the same

@phatcher
Copy link
Contributor Author

Can I suggest adding a debug mode for the command line, so we can see the configuration assumptions GitVersion's making - would make debugging this sort of issue much easier.

@arturcic
Copy link
Member

Please do, please create a separate issue

@KZeronimo
Copy link

@phatcher - in Azure DevOps what was the default behavior you are expecting in the absence of an explicit config?

I dumped the "default" config dotnet-gitversion /showconfig and this matched the behavior I was expecting.

Asking for my learning :)

assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
mode: ContinuousDelivery
tag-prefix: '[vV]'
continuous-delivery-fallback-tag: ci
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)'
legacy-semver-padding: 4
build-metadata-padding: 4
commits-since-version-source-padding: 4
commit-message-incrementing: Enabled
branches:
  develop:
    mode: ContinuousDeployment
    tag: alpha
    increment: Minor
    prevent-increment-of-merged-branch-version: false
    track-merge-target: true
    regex: ^dev(elop)?(ment)?$
    source-branches: []
    tracks-release-branches: true
    is-release-branch: false
    is-mainline: false
    pre-release-weight: 0
  master:
    mode: ContinuousDelivery
    tag: ''
    increment: Patch
    prevent-increment-of-merged-branch-version: true
    track-merge-target: false
    regex: ^master$
    source-branches:
    - develop
    - release
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: true
    pre-release-weight: 55000
  release:
    mode: ContinuousDelivery
    tag: beta
    increment: None
    prevent-increment-of-merged-branch-version: true
    track-merge-target: false
    regex: ^releases?[/-]
    source-branches:
    - develop
    - master
    - support
    - release
    tracks-release-branches: false
    is-release-branch: true
    is-mainline: false
    pre-release-weight: 30000
  feature:
    mode: ContinuousDelivery
    tag: useBranchName
    increment: Inherit
    prevent-increment-of-merged-branch-version: false
    track-merge-target: false
    regex: ^features?[/-]
    source-branches:
    - develop
    - master
    - release
    - feature
    - support
    - hotfix
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: false
    pre-release-weight: 30000
  pull-request:
    mode: ContinuousDelivery
    tag: PullRequest
    increment: Inherit
    prevent-increment-of-merged-branch-version: false
    tag-number-pattern: '[/-](?<number>\d+)'
    track-merge-target: false
    regex: ^(pull|pull\-requests|pr)[/-]
    source-branches:
    - develop
    - master
    - release
    - feature
    - support
    - hotfix
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: false
    pre-release-weight: 30000
  hotfix:
    mode: ContinuousDelivery
    tag: beta
    increment: Patch
    prevent-increment-of-merged-branch-version: false
    track-merge-target: false
    regex: ^hotfix(es)?[/-]
    source-branches:
    - develop
    - master
    - support
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: false
    pre-release-weight: 30000
  support:
    mode: ContinuousDelivery
    tag: ''
    increment: Patch
    prevent-increment-of-merged-branch-version: true
    track-merge-target: false
    regex: ^support[/-]
    source-branches:
    - master
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: true
    pre-release-weight: 55000
ignore:
  sha: []
commit-date-format: yyyy-MM-dd
merge-message-formats: {}

@simonstaimie
Copy link

simonstaimie commented Jul 14, 2020

I have the same with gitversion too
the major version doesnt increase at all, i simply keep getting the 2.0.0 after each build.
any ideas?

example: "2.0.0-beta.161 Updated gitversion.yml"

gitversion.yml file below:

next-version: 1.0.0
assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatchTag
assembly-informational-format: '{DefaultInformationalVersion}'
tag-prefix: '[vV]'
continuous-delivery-fallback-tag: ''
#major-version-bump-message: '+semver:\s?(breaking|major)'
minor-version-bump-message: '+semver:\s?(feature|minor)'
#patch-version-bump-message: '+semver:\s?(fix|patch)'
no-bump-message: '+semver:\s?(none|skip)'
commit-message-incrementing: Enabled
patch-version-bump-message: ''
branches:
develop:
mode: ContinuousDeployment
#source-branches: ['develop']
tag: 'alpha'
#increment: Patch
prevent-increment-of-merged-branch-version: false
test:
regex: ^test?
source-branches: ['test']
mode: ContinuousDeployment
tag: 'beta'
increment: Patch
master:
tag: ''
ignore:
sha: []

@asbjornu
Copy link
Member

Please stop using UseGitVersionTask and switch over to GitTools instead. See #2326 for the closest thing we have to documentation with regards to this at the moment.

@simonstaimie
Copy link

Hi @asbjornu

I believe we have been using this GitTools in Azure Devops

see below build pipeline

image

and see below installed

image

@simonstaimie
Copy link

simonstaimie commented Jul 14, 2020

To add:

https://marketplace.visualstudio.com/items?itemName=gittools.gittools&ssr=false#review-details

I have this exact problem.

"I install the extension but always when i want to add the task to pipeline the button add displays Installed. Extension is installed but i can't use her."

I cant seem to use GitTools even when it's been installed into Azure Devops

@stale
Copy link

stale bot commented Oct 12, 2020

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 12, 2020
@stale stale bot closed this as completed Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants