Skip to content

Keep environments and environment folders separate when grouping

What does this MR do and why?

This MR prevents environments that share a name with an environment folder from being inaccessible on the project environment page

Implementation details

This was caused by grouping the SQL query by COALESCE(environment_type, name) which would group environments together if their folder name and the environment name were the same.

I've updated it to group by ID as well, so that environments that don't share a folder are not grouped together 'COALESCE(environment_type, id::text)', 'COALESCE(environment_type, name)'

Performance compared to the previous query is very similar

Old Query performance

New Query performance

Screenshots or screen recordings

image

How to set up and validate locally

  1. Create an environment named 'production' in a project
  2. Create 2 environments that live in a production folder (i.e. production/foo and production/baz)
  3. Notice how the folder and original environment are listed separately on the project environments page

MR acceptance checklist

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

Related to #28701 (closed)

Edited by Allen Cook

Merge request reports

Loading