-
Notifications
You must be signed in to change notification settings - Fork 527
[Question] git flow possible incorrect versioning? #444
Comments
This sounds like a generic problem of using git describe for your version
numbers, which to me feels quite dangerous as it only counts that
N-commits-since-tag were made, not WHAT commits, or WHO committed on what
repository/clone.
Not sure about how things are normally done in .NET / nunet land, but
within the Java/Maven ecosystem I’m familiar with - we work on the basis
that in-development artifacts are merely snapshots in time, and local
version numbers end with -SNAPSHOT.
So for the scenario you have, the develop branch would be building
1.1.0-alpha-3-SNAPSHOT, if this were deployed to a repository for testing,
the -SNAPSHOT is replaced with a timestamp.
However, when you create your release branch, you’d update the version to
1.1.0-beta-1-SNAPSHOT, which during the release process would update that
version further to 1.1.0-beta-1 - and tag the repository with *that
specific commit*, deploy that to nuget etc.
…then finally update the version to be 1.1.1-alpha-1-SNAPSHOT which gets
merged back into develop (by way of master) for any subsequent development
builds.
Are you deploying these git describe based ‘releases’ to a repository on
every commit/push?
I don’t think this is so much a gitflow issue, but more a CI/CD management
flow issue.
One potential solution could be:
- Update your version number to 1.1.0-beta+0 and commit that to develop
and push that to origin, create your release branch, release your `
1.1.0-beta+1 and back merge.
Altho that IMHO, still leads to position that beta+1 doesn’t refer to a
unique/addressable point in time.
From: CrispyDrone <[email protected]> <[email protected]>
Reply: petervanderdoes/gitflow-avh
<[email protected]>
<[email protected]>
Date: 15 October 2020 at 2:03:14 PM
To: petervanderdoes/gitflow-avh <[email protected]>
<[email protected]>
Cc: Subscribed <[email protected]>
<[email protected]>
Subject: [petervanderdoes/gitflow-avh] [Question] git flow possible
incorrect versioning? (#444)
Now the following sequence of actions occurs: Repository B creates a
release branch from 1.1.0-alpha+3. Meanwhile development continues, and two
additional features are merged with develop. Repository B now has version
1.1.0-beta+0 in the release branch, while develop is already at
1.1.0-alpha+5. Repository A takes a dependency on 1.1.0-alpha+5 version of
repository B that was created after the release branch in repository A was
started. Repository B's release branch is finished, and a stable package
version 1.1.0 is created. Repository A's dependency on 1.1.0-alpha+5 is
upgraded to the stable equivalent 1.1.0. BOOM: 1.1.0 does not contain the 2
additional features 1.1.0-alpha+4 and 1.1.0-alpha+5. I guess there are
multiple ways around this problem: Only consume stable packages. However,
in our current environment this is not realistic as we have major release
cycles. Work with alpha/beta versioning for both the file versions and git
tags. By doing this, any new features merged into develop after the release
branch has been started will be working towards the "next next" version. In
the example that would result in 1.2.0-alpha+1 and 1.2.0-alpha+2 instead of
1.1.0-alpha+4 and 1.1.0-alpha+5.
|
Thank you for your reply @talios. Sorry for my late response. Could you explain a bit more what you mean with:
Is So when I'm about to finish my release branch, is it tagged with
This update to Now to further clarify my situation. We don't explicitly version anything in My current understanding of However with git flow there is no such concept. Any new development on the To come back to the tooling, the setup we currently have is entirely automated So us developers, we don't care about versions numbers at all in our local GitVersion automatically attaches a version number to every build our CI server We do not translate every build of repository B into a release of its Instead developers release a version when they need it. So for example, a For me personally, the thing that makes the most sense is that as soon as you What I really want is 2 things:
It would be of real help if we there was a guide somewhere that achieves this
|
The nature of how branches work in git this is all ready the case. As long as you do not merge any changes from the release branch into develop prior to release you could consider develop to be in a code freeze state in regards to the status of release. From A successful Git branching model "Release branches support preparation of a new production release. They allow for last-minute dotting of i’s and crossing t’s. Furthermore, they allow for minor bug fixes and preparing meta-data for a release (version number, build dates, etc.). By doing all of this work on a release branch, the develop branch is cleared to receive features for the next big release." In regards to
For your release branches this is all ready taken care of for your source code. As part of git flow release finish the master branch is tagged with your release tag. "When the state of the release branch is ready to become a real release, some actions need to be carried out. First, the release branch is merged into master (since every commit on master is a new release by definition, remember). Next, that commit on master must be tagged for easy future reference to this historical version. "
You update them as often as you find necessary. You could use a text editor such as vim or write a script file to parse an environment variable.
Same as above. Create tags as often as you find necessary. Once again A successful Git branching model does a fantastic job of explaining some of the different branches used and the actual git commands needed to create branches and tags.
That's usually covered in the docs for your CI server. In the end it is up to you and your development team to design the workflow that you are going to use. IE when to create branches, when to tag, when to merge how to merge etc... |
Thanks for your response @ChrisJStone I think that first quote is taken a bit out of context, or maybe I wasn't clear As mentioned in the section "creating a release branch" of the original
This means the version number in develop remains unaffected. What happens to it As soon as you merge the release branch back into develop, these files that So based on this, and from the original description of git flow, I presume that
However, if develop doesn't have a well-defined version or a version at all, As for the possible solutions:
The reason for opening this issue of course was to be able to understand how Also, maybe I'm wrong in this sentiment, but I feel that a branching model and So since git-flow can automatically create tags based on the release branch
|
Your welcome @CrispyDrone, I may have.
If you have a well defined versioning policy in place that is not a problem. I'm going to assume that you have a understanding of semantic versioning. With X.Y.Z being Major.Minor.Patch now you have also have a number of addition qualifiers such as ALPHA, BETA, RC, DEV, SNAPSHOT etc..... along with a build number, timestamp or what ever additional metadata your team decides is necessary to identify a unique version. In my case I prefer to gpg-sign various commits to my project repository. So I typically do the following when I setup a new git repository. I will perform a git init followed by git commit --allow-empty --gpg-sign. This way I can create the master branch and I know every commit made to master is signed by me. Once all of my initial setup is completed I will create an initial release. I usually will use 0.0.1 for this release. It really has no functionality but it's a starting point for development. At this point I would have 2 commits on my master branch. With the second commit having the TAG of 0.0.1 and X number of commits on my DEV branch. Now at the start of my changelog I would have a version of #### 0.0.1-DEV1 <--- I use this to track my versions So I can have a repository version of 0.0.1-DEV4 with a release version of SNAPSHOT-1 and later on 0.0.1-DEV20 and SNAPSHOT-2 When I create a release such 0.1.0 I will update the version in dev to 0.1.0-DEV1 <-- since this is the start of a new development cycle and the version in my release branch to 0.1.0-RC1 with RC being incremented as final bug fixes etc are made. Once a final release is made I commit the release branch to master and develop along with creating tag 0.1.0 My hotfix branches would be done similarly only I would start with 0.1.1 as my initial hotfix branch. This particular fork of git-flow supports a number of hooks that could help you with what you need to accomplish. However you need to write the actual scripts. Now there are a couple of repos that @petervanderdoes has here that provide some example scripts. One of which he used while he was writing this fork of git-flow so it is setup for this repo.
The whole point of git-flow and GitVersion is to help you the developer be more productive in your job. Instead of having to remember and type out multiple git commands to create and finish a release for your project all you have to type is git flow release start and the name of your branch and git flow release finish to finish the branch. It is still up to you to decide what to name that branch and the tag that is created.
If that were the case then why are there so many different VCS packages or CI servers. I've thought the same thing. In the end sadly it falls on us developers. With the number of different CI servers, VCS packages even development methodologies it's really not possible. The best thing that we can do is have a though understanding of how the software works and either find an existing tool that does what were looking for, find something close and write glue code to make it work within our development life cycle or write the tool ourselves. There are software engineering standards that you can follow. However even in the standards it clearly stats that it is up to the end user of those standards to customize them to fit the individual needs. Do you or the company you work for have a document that clearly states how your development and release life-cycles will work? What tools will you use, how will the release be versioned? With out knowing exactly what the problem is we don't know what tool to use. |
In GitFlow, are you allowed to merge features into develop once a release branch has been created?
As far as I can tell this seems to result in incorrect versioning of certain commits, namely:
All the commits that are added to develop before the release branch gets merged back with its tag will be reported as "belonging" to the previous version according to
git describe
.git describe
will find the newly created tag for any commits that are created after merging the release branch with develop. But any commits before it got merged back and after the forking from the release branch will show the previous tag even though they're not part of this release, but the next one.These same sets of commits will have an incorrect version number in any files such as
AssemblyInfo
,package.json
, or any other files that contain a version number. This is because git flow only mentions bumping a version number inside the release branch. When merging back the release branch, I'm assuming that it will take over the version number of the release branch.So all commits before the release branch was started will have the previous version number. All commits after the release branch will have the next version number. But all the commits in between, will also have the previous version number.
Is this actually an issue? If not, please explain why. If yes, how do you deal with it?
At work, we've been experiencing a real issue related to this.
For the sake of the example, imagine 2 repositories, both using git flow.
Repository A consumes an artifact published from repository B (nuget package).
Repository B is currently at version 1.0.0 in master, and version 1.1.0-alpha+3 in develop.
Now the following sequence of actions occurs:
I guess there are multiple ways around this problem:
The text was updated successfully, but these errors were encountered: