diff options
author | Emil Palm <emil@netnod.se> | 2019-05-10 15:11:22 +0200 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-06-03 21:25:01 +0900 |
commit | 671dc0d94ab92e2b21e4643ce930efb0df4ccc6d (patch) | |
tree | 677f3ff7a9df2bbe3468dfd5d0397c87ce11ef9e /BUILD.md | |
parent | 3e3289448b48fbdf9cc765450bd421e3a71323b5 (diff) |
Add Versioning support
Diffstat (limited to 'BUILD.md')
-rw-r--r-- | BUILD.md | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -15,6 +15,43 @@ Now ready to modify the code and build two binaries, `cmd/gobgp` and `cmd/gobgpd GoBGP releases are time-based. Minor releases will occur every month ([Semantic Versioning](https://semver.org/)). Major releases occur only when absolutely necessary. +## Versioning + +GoBGP has a internal module for version information. +```internal/pkg/version/version.go``` defines the following variables + +```MAJOR``` ```MINOR``` ```PATCH``` these constants are for the Semantic Versioning scheme. +These will be updated upon release by maintainer. + +There is also two more variables that are ment to be changed by ldflags; + +```TAG``` is supposed to be used to denote which branch the build is based upon. +```SHA``` is supposed to be used to inform about which git sha sum the build is based on. + +### Examples + +A normal release version of GoBGP Version 2.5.0 should should have; + +```golang +const MAJOR uint = 2 +const MINOR uint = 5 +const PATCH uint = 0 +``` + +If you have a non-standard release and want to have more build information there is some flags to be used. +`COMMIT`, `IDENTIFIER` and `METADATA`. + +```bash +go build -ldflags \ + "-X github.com/osrg/gobgp/internal/pkg/version.COMMIT=`git rev-parse --short HEAD` \ + -X github.com/osrg/gobgp/internal/pkg/version.METADATA="date.`date "+%Y%m%d"`" \ + -X github.com/osrg/gobgp/internal/pkg/version.IDENTIFIER=alpha" +``` + +This will produce a version number of + +```2.5.0-alpaha+commit.XXXYYYZZ.date.20190526``` + ## Layout The GoBGP project adopts [Standard Go Project Layout](https://github.com/golang-standards/project-layout). |