Git tag semantic versioning10/7/2023 ![]() Upsides Any change to a versionable artifact will result in a unique build number and if two builds have the same contents, their build numbers will be the same Benefits and downsides to this strategyīefore getting into the details of applying this to chef artifacts, lets briefly examine some pros and cons of this technique. So you will need to give thought to incrementing major and minor build number but the final element just happens upon commit. If you were to run this just after tagging your repo with the major and minor versions, you would get 0 commits and thus the semantic version would be 2.3.0. So now you want your build numbers to reset to 0 starting from the commit being tagged. You can do this by by telling git’s log command to list all commits from that tag forward like so: git log 2.3. When you decide to increment the major or minor build number, you want to tag your repository with those numbers: git tag 2.3 So what about the major and minor numbers? One argument you can pass to git log is a starting ref from which to list commits. If you are using semantic versioning to express version numbers, the commit count can be used to produce the build number – the third element of a version. Git log -pretty=oneline some_directory/ | wc –l Semantic versioning (git log -pretty=oneline some_directory/).count To make this a version, you would count these lines: powershell: This will list all commits within the some_directory directory in a single line per commit that prints the sha1 and the commit comment. You can use the git log command to list all commits applied to a directory or individual file in your repository: git log -pretty=oneline some_directory/ I'll close the post demonstrating how this can be automated as a part of your build process. ![]() It ensures that deciding on what version to stamp your change is one thing you don’t need to think about. The benefit here is the guarantee that any change in the artifact (cookbook, environment, data bag) will result in a unique version number that will not conflict with other versions provided by your fellow teammates. What I am going to discuss is a version numbering strategy that leverages the git log. It assumes that you are already doing that. ![]() This post is not about using git for source control.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |