We’re in the process of evaluating if V2 of scm-manager will meet our current needs and requirements. This is running on a Rhel based Linux server. I was able to upgrade a test instance and everything seems to work ok so far, however I’m running into an issue with server-side hooks. We use these extensively for multiple functions and in V2 it seems that the repo names are now hashed. This makes it extremely difficult to identify a repo and deploy or update the existing hooks.
I’m not entirely sure what the purpose of the switch to hashed repo names serves on the file system, since the metadata.xml is still readable, but that is an extremely cumbersome and time consuming way of identifying repositories and does not allow for automating hook tasks, without looping through 100s or repos in our case.
Anything I might be missing with regard to either identifying repos on the filesystem easily, or different approach to working with server hooks?
welcome to our community!
We’ve probably an idea for a solution. A plugin with symbolic links could do the job. Since this is the first time that we hear this requirement we would encourage you to develop the plugin on your own: Development of External Plugins
If you have question we can support you in developing your own plugin.
Alternatively you could commission us to develop the plugin for you. If so please let me know.
Thank you for the response and the tip about using symlinks. While I won’t have the time to develop a plugin for the community, I was able to write a simple script to do exactly what we need using symlinks. If anyone else runs into this issue and there isn’t a plugin out by then, feel free to use this method. Always try it first in a test environment and verify/adjust it as needed:
#!/bin/bash #Enable recursive globbing with ** in bash. shopt -s globstar #Extract the folder name and repo name using the metadata.xml file.Change the path to your repositories if its different from the default. for file in "/var/lib/scm/repositories"/**/metadata.xml do #Extract the last folder from each repo directory containing metadata.xml file. That's the random generated directory name in SCM v2. dir="$(basename "$(dirname "$file")")" #Extract the repo name from each metadata.xml file. Get the value on line 6 between the xml name tags. repo="$(sed -n '6s:.*<name>\(.*\)</name>.*:\1:p' "$file")" #Create the symlink. You can change the values here if you want your symlinks to be in a different folder from the actual repos. Also adjust the paths based on your repositories folder location if different from default. ln -s /var/lib/scm/repositories/$dir /var/lib/scm/repositories/$repo done
Thank you @danlawit for your contribution and sharing your knowledge with the community!
Great to see that you have found a workaround!
May I ask why do you think that plugin development is too time consuming? Is there something we could optimize?