2

Spring Cloud Config Framework:

I'm trying to integrate spring cloud config in java project with backend repository git which is bitbucket. Basically, I encounter two errors more frequently on different occasions.

2020-04-11 17:08:59.265  WARN 2792 --- [           main] .c.s.e.MultipleJGitEnvironmentRepository : Could not fetch remote for master remote: https://user@bitbucket.org/workspace/config-repo.git

In the above case, it uses the cached version and tomcat/undertow server start without any problems.

2020-04-11 17:09:03.774  INFO 2792 --- [           main] o.s.c.c.s.e.NativeEnvironmentRepository  : Adding property source: file:/var/folders/6m/1cgw7zvn3rsb8j5kskflhvrr0000gn/T/config-repo-2822438633438126334/api-gateway.yml
2020-04-11 17:09:03.774  INFO 2792 --- [           main] o.s.c.c.s.e.NativeEnvironmentRepository  : Adding property source: file:/var/folders/6m/1cgw7zvn3rsb8j5kskflhvrr0000gn/T/config-repo-2822438633438126334/discovery-service.yml
2020-04-11 17:09:03.775  INFO 2792 --- [           main] o.s.c.c.s.e.NativeEnvironmentRepository  : Adding property source: file:/var/folders/6m/1cgw7zvn3rsb8j5kskflhvrr0000gn/T/config-repo-2822438633438126334/config-service.yml

Git Version:

git version 2.24.0

Error 1: git-upload-pack

2020-04-11 00:00:20 - WARN Error occurred cloning to base directory.

org.eclipse.jgit.api.errors.TransportException: https://<username>@bitbucket.org/<workspace>/config-repo.git: git-upload-pack not permitted on 'https://beatles89@bitbucket.org/workspace/config-repo.git/'

Starting the spring cloud config server, and I received this error randomly. After digging into this issue, I found that git-upload-pack is not supported on bitbucket. But it was reported 2 years ago here, and suggested to revert the GIT version.

Error 2: authentication not supported

org.eclipse.jgit.api.errors.TransportException: https://bitbucket.org/user/repo.git: authentication not supported

This above error I get when hit the /refresh on actuator to get the refreshed properties from remote config repository. Sometimes it work without any errors and sometimes it throws above error.

curl localhost:8060/refresh -d {} -H "Content-Type: application/json"

Actuator Refresh Command Error:

{"timestamp":"2020-04-10T16:35:41.144+0000","status":500,"error":"Internal Server Error","message":"Request processing failed; nested exception is org.springframework.cloud.config.server.environment.NoSuchRepositoryException: Cannot clone or checkout repository: https://beatles89@bitbucket.org/augmentedcloud/ac-config-repo.git","path":"/refresh"}

Note: As a side note, I have cloned the specified repository separately for testing and it worked without any authentication issues.

Deminem
  • 672
  • 8
  • 19
  • You tell you are using git-core (the command line Git) 2.24.0, but the error message says JGit which is a Git implementation in Java and an alternative to git-core. Could you please clarify what you are using, why you tagged your question with [eclipse] and what steps are necessary to reproduce the issue? – howlger Apr 10 '20 at 21:47
  • @howlger - I have already mentioned that trying to create spring cloud config service project. Spring cloud config provides the support to fetch properties or configurations from different repositories such as file based system, git and etc. I have chosen GIT as the backend repository. Now Spring Cloud config framework uses the JGIT library org.eclipse.jgit.api internally for GIT operations. That's why I've tagged all the relevant parties to this issue. – Deminem Apr 11 '20 at 11:57
  • @howlger - Haven't said that I've this problem with Git using terminal or any other software. Original source of this problem with Spring Cloud Config framework, Bitbucket, and JGIT. It happens so frequently that I can't even start my tomcat/undertow servlet server. To make it more clarify, I'll update the original post. – Deminem Apr 11 '20 at 12:00
  • So you get these error messages from the Spring Cloud Config Server which uses JGit; Git 2.24.0 is not involved at all (at least not on your side; maybe on the remote upstream repository side), right? – howlger Apr 11 '20 at 12:22
  • @howlger - Core Git (2.24.0) is not involved. But JGit (org.eclipse.jgit.api.errors.TransportException) might does. I mentioned the Core Git, because someone else reported the same issue and the fix was revert back to earlier version of core GIT. For me core Git is working perfectly fine on mac terminal. – Deminem Apr 11 '20 at 12:53
  • @howlger - do you have any expertise on JGit or SpringCloud Config framework? – Deminem Apr 11 '20 at 12:54
  • I read the error 1 message that the bitbucket.org server interrupts the connection with the message _git-upload-pack not permitted_ (you might try `git://...` instead of `https://...`). I'm not familiar with Spring Cloud Config Server, just with JGit and Git in general. The git-core version is a bit misleading here, since git-core is not used at all. It would be more interesting to know the configuration of the Git repository and the JGit version. Also the [eclipse] tag is misleading since this issue is not related to the Eclipse IDE. – howlger Apr 11 '20 at 16:31

1 Answers1

0

Spring Cloud Config Framework

Spring Cloud Config framework basically provide git as the backend repository to fetch/load .properties from the remote/cache. You must provide the base directory definition with write permissions for git to clone/checkout the .properties from remote.

spring:
  cloud:
    config:
      server:
        git:
          basedir: ${AC_CONFIG_SERVICE_GIT_BASE_DIR}
          uri: ${AC_CONFIG_SERVICE_GIT_REMOTE_URI}
          username: ${AC_CONFIG_SERVICE_GIT_REMOTE_USER}
          password: ${AC_CONFIG_SERVICE_GIT_REMOTE_PASSWORD}
          passphrase: ${AC_CONFIG_SERVICE_GIT_REMOTE_PASSPHRASE}
          skip-ssl-validation: true
          timeout: 10

Note: Otherwise, on every server startup it will either complain for .properties with different errors or load the cached version of .properties from local repository. By default, basedir read from this location /var/tmp and spring cloud config framework is looking for the write permissions on parent directory which in this case /var - Hint: Safety Precautions Triggered.

To be on safe side and don't want to ruin your OSX, defined one of your own custom location for basedir such as /Users/<....>/Documents/tmp. Because every time, git perform the lookup on remote repository for new change and if found then it will pull down the new .properties which require deletion of previous files.

Since, I have defined the basedir not encountered any errors from the spring cloud config framework in logs.

Community
  • 1
  • 1
Deminem
  • 672
  • 8
  • 19