Skip to content

gitlab.rb url malformed splitting #3351

Open
@n1md4

Description

@n1md4

Describe the Bug

My git repo for module install is called gitlab.com.some.thing and because of that when running bolt module install the url is malformed when gitlab.rb is envoked, producing something like gitlab.com/gitlab.com.example.domain. This is obviously wrong and causes a resolving error.

Expected Behavior

When presented with an url that includes gitlab.com as part of the domain name, I would like gitlab.rb to handle the domain ensuring the produced result remains gitlab.com.example.domain.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Initiate a bolt project
  2. Add a custom module to your bolt-project.yaml file, ensure git: is set to gitlab.com.some.thing/team/project.git (for example).
  3. run bolt module install

Environment

  • Version: debian package puppet-bolt 3.30.0-1jammy amd64
  • Platform: Ubuntu 22.04

Additional Context

I have a temporary work-around that bypasses this issue, but I'm statically defining the target gitlab url (in a few places), which is clearly wrong. I'm no coder though so not submitting an MR, just for notes.

In this file /opt/puppetlabs/bolt/lib/ruby/gems/2.7.0/gems/bolt-3.30.0/lib/bolt/module_installer/specs/id/gitlab.rb I changed these lines:

 26           private_class_method def self.parse_repo(git)
 27             domain = 'gitlab.com.some.thing'
 28 
 29             if git.start_with?("git@#{domain}:")
 30               git.split("git@#{domain}:").last.split('.git').first
 31             elsif git.start_with?("https://#{domain}")
 32               git.split("https://#{domain}/").last.split('.git').first
 33             end
 34           end
 43             metadata_url = "https://gitlab.com.some.thing/#{repo}/-/raw/#{ref}/metadata.json"
 65             url      = "https://gitlab.com.some.thing/api/v4/projects/#{CGI.escape(repo)}/repository/commits/#{ref}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugBug reports and fixes.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions