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
[question] What is the recommanded way for branch versions ? #3652
Comments
Thanks for your question, it is good one.
I think the idea is that with
For this purpose you might be able to use |
Hi @memsharded |
You can find some info in https://docs.conan.io/2/tutorial/versioning/version_ranges.html#semantic-versioning Pre-releases and build-metadata are not the same, very different. To use pre-releases they should be explicitly opted-in, in the version-range itself, or in general better via a Sounds good, give it a try and let us know. Maybe we can close this issue, and you can create a new ticket if you have new questions regarding this? Thanks! |
thanks. |
I'd recommend carefully reading the discussions in conan-io/conan#15638, I think they are very related.
Yes, and depending how you want to pass the build metadata, you can pass just the build metadata in command line |
Hi! We have the (to my understanding) same issue with Conan, and I did not fully understand the proposed solution. To clarify, let me give a scenario:
It would be fatal if during building of component B, Conan would pick a snapshot of A that belongs to "another branch". For this use-case, what is the recommended approach? As far as I understand, revisions would not work ("latest" may come from any branch) and build metadata also not (it is not considered for versioning). |
Sure, @opajonk, that is a related question, but slightly different. When you create different versions or revisions of a given package (A), then you want to test those changes in isolation "downstream", to see if something breaks. The approach is more or less:
This is what we will be writing in the docs, hopefully soon, for different cases and flows. |
Thanks for the quick reply! I cannot say I fully understood the answer, but that is very likely due to my lack of knowledge about Conan (2). However, we will try this out! |
The core idea is that using lockfiles is the way to make sure that specific dependency is being used and not other. And indeed Conan 2 allows using the lockfiles for this goal orders of magnitude more easily than 1.X |
Ah ok, got it... maybe a last question then: what if I do not need a very specific dependency (forcing the handling and passing around of lockfiles) but rather a "latest from a certain branch" dependency? I mean, at least during our development cycles, this is the by far most common use-case: modify a component/module/whatever A, and then check: does it still integrate downstream? Now maybe component B breaks for whatever reason. Consequence: fix A or modify B (as part of the same unit of work, i.e. the same branch on a different repository). That means: use "latest A from the branch on the same branch on B". This semantic actually does not change, so I would like to avoid creating and passing around of lockfiles... it seems like overhead. |
In practice it does change. Any other possible change that is concurrent, and then your CI builds are using one revision in the first part of the builds and a different revision at other part of the build (or like the Windows build uses one revision, and the Linux build uses another revision). This also happens for dependencies. Imagine you are doing a change in "A". But it happens that A has a dependency on "D", and "D" has also got an update by other team. It is very possible that part of the builds are done with one revision or version of D and another part of the build are done with another version or revision of D. And this is both very complicated to understand and debug, as the failures can get unnoticed until later at runtime. Furthermore, when building integrating the products "apps", it is also possible that other packages are concurrently changed, packages that depend on A and are used by the "apps" packages. Having a lockfile for the "apps" before doing the builds, specially if they are distributed, different platforms, etc, becomes very important. One of the major lockfiles improvements in 2.0 is that only 1 lockfile is necessary, and it can be used to lock all different binary configurations, highly simplifying working with them. |
Thanks a lot for the detailed explanation! |
@memsharded Just found this discussion - and it already helps. maybe my question fits here, too: According to the Conan documentation - if I understand it correctly - pre-release versions take higher precedence compared to the release versions if
In semver 2.0.0 however, they define it like:
Is there some misunderstanding on my end, or does Conan not fully follow semver here? |
Finally I had some time to try this myself. Conan seems to behave in very useful way here :) However I feel the documentation could be little bit more precise. Details: If I have the following packages
a requirement like |
Thanks for the feedback @schwaerz, happy to hear that the current behavior is useful :) I'd probably even recommend to drop the I think we can close this question as responded? |
Yes, thanks.
Neither of the following options would choose that pre-release:
I think the documetation is little bit misleading in this case. One more thing: Would be good to be able to specify the configuration option to whether include pre-releases on the command line when creating a package. Usually I'd not like to specify this globally, as this would always affect all repositories. On the other hand I'd also not like to include it in the |
Do you mean that this includes
We recently added the |
yes, this is what I was looking for. |
yes, it is totally expected that these do not include the pre-release:
I think this might be clarified in the docs, transferring the ticket to the docs repo, if you have nay other question, please open a new ticket, thanks! |
What is your question?
My question is regarding Conan 2.0 and branch versioning.
With conan 1.X, we used the channel to distinguish between branches for our versions in our remote.
I read conan documentation and I understand that it is not recommended to use channel anymore.
We implemented
set_version
function in our conanfile which usesgit describe
for setting the version. We also use tags in our repositories for labeling the released versions.for example: we might have a tag
0.7.1
for that version. (major.minor.patch) and we use the number of commits fromgit describe
command and thebuild
.so on a development branch we might have the version
0.7.1.45
(45 commits since the tag).When developers implement something, they branch out to a side branch, do their work, do several commits, for example 10 commit. On their branch the package version is now
0.7.1.55
but after the squash and merge to the develop branch the version will be
0.7.1.46
Which makes it hard for other developer to understand what is the latest version that they want to use.
I though to add the branch name to the build number, for example:
0.7.1.46-the-most-scary-bug-ever
What do you do at your companies ? how do you get around versioning branches and resolve the version conflicts between the branches ?
Thanks,
Sagi.
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: