-
Notifications
You must be signed in to change notification settings - Fork 652
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
[Bug] Assembly Informational Version custumization ignored #2199
Comments
This change might have been introduced in #2014. Perhaps we need a more fine-grained replacement strategy here. 🤔 |
I don't know which charaters are not allowed in SemVer, but i think alphanumeric charaters are not allowed, but some symbols like '-' '_' '.' '|' are allowed, right? |
The regex of characters allowed in a SemVer 2.0 compatible pre-release label is |
If the scope of GitVersion is to use InformationalVersion as SemVer, if think this bug can be rejected |
Well, no, it's the other way around. GitVersion generates a SemVer 2.0 compatible version number, then provides many different serializations and formats of this version numbers targeting different environments. Since |
So, i'm not sure, but we can think about a warning at compile time if AssemblyInformationalVersionAttribute isn't comply with SemVer 2.0. |
Providing the warning at compile time is going to be difficult, but we could log a warning statement during execution. |
Speaking only as a user, but we wish to use AssemblyInformationVersionAttribute as a way of holding more detailed build information than can be obtained from the SemVer format. (For example, the date of the commit, name of build-machine/user, what the user ate for breakfast etc...) By all means, have a way of stuffing a SemVer-compatible string into this field but, please also allow for those of us who want to include arbitrary information. I'm aware we could create a custom attribute ourselves but since gitversion already does 95% of what we want in setting up the attributes, it seems a shame not to also use it for customised info. The 'flattening' of characters into hyphens is particularly annoying when trying to treat the information field as structured data since dates and branch-names also regularly contain hyphens, a custom format such as
|
Sure, if someone provides a pull request that doesn't restrict the format of |
Seems reasonable - just wanted to check there is no underlying design-philosophy that means that such a PR would be rejected? |
No, as I wrote in #2199 (comment), the current behavior is just a conservative default. We might want to allow the current behavior to continue as is and figure out a backwards compatible way to implement this, though. One way is to introduce a configuration value, but we may also look at how this can be solved better with a breaking change in the upcoming version 6 of GitVersion. Ideas are welcome to be discussed here before a pull request is submitted. |
I created a pull request for this as I also need this feature: |
Thanks @LazaroOnline. As I wrote in #2341 (comment) we should be careful to effectively revert #2014. Since our
Where the full extent of the possible syntax would look like this:
The idea is that This means that the following:
Would become equivalent to:
Where the class wrapping the value of Thoughts? |
I think people that want assembly-informational-is-semver: true It would be The special syntax could be a more fine grained feature, but I prefer something simple like a boolean variable that is easier to understand than learning the special meaning of a custom template syntax, that I think would be harder to implement. Would this solution by configuration be acceptable? |
As an interested observer I prefer the simplicity of the configuration flag (regardless of whether it defaults to true or false). I think the design intent that all the main version fields should be SemVer is clear and understandable so introducing a special syntax that would allow this to be overridden for any of them seems over-complicated when "information" is arguably a special-case. |
I updated the pull request to be backwards-compatible and with the new config parameter |
I agree my suggested syntax is a bit convoluted, I just want to think through all alternatives before adding configuration. We already have too much configuration, imho. If we are going to solve this with a configuration property, we should try to approach it from a high level perspective and consider whether what's being asked for here and in #2065 may be related, for instance. In #2065, it has been made clear that being able for GitVersion to serialize version numbers in various different schemes could be useful. Some environments, such as Python, PHP Composer, Ruby Gems, Docker and possibly others only support a subset of SemVer 2.0. Being able to reflect these variations with some sort of Could the same Thoughts? |
I see the use-case of other languages for some sort of scheme for the GitVersion generated SemVer to adhere to their language/platform requirements. However I feel that what we are trying to achieve with this bug/PR is something different. I feel that microsoft's dotnet field Also the scheme feature mentioned in the Python bug, I feel it is far from being implemented because the problem of adding a "scheme" feature with different platform support requires deep knowledge of many other platforms and testing becomes harder. Maybe to accept this PR it would help to rename the new configuration parameter from: Would that help? |
I do agree there are too many configurations there. We need to take this in consideration for version 6.0 and limit the configuration properties only needed for calculation purposes. All the others should be removed or moved to the output plugins (either as separate configuration file or as cli arguments) @asbjornu would you agree? |
I rather like @asbjornu's scheme idea. You could regard all fields as having an implicit scheme of SemVer2. @LazaroOnline's new configuration could then be rewritten as What's less clear is whether the scheme is simply a constraint on allowable output characters or is in some way enforcing a deeper correctness. I can currently write
The hyphens may be removed to make it "SemVer2 compliant" but it certainly won't be a "SemVer2" version number so the constraint here is a fairly shallow one and not massively helpful. And what would you if there was a hypothetical scheme where versions had to be expressed as string representations of numbers? Would setting the scheme to "stringified" cause {MajorMinorPatch} to be rendered as "one_point_two_point_three" ? I raise these points not to be awkward but show that it's probably impossible to find the perfect solution to this. I'll say again that my primary use-case for GitVersion is as a convenient way of getting version information into AssemblyInfo files. The fact that it (currently) has some canned variables that correspond to the way that SemVer expects to interpret stuff is great but if I had to write |
Let me explain why I really need this feature. Not implementing this because of having too many configuration keys sounds a bit arbitrary. If the feature makes sense and adds a desired feature then why not? There could be many valid use cases to have free text, I will state one. Even if the feature to add an IsDirty flag gets implemented, I would like to be able to extend it to list the dirty filenames/paths and the count of lines added/deleted, because in the past we even had to do reverse engineering over DLLs handed over by other dev teams that left the company, in order to know what was the version of the source code running in production and what parts were actually missing in git because someone deployed a dirty version and never pushed it to git! Also for CI/CD automation it would be very interesting to be able to add free text to assemblies that could be parsed by custom tools. It is all about extensibility! |
💯
Yes, I understand why the feature is valuable, we just disagree on the implementation.
Adding another configuration option to the core is not cost-free. Seeing how this feature only is about the serialization of version numbers, the feature belongs at the edge of GitVersion, not in the Core. With GitVersion 6, this entire feature could be delegated to its own GitVersion extension and we wouldn't have to add yet another configuration option to the Core, adding more complexity to the already over-complex codebase. Configuration options are already a major source of problems, because they have been added without thinking thoroughly through how option A affects option B. This leads to a lot of support issues and makes maintaining this repository much harder than it should. Not only the code, but all the support and help these conflicting configuration options necessitates. Not having the best documentation around any of the configuration options available doesn't exactly help either.
The feature makes sense, but I'm very hesitant to add more configuration options, especially when they don't deal with core functionality such as how version numbers are calculated, but instead interface and edge-level concerns like serialization and formatting. Usability decreases as flexibility increases.
Sure, but wouldn't it better if we managed to implement this in a way that was forwards-compatible with future versions of GitVersion, instead of implementing something now that we know is going to be changed in v6?
This use-case is much better solved with signed tags or signed commits, imho. Instead of embedding metadata (that can also be screwed with), you can cryptographically verify that the build comes from the correct source by including the signature of the tag or commit in the build artifact itself, with signed NuGet packages, signed JAR files (JAR are just fancy ZIP files, so could be used to store any kind of content) or something similar.
Sounds like better solution would be to not give developers direct access to the production environment, but instead require them to go through a CI/CD procedure with a release manager such as Octopus Deploy.
Is Adding attributes to assemblies that can contain arbitrary metadata is a nice feature, but I don't think it belongs in GitVersion. Now, don't get me wrong. I may sound negative – I'm not. I think the proposed feature is important and that we need it in GitVersion. I'm just a bit sad we're having this discussion now before the extension system of v6 is in place and that we have to debate short-term solutions such as adding a configuration option. |
As far as it ends up implemented it is good for me. About the company deployment issues, sure there are proper procedures and we do have a CI/CD pipeline, but I don't get to decide when and if it is ok to bypass it, and the company is happy to allow anything as far as things are done in time, at the end what gives them profit is gaining new customers that want to see a certain new feature. Thank you for your time and for understanding the value of this request. |
I don't think any amount of planning is going to help the progress of v6, but it is being worked on and will be ready when it's ready. Sorry for not being able to be more specific, but we are all working on this on our spare time.
You can take a look at the GitVersionV6 prototype repository for a glimpse of some of our ideas. Still early days, but it should be enough to give you an idea.
Exactly. The solution to this is to make the path of least resistance the right one to take.
I believe extensions like these may be possible to create in v6. Perhaps not in 6.0.0, but at least during its lifetime.
Likewise! :) |
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. |
This issue was closed because it has been stalled for 30 days with no activity. Thank you for your contributions |
Using GitVersion.yml to set custumized Assembly Informational Version, any charater used to separate version number from
ShortSha
is ignored and substitued with-
.Expected Behavior
verified with version 5.1.3
Actual Behavior
verified with version 5.2.4
The text was updated successfully, but these errors were encountered: