Time Tracking and Hours Reports in GitLab with GTT
GitLab has time tracking (caveat: Unfortunately this is the Enterprise Edition, not the fully Free Software Community Edition). See:
- https://about.gitlab.com/features/time-tracking/
- https://gitlab.com/help/workflow/time_tracking.md
- https://docs.gitlab.com/ee/workflow/time_tracking.html
What it doesn't have is any evident way to see, in a reasonable overview, this time that's been tracked.
I got no responses asking this in #gitlab on IRC: Is there any UI for seeing tracked time by person? I can't find it (or any project overview of time tracked) and it's not documented if there is. As a fallback, is there a way to export this time estimate and tracked information? I'm on GitLab.com but we might go self-hosted at some point, so i'm interested on info about both. https://gitlab.com/gitlab-org/gitlab-ee/issues/1228 didn't have much.
Never did find the documentation for the API of getting tracked time. But i found an awesome tool that makes full use of that API:
https://github.com/kriskbx/gitlab-time-tracker
Installation
Installing that command line wonder was pretty easy.
Upgraded Node on my system with: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
Installed Yarn per this: https://yarnpkg.com/en/docs/install#linux
And then followed the installation instructions: https://github.com/kriskbx/gitlab-time-tracker#installation
Usage
gtt report "uc-davis/patient-hm-brain"
Project-specific configuration
In a .gtt.yml
in the root of your project directory you can define the project that gtt should use so you don't have to type it each time, along with other options you want for the project. For instance:
project: nichq/nichq-community showWithoutTimes: true closed: true query: - issues report: - stats - issues - records
Here we have set the project (its path on GitLab.com), that we want it to show issues that do not have times (so we can see what we've estimated), to include closed issues (so we get the full time count), and to not include merge requests in queries or reports because we track all time on issues.
More usage examples
These examples require the project-specific configuration—at least the project being set—by a file like the one shown above.
View only a single sprint (milestone)
gtt report --milestone="Sprint Basinga"
Output a PDF
gtt report --milestone="Sprint Basinga" -o pdf -l basinga.pdf
Output CSV files
gtt report -o csv -l nichq-community-time-2017-12-08.csv
Different CSV files will be created for each section of the report, with the command above for example resulting in:
nichq-community-time-2017-12-08.issues.csv nichq-community-time-2017-12-08.records.csv nichq-community-time-2017-12-08.stats.csv
Get time worked for a particular user for a given time period
gtt report -u mlncn -f 2018-01-01 -t 2018-02-01
Comments
Post new comment