-
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
When workflow is set to empty string, gitversion gives errors for values not provided in config #4149
Comments
The reason why we have introduced the workflow templates was exactly to not providing any default values in code. I think we have three options:
At this point I'm not sure what the desired solution might be for your issue. @asbjornu what do you think? |
@HHobeck, I think the best option is:
|
@David-Hari: May I ask you to do the changes and create a pull-request? |
So what you are saying is that if a template is not used (the |
I think the second option is appropriated. I would say create a new template with the name e.g. default/v1 which includes a minimal set of configuration values. This template you can use for your scenario instead of an empty string. |
Can you point me to the documentation on how to create my own template? I did not think that was possible. Also, if I am to create my own template I may as well just keep the properties in my GitVersion.yml file as it's one less file to deal with. |
Also, if you say that the point of the templates is to provide the default values then why do I see this here: Seems like the code could read from there if no value is provided by the user's config file. Looks like there is code for handling default attributes. Maybe it's just not working. |
A new template mechanism was introduced to provide templates you can use in the custom configuration file. The json scheme file itselfe will be generated based on the json attribute annotation. Obviously the annotation (and also the documentation) doesn't reflect the actual implementation and needs to be updated. We don't want to have any default values in code (only in configuration template files). A starting point might be:
@arturcic: Something I've forgotten? There is no How To yet. If you not mind please document the steps. Thank you very much. |
I think adding an test case here https://github.com/arturcic/GitVersion/blob/main/src/GitVersion.Configuration.Tests/Workflows/WorkflowsTests.cs And unit tests for the new workflow? |
@HHobeck, so you are asking me to make all these changes in the GitVersion source code right? To add a new template that contains the default values, yes? What about my earlier comment on the existing code that appears to handle default values? |
Yes correct.
What code do you mean? The JSON schema is generated from the annotation and it is just there for documenting reason.
@asbjornu Can you please elaborate? |
The json I linked to in my earlier comment. This file. Anyway, that's just my opinion. I am not involved in this project so I am not going to attempt to make any changes. I will instead just leave my |
We have removed the default values in code and introduced a template mechanism. That means introducing default values in code is not the desired solution here because we want to have a single source of truth. If you like you can create a template which includes a minimal set of values which can be used as a base template. Yes, I agree the annotation and the exception messages like you mentioned should be removed/changed as well. Regards |
Prerequisites
GitVersion package
GitVersion.Portable
GitVersion version
6.0.1+Branch.main.Sha.0fd23d1af997a7b7c6f22f27310443270a91fb18
Operating system
Windows
What are you seeing?
I'm just getting started with GitVersion so I'm unsure of the exact config that will suit my needs. I want my GitVersion.yml file to be minimal, without needing to specify properties when they will be the default. However, I also don't want to use any of the workflow templates, as they define specific branch config that I do not want. Therefore, I set
workflow: ''
in my config.My entire config so far looks like this:
But this causes GitVersion to give an error complaining about missing values. I then set a few more properties,
This still does not satisfy GitVersion and it now complains about
tag-pre-release-weight
having no value:The documentation states that the default value for this property is 60000, so it should use that instead of forcing me to explicitly define it.
Also, as you can see from the above, the error message tells me to report this issue!
What is expected?
If a property has a default value, then that value should be used if the property is not specified in the config.
This really only applies when not using a workflow template.
Steps to Reproduce
Create a
GitVersion.yml
file as mentioned in the description, then rungitversion
on a repo.RepositoryFixture Test
No response
Output log or link to your CI build (if appropriate).
The text was updated successfully, but these errors were encountered: