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

Support 'assembly-versioning-format' option as a part of '/overrideconfig' command line parameter #2485

Closed
nenadvicentic opened this issue Dec 18, 2020 · 5 comments · Fixed by #2524
Milestone

Comments

@nenadvicentic
Copy link
Contributor

nenadvicentic commented Dec 18, 2020

It would be very useful to support syntax overriding 'assembly-versioning-format' as a part of command-line arguments for /overrideconfig. At the moment of writing this, only tag-prefix option is supported.

Reason for request:

Currently, only way to override 'assembly-versioning-format' option is via configuration files. For example GitVersion.yml file in the root of repository. This means that to use custom version format on the company level, one has to commit new file in each repository. It's not possible to control formatting this via CI build-configuration alone.

Example syntax:

> gitversion /overrideconfig assembly-versioning-format='{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}'

Or perhaps double-quotes would be more consistent for the value-part?
"{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}"

@asbjornu
Copy link
Member

Extending /overrideconfig to support every property supported in GitVersion.yml is something I support. I'm kind of surprised only tag-prefix is the only supported property. Pull requests are welcome.

@nenadvicentic
Copy link
Contributor Author

After checking the code, I see multiple problems related to full GitVersion.yml implementation:

  • Some of the properties of GitVersion.yml are complex types. For example Branches are dictionary of BranchConfigs, MergeMessageFormatsorIgnore`, having multiple properties of their own.
  • Different parsing implementations. GitVersion.yml relies on YamlDotNet and it's attributes to parse GitVersion.yml file and deserialize it in GitVersion.Model.Configuration.Config class. Separate implementation would be required for line arguments parsing.
  • Keeping all properties of Config class in sync with command line arguments would require maintenance two separate lists of properties. Second option would be Reflection on YamlMemberAttributes of Config class, but that would create other issues.

I would suggest to start smaller: implement only a few properties that make sense to be used from command line and are usually not project specific.

For example: assembly-informational-format, assembly-versioning-format and assembly-file-versioning-format, as versioning schema makes a lot of sense to be applied globally, across all company's projects.

@asbjornu
Copy link
Member

Thanks for diving into it, @nenadvicentic. That sounds reasonable. Perhaps it makes sense to only allow simple typed properties that can be represented by strings on the command line?

@phitattoo

This comment has been minimized.

@github-actions
Copy link

🎉 This issue has been resolved in version 5.6.9 🎉
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.

4 participants