git-log-to-elasticsearch

A CLI tool to index git repository metadata into Elasticsearch

git-log-to-elasticsearch

Usage

Make sure crystal is installed (tested with Crystal 1.0.0)

shards update --ignore-crystal-version
shards build --production --release
# this only imports the main branch
./bin/git-log-to-elasticsearch -v -b '^origin/main$' \
  -n 'org/my-repo-name' v ~/path/to/repo

Possible arguments:

  • --host=URL: Target URL to index into, default http://localhost:9200
  • -b regex, --branch=regex: specifies the branches to import as regex, default .* (all branches)
  • -u, --user=user:pass: basic auth info
  • -n NAME, --name=NAME: specifies the repo name, i.e. elastic/elasticsearch
  • -v, --verbose: Verbose output
  • -d, --dry-run: Don't index into Elasticsearch, exit before

Sample run to index only the master branch data of my local Elasticsearch repo in one of my Elastic Cloud clusters

./bin/git-log-to-elasticsearch -b '^origin/master$' -n 'elastic/elasticsearch' \
  --host https://my-cloud-cluster.es.europe-west3.gcp.cloud.es.io:9243 \
  -u elastic:$PASS ~/devel/elasticsearch/

This takes a couple of minutes. I have not yet taken the time to parallelize this using fibers and multi threading. Feel free to send a PR.

Contributing

  1. Fork it (https://github.com/spinscale/git-log-to-elasticsearch/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

git-log-to-elasticsearch

Owner
Statistic
  • 2
  • 1
  • 0
  • 0
  • 2
  • over 3 years ago
  • June 21, 2021
License

Apache License 2.0

Links
Synced at

Fri, 22 Nov 2024 15:03:43 GMT

Languages