A way to capture git repository information for CI builds.
Our dev team has the ability to deploy code from all forks and branches. That means we need to include information as part of any build artifact to uniquely identify where a particular build came from. build-goggles is a simple command line utilty that will get 6 pieces of information about a build and write it to a JSON file for use by other processes.
To get a consistent build number without tracking builds in a centralized store, we count the number of commits that have occurred since the latest version was put in place.
npm install buildgoggles -g
Running the command will either write .buildinfo.json
or exit with a non-zero code.
If run from the repository
buildgoggles
If run outside the repository
buildgoggles /path/to/repo
sample output
Note: the slug is the abbreviated commit sha
{
"owner": "arobson",
"repository": "build-goggles",
"branch": "master",
"version": "0.1.0",
"build": 1,
"slug": "a1b2c3d4"
}