We are trying a soft migration from svn to git (GitLab) using SubGit as mirror. All works fine, except that commits to the svn repo do not trigger the GitLabs post-recive
hook correctly (I suppose).
The commit in the git repo is there, but the activity stream does not get updated afterwards, the CI pipeline does not get triggered and so on.
I can see that the post-receive
hook is called from SubGit:
[daemon][20] Executing [/var/opt/gitlab/git-
data/repositories/repo.git/hooks/post-receive]; environmentVariables=
{SVN_LAST_FETCHED_REVISION=33957, GIT_DIR=., GL_ID=user-
1};workingDirectory=/var/opt/gitlab/git-data/repositories/repo.git
(I replaced the real group/project name with repo
)
The Sidekiq logs tells me there is some problem with a GL Repository
:
WARN: ArgumentError: Invalid GL Repository "/var/opt/gitlab/git-
data/repositories/repo.git"
thrown in gitlab-rails/lib/gitlab/gl_repository.rb:10:
def self.parse(gl_repository)
match_data = /\A(project|wiki)-([1-9][0-9]*)\z/.match(gl_repository)
unless match_data
raise ArgumentError, "Invalid GL Repository \"#{gl_repository}\""
end
Grepping through the code it seems that the hook itself uses a GL_REPOSITORY
environment variable that is not set by SubGit.
I tried calling the hook manually and setting GL_REPOSITORY
to something that fulfill the regexp above ("project-13", 13 is the project id for this repo), but that leads to the a (My fault, that would have worked if I had used correct hook data)Ambiguous lookup - OID prefix is too short
exception.
So, what is the GL_REPOSITORY
environment variable, and how can I make SubGit set it?
I'm using:
- GitLab 9.4.5
- SubGit 3.2.5
Update:
I found out that GL_REPOSITORY
ist just a string project-<GitLabDBProjectId>
.
For now i placed a text file with the correct string in every repository, and adjusted the post-receive
hook itself to read out that file and use it as content instead of the GL_REPOSITORY
variable.
There was some heavy reworking in GitLab relating to the project identifiers, and it seems that SubGit didn't catch up with that changes (Bug report exists).