Skip to content

Update Infrastructure registry show.html.haml to generate a proper project path

Lee Matos requested to merge lbot-master-patch-13083 into master

What does this MR do and why?

As presented in https://gitlab.zendesk.com/agent/tickets/277500, when you naviagate to an infrastructure package, it displays an incorrect project path.

This MR changes the path generation so that it will be properly generated for subgroups. See the following code example:

irb(main):008:0> p = Project.find(5)
=> #<Project id:5 group/subgroup/project>>

irb(main):028:0> host = Gitlab.config.gitlab.host
=> "module-training.bking-terraform.gcp.gitlabsandbox.net"

# Incorrect path that assumes only one level
irb(main):031:0> puts host + "/" + p.root_ancestor.full_path
module-training.bking-terraform.gcp.gitlabsandbox.net/group
=> nil

# Correct path that works for multi level projects
irb(main):030:0> puts host + "/" + p.full_path
module-training.bking-terraform.gcp.gitlabsandbox.net/group/subgroup/project
=> nil

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports