Skip to content

Add API to list all pipeline names in project

Reuben Pereira requested to merge rp/pipeline-name-list-api into master

What does this MR do and why?

Describe in detail what your merge request does and why.

Add an API to list all the unique pipeline names in a project. This API will be used (in a follow-up MR) to list pipeline names on the pipeline search bar on the frontend (for example in the search bar in https://gitlab.com/gitlab-org/gitlab/-/pipelines).

This API will be used to list pipeline names similar to how branch names are listed on the pipeline search bar: branch_name_list.

The user will then select a name from the list, and the UI will show all pipelines with the selected name. (This will be implemented in a follow-up MR)

Query:

SELECT DISTINCT "ci_pipeline_metadata"."name" FROM "ci_pipeline_metadata" WHERE "ci_pipeline_metadata"."project_id" = 278964 ORDER BY "ci_pipeline_metadata"."name" ASC LIMIT 20 OFFSET 0

Query performance:

Migration:

main: == 20230309083722 AddProjectIdPipelineNameIndex: migrating ====================
main: -- transaction_open?()
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.6279s
main: -- index_exists?(:ci_pipeline_metadata, "project_id, name text_pattern_ops", {:name=>"index_ci_pipeline_metadata_on_project_id_name_text_pattern", :algorithm=>:concurrently})
main:    -> 0.0198s
main: -- add_index(:ci_pipeline_metadata, "project_id, name text_pattern_ops", {:name=>"index_ci_pipeline_metadata_on_project_id_name_text_pattern", :algorithm=>:concurrently})
main:    -> 0.0128s
main: == 20230309083722 AddProjectIdPipelineNameIndex: migrated (0.8542s) ===========

Revert migration:

main: == 20230309083722 AddProjectIdPipelineNameIndex: reverting ====================
main: -- transaction_open?()
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0499s
main: -- indexes(:ci_pipeline_metadata)
main:    -> 0.0098s
main: -- remove_index(:ci_pipeline_metadata, {:algorithm=>:concurrently, :name=>"index_ci_pipeline_metadata_on_project_id_name_text_pattern"})
main:    -> 0.0032s
main: == 20230309083722 AddProjectIdPipelineNameIndex: reverted (0.0879s) ===========

#376097

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

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.

Edited by Reuben Pereira

Merge request reports