Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitlab.rb url malformed splitting #3351

Open
n1md4 opened this issue Oct 10, 2024 · 1 comment
Open

gitlab.rb url malformed splitting #3351

n1md4 opened this issue Oct 10, 2024 · 1 comment
Labels
Bug Bug reports and fixes.

Comments

@n1md4
Copy link

n1md4 commented Oct 10, 2024

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}"
@n1md4 n1md4 added the Bug Bug reports and fixes. label Oct 10, 2024
@donoghuc
Copy link
Contributor

Thanks for the report. The current implementation does not handle custom gitlab domains. Adding support for that seems like a good addition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug reports and fixes.
Projects
None yet
Development

No branches or pull requests

2 participants