Skip to content

Allow overriding of the config file path #1691

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

Merged
merged 1 commit into from
Jun 30, 2019
Merged

Allow overriding of the config file path #1691

merged 1 commit into from
Jun 30, 2019

Conversation

chuseman
Copy link
Contributor

@chuseman chuseman commented May 28, 2019

This adds a new abstract ConfigFileLocator class, which has two implementations:

  • DefaultConfigFileLocator, which is the current logic (GitVersion.yml and GitVersionConfig.yaml in working and project root directories).
  • NamedConfigFileLocator that will only look for a specific file path (it can be a relative or absolute path).

GitVersionExe has a new optional /config argument which takes a path.

GitVersionTask has a new ConfigFilePath property on all inputs and is exposed via the MSBuild GitVersionConfig property.

GitVersionTfsTask has a new configFilePath input.

This resolves #894.

@asbjornu asbjornu added this to the 5.0.0 milestone Jun 27, 2019
Copy link
Member

@asbjornu asbjornu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks excellent. Can you please rebase the changes on top of HEAD of master and force-push the changes so we get a fresh PR? I'll merge as soon as it lights up green.

@chuseman
Copy link
Contributor Author

Looks like I'm running into some flaky tests here?

Should I drop my last commit? I think Shouldly will give you better error messages for failures if you use it this way, but it isn't related to my PR.

@arturcic
Copy link
Member

@chuseman could you please rebase on top of master as there are some changes to the vsix version.

This adds a new abstract ConfigFileLocator class, which has two implementations:

* DefaultConfigFileLocator, which is the current logic (GitVersion.yml and GitVersionConfig.yaml in working and project root directories).
* NamedConfigFileLocator that will only look for a specific file path (it can be a relative or absolute path).

GitVersionExe has a new optional /config argument which takes a path.

GitVersionTask has a new ConfigFilePath property on all inputs and is exposed via the MSBuild GitVersionConfig property.

GitVersionTfsTask has a new configFilePath input.
@asbjornu asbjornu merged commit 063b7a2 into GitTools:master Jun 30, 2019
@asbjornu
Copy link
Member

Thanks for your contributions, @chuseman!

@chuseman chuseman deleted the add-config-file-locator branch June 30, 2019 19:32
@Skoucail
Copy link
Contributor

Skoucail commented Aug 13, 2019

I believe this feature introduced a unwanted breaking change in the GitVersionTfsTask.
If i leave the Config file field empty i believe it should look for GitVersion.yml files in the working directory and the project directory.
But as the task always calls gitversion with /config it doesn't look for any GitVersion.yml files. And doesn't even use the GitVersion.yml in the working directory.

I believe the problem is that configFilePath is of type filePath. So if you enter something relative (or empty) Azure DevOps will always pretent the working directory. So in the GitVersion.ts the property configFilePath will always contain a value (working directory) and will result in always adding the /config param.

Resulting in command below (Config file field set empty)
[command]"C:\Program Files\dotnet\dotnet.exe" D:\azagent1_work_tasks\GitVersion_e5983830-3f75-11e5-82ed-81492570a08e\5.0.1\core\GitVersion.dll D:\azagent1_work\7\s /output buildserver /nofetch /config D:\azagent1_work\7\s /updateassemblyinfo true

@asbjornu
Copy link
Member

@Skoucail, this should be fixed in #1777. Can you please verify?

@Skoucail
Copy link
Contributor

Skoucail commented Aug 16, 2019

@asbjornu I can test it on Monday. Is the fix available in the gitversion (preview) version (5.0.2) of the azure devops task?

@arturcic
Copy link
Member

@Skoucail you can use the preview version of the task - https://marketplace.visualstudio.com/items?itemName=gittools.gitversion-preview

@arturcic
Copy link
Member

If the code is merged it should be available in the preview version

@chuseman
Copy link
Contributor Author

FWIW, I've verified the fix on our Azure DevOps Server 2019 instance with the preview version. The /config parameter is no longer passed unless the task specifies it.

@Skoucail
Copy link
Contributor

FWIW, I've verified the fix on our Azure DevOps Server 2019 instance with the preview version. The /config parameter is no longer passed unless the task specifies it.

Same here, looks fine now. Thx for fixing @chuseman

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

Successfully merging this pull request may close these issues.

Add support for GitVersion.yml outside of git repo root
4 participants