git-log-to-elasticsearch

Version, currently main branch1 version
  • main branchlatestJun 23, 2021

github.com/spinscale/git-log-to-elasticsearch

A CLI tool to index git repository metadata into Elasticsearch

2 stars
0 dependents
License: Apache-2.0

Installation

# Add this to your shard.yml
dependencies:
  git-log-to-elasticsearch:
    github: spinscale/git-log-to-elasticsearch
    branch: main

main is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
1.0.0
Author
Alexander Reelsen
Target
  • git-log-to-elasticsearch from src/git-log-to-elasticsearch.cr

Dependencies

Runtime Dependencies

  • git*github: smacker/libgit2.cr, branch: master
  • progress_bar.cr*github: tpei/progress_bar.cr, branch: master

README

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