I have a netcoreapp1.0
that I build using Bitbucket pipelines and pack with dotnet pack
, and push to Octopus deploy as a package MyAssembly.Api.1.0.0-beta-*.nupkg where *
is supposed to be a commit number/build number (or any other stable incremented number).
Since the commit identifiers in GIT are UUIDs, I have tried the following commands (see below) to get the commit count, but the resulting commit count is very unreliable and does not work as expected. Locally I get it working just fine and the commit count is incremented for every commit I make to my local repo. Unfortunately, none of the commands work in the pipeline (running in a Docker container). For some reason the commit count stays the same or even decreases sometimes.
I read somewhere that it has to do with "shallow/unshallow" git repo blabla..., and that it might be solved by logging in (to GIT) every time. I do not wish to do this if I can avoid it, and I find it kinda ironic that I would need to login to GIT within Bitbucket itself.
git shortlog | grep -cE '^[ ]+\w+'
git rev-list HEAD --count
git rev-list --all --count
git rev-list --no-merges --count HEAD
git log --pretty=format:'' | wc -l
git log master --pretty=oneline | wc -l
Q: Is there any other way to increment a value and access it as a variable in a pipeline?