git-changelog-lib
git-changelog-lib copied to clipboard
Handle Gitlab subgroups
The {{ownerName}} and {{repoName}} doesn't seem to be correctly populated given a gitlab url such as: https://gitlab.server/Group/SubGroup/Project.git
In this case ownerName is set to SubGroup and Group is ignored More on subgroups in Gitlab: https://docs.gitlab.com/ee/user/group/subgroups/
For our use case it would be sufficient if Subgroups are treated as part of the Project name ownerName is set to the parent Group as would be expected
But I suppose this introduces more edge cases where gitlab is not hosted at the root of the domain?
Are you working on a PR for this @mspangdal ?
How do you use the library? Jenkins plugin?
Yeah, Jenkins plugin. I don't have a clear idea of how to solve it yet so just looking at the code for now
Ok. When using it in Jenkins, in a pipeline, you can probably determine the group somehow using plain old groovy code. And then use that value in the template... So that Groovy will substitute that variable first, before Mustache will substitute the other variables. Something like this:
def groupName = //TODO: parse values from git clone URL here...
def changelogString = gitChangelog returnType: 'STRING',
from: [type: 'REF', value: 'git-changelog-1.50'],
to: [type: 'REF', value: 'master'],
template: """
GroupName: ${groupName}
...
Rest of the template here...
"""
Thats a good point, quick way forward!