git-changelog-lib icon indicating copy to clipboard operation
git-changelog-lib copied to clipboard

Handle Gitlab subgroups

Open mspangdal opened this issue 6 years ago • 4 comments
trafficstars

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?

mspangdal avatar May 21 '19 13:05 mspangdal

Are you working on a PR for this @mspangdal ?

How do you use the library? Jenkins plugin?

tomasbjerre avatar May 21 '19 14:05 tomasbjerre

Yeah, Jenkins plugin. I don't have a clear idea of how to solve it yet so just looking at the code for now

mspangdal avatar May 21 '19 14:05 mspangdal

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...
  """

tomasbjerre avatar May 21 '19 14:05 tomasbjerre

Thats a good point, quick way forward!

mspangdal avatar May 21 '19 14:05 mspangdal