KohlsTechnology/git2consul-go

Failure to start after initial configuration error

Closed this issue · 6 comments

What version of git2consul-go are you using?

$ git2consul -version
git2consul, version v0.1.1 (branch: HEAD, revision: abdf3a1d746539f08ce5122f9d7db43ae4e79afd)
build date: 20200106-19:50:06
go version: go1.13.5

Does this issue reproduce with the latest release?
Yes

What operating system and processor architecture are you using (uname -a)?

uname -a Output
$ uname -a
Darwin Charlie-Jones 18.7.0 Darwin Kernel Version 18.7.0: Sat Oct 12 00:02:19 PDT 2019; root:xnu-4903.278.12~1/RELEASE_X86_64 x86_64

What did you do?

1 - Create a config with an invalid url (note https in url):

{
  "repos": [
    {
      "name": "test",
      "url": "https://github.com/ryanbreen/git2consul_data.git",
      "credentials": {
        "private_key": {
          "pk_key": "/Users/charlie/tmp/git2consul/private_key.rsa",
          "pk_username": "git"
        }
      }
    }
  ]
}

2 - Start git2consul:

git2consul -config ./config.json -debug
  INFO[0000] Starting git2consul version: v0.1.1
  INFO[0000] Setting configuration with sane defaults caller=config
 DEBUG[0000] Using configuration: {"local_store":"/var/folders/3p/rr4q161s7936_28d_9njv5m80000gp/T/","webhook":{"port":9000},"repos":[{"name":"test","url":"https://github.com/ryanbreen/git2consul_data.git","branches":["master"],"hooks":[{"type":"polling","interval":60000000000}],"source_root":"","mount_point":"","credentials":{"private_key":{"pk_key":"/Users/charlie/tmp/git2consul/private_key.rsa","pk_username":"git"}}}],"consul":{"address":"127.0.0.1:8500","ssl":false}} caller=config
 ERROR[0000] (runner): Cannot load repositories from configuration: Error loading test: invalid auth method

3 - Look in local_store (note the existance of .git directory):

ls -la /var/folders/3p/rr4q161s7936_28d_9njv5m80000gp/T/test
total 0
drwxr-xr-x   3 charlie  staff    96B Jan 30 06:55 .
drwx------@ 11 charlie  staff   352B Jan 30 06:55 ..
drwxr-xr-x   6 charlie  staff   192B Jan 30 06:55 .git

3 - Fix invalid url (note ssh in url now):

{
  "repos": [
    {
      "name": "test",
      "url": "ssh://github.com/ryanbreen/git2consul_data.git",
      "credentials": {
        "private_key": {
          "pk_key": "/Users/charlie/tmp/git2consul/private_key.rsa",
          "pk_username": "git"
        }
      }
    }
  ]
}

4 - Try to start git2consul with correct configuration (note "reference not found"):

git2consul -config ./config.json -debug
  INFO[0000] Starting git2consul version: v0.1.1
  INFO[0000] Setting configuration with sane defaults caller=config
 DEBUG[0000] Using configuration: {"local_store":"/var/folders/3p/rr4q161s7936_28d_9njv5m80000gp/T/","webhook":{"port":9000},"repos":[{"name":"test","url":"ssh://github.com/ryanbreen/git2consul_data.git","branches":["master"],"hooks":[{"type":"polling","interval":60000000000}],"source_root":"","mount_point":"","credentials":{"private_key":{"pk_key":"/Users/charlie/tmp/git2consul/private_key.rsa","pk_username":"git"}}}],"consul":{"address":"127.0.0.1:8500","ssl":false}} caller=config
  INFO[0000] Loaded repository test    caller=repository
 ERROR[0001] Runner error              error=reference not found

5 - Clear local_store, and try again with the same config, and it starts up fine:

rm -rf /var/folders/3p/rr4q161s7936_28d_9njv5m80000gp/T/test
  INFO[0000] Starting git2consul version: v0.1.1
  INFO[0000] Setting configuration with sane defaults caller=config
 DEBUG[0000] Using configuration: {"local_store":"/var/folders/3p/rr4q161s7936_28d_9njv5m80000gp/T/","webhook":{"port":9000},"repos":[{"name":"test","url":"ssh://github.com/ryanbreen/git2consul_data.git","branches":["master"],"hooks":[{"type":"polling","interval":60000000000}],"source_root":"","mount_point":"","credentials":{"private_key":{"pk_key":"/Users/charlie/tmp/git2consul/private_key.rsa","pk_username":"git"}}}],"consul":{"address":"127.0.0.1:8500","ssl":false}} caller=config
  INFO[0001] Cloned repository test    caller=repository
  INFO[0001] KV GET ref: test/master   caller=consul
 DEBUG[0001] Up to date: test/master   caller=watcher
 ...

What did you expect to see?
I expected git2consul to start up successfully after I corrected my configuration error.

What did you see instead?
git2consul errored with reference not found

Hi, I'm facing the same error.

Any updates?

Thanks

Solved after adding local_store. Eg:

{
  "local_store": "/tmp/git2consul",
  "repos": [
      [...]

I am facing the same error. The only way to fix it is to delete content of local_store directory.

Sorry guys, we've been very short handed and haven't been able to work much on git2consul. It would be extremely helpful, if one of you could send in a pull request for this.

I'm currently facing this same issue and even after deleting the local_store, it still errors thus: (runner): Cannot load repositories from configuration: Error loading : object not found

apparently, the repository is not being cloned in the local_store, any one has a similar experience, please help with your solution. Thanks !