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

[ISSUE]: Task fails with simply "command failed" when configuration errors exist #1229

Closed
2 tasks done
mtaylorfsmb opened this issue Aug 16, 2024 · 1 comment · Fixed by #1381
Closed
2 tasks done
Milestone

Comments

@mtaylorfsmb
Copy link

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

GitVersion package

AzureDevops task

What are you seeing?

We upgraded from task v0/GitVersion v5 to task v3/GitVersion v6. We made no changes to your gitversion config file that is used by all our builds. We didn't realize that the config format had changed. When the execute task ran all we got in the output was a "command failed" message. There was no indication why it failed or what was wrong.

The only way we diagnosed this issue was by cloning the repo locally, dropping in the config file that is used and then running the same command line that the build server runs. This revealed that our config file had entries that are no longer supported.

What is expected?

If an error occurs while attempting to run gitversion then the detailed error information should be passed back up to the output log so the problem can be diagnosed without having to manually replicate the build environment.

It was also frustrating to have to manually figure out what breaking changes were made to both the task and underlying Gitversion config. To fix the config we had to fix the one error that was reported, rerun the process, fix the next error. If a migration document or similar was available (maybe it is?) then this would have sped up the process.

Steps to Reproduce

Use the latest task/gitversion tooling in a DevOps build with a config file that contains invalid data. Example of invalid data would be a config that was valid in older versions. Here's an example.

# Configuration file for GitVersion
assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: None
commit-message-incrementing: Enabled  # MergeMessageOnly doesn't seem to work properly
mode: ContinuousDelivery  
increment: Patch
branches:
  # main uses a version based upon release tag plus any commits to branch with commit messages for PRs
  main:
    regex: ^(master|main)
    tag: ''    
    increment: Patch
    prevent-increment-of-merged-branch-version: true
    is-mainline: true        
    
  # release uses the version in the branch name (+hotfix) and increments patch if there has been any changes since then
  release:
    regex: release?[/-]
    tag: 'hotfix'
    source-branches:
    - master
    - main
    increment: Patch
    is-release-branch: true         

Output log or link to your CI build (if appropriate).

2024-08-16T19:29:21.4591471Z ##[debug]getVariable - INPUT_TARGETPATH: D:\a\1\s\src
2024-08-16T19:29:21.4591841Z ##[debug]getVariable - INPUT_DISABLECACHE: false
2024-08-16T19:29:21.4592214Z ##[debug]getVariable - INPUT_DISABLENORMALIZATION: false
2024-08-16T19:29:21.4592600Z ##[debug]getVariable - INPUT_DISABLESHALLOWCLONECHECK: false
2024-08-16T19:29:21.4592984Z ##[debug]getVariable - INPUT_USECONFIGFILE: true
2024-08-16T19:29:21.4593366Z ##[debug]getVariable - INPUT_CONFIGFILEPATH: D:\a\1\s\src\gitversion.yml
2024-08-16T19:29:21.4593745Z ##[debug]getVariable - INPUT_OVERRIDECONFIG: 
2024-08-16T19:29:21.4594109Z ##[debug]getVariable - INPUT_UPDATEASSEMBLYINFO: false
2024-08-16T19:29:21.4594485Z ##[debug]getVariable - INPUT_UPDATEASSEMBLYINFOFILENAME: 
2024-08-16T19:29:21.4594859Z ##[debug]getVariable - BUILD_SOURCESDIRECTORY: D:\a\1\s
2024-08-16T19:29:21.4595368Z Command: git -C D:/a/1/s/src rev-parse --is-shallow-repository
2024-08-16T19:29:21.4595731Z ##[debug]getVariable - INPUT_CONFIGFILEPATH: D:\a\1\s\src\gitversion.yml
2024-08-16T19:29:21.4596120Z ##[debug]getVariable - BUILD_SOURCESDIRECTORY: D:\a\1\s
2024-08-16T19:29:21.4596528Z ##[debug]getVariable - GITVERSION_PATH: C:\hostedtoolcache\windows\GitVersion.Tool\6.0.2
2024-08-16T19:29:21.4597120Z Command: C:\hostedtoolcache\windows\GitVersion.Tool\6.0.2\dotnet-gitversion.exe D:/a/1/s/src /output json /output buildserver /config D:\a\1\s\src\gitversion.yml
2024-08-16T19:29:21.6649481Z ##[debug]GitVersion failed
2024-08-16T19:29:21.6650370Z ##[debug]task result: Failed
2024-08-16T19:29:21.6701577Z ##[error]Command failed: C:\hostedtoolcache\windows\GitVersion.Tool\6.0.2\dotnet-gitversion.exe D:/a/1/s/src /output json /output buildserver /config D:\a\1\s\src\gitversion.yml

2024-08-16T19:29:21.6711499Z ##[debug]Processed: ##vso[task.issue type=error;]Command failed: C:\hostedtoolcache\windows\GitVersion.Tool\6.0.2\dotnet-gitversion.exe D:/a/1/s/src /output json /output buildserver /config D:\a\1\s\src\gitversion.yml

2024-08-16T19:29:21.6713813Z ##[debug]Processed: ##vso[task.complete result=Failed;done=true;]Command failed: C:\hostedtoolcache\windows\GitVersion.Tool\6.0.2\dotnet-gitversion.exe D:/a/1/s/src /output json /output buildserver /config D:\a\1\s\src\gitversion.yml
@arturcic arturcic added this to the v3.x milestone Sep 24, 2024
@arturcic arturcic linked a pull request Nov 18, 2024 that will close this issue
@arturcic arturcic modified the milestones: v3.x, v3.0.2 Nov 18, 2024
@arturcic arturcic reopened this Nov 20, 2024
@arturcic arturcic modified the milestones: v3.0.2, v3.x Nov 20, 2024
@arturcic arturcic removed a link to a pull request Dec 10, 2024
@arturcic arturcic linked a pull request Dec 10, 2024 that will close this issue
@arturcic arturcic modified the milestones: v4.x, v3.0.4 Dec 10, 2024
@gittools-bot
Copy link

🎉 This issue has been resolved in version v3.0.4 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants