Skip to content

Backend: Sort project, group, and instance CI/CD variables returned from GraphQL alphabetically by key

The problem

The CI/CD variables settings pages need to display the variables alphabetically. Sorting them on the frontend is confusing to the user because the variable requests are paginated, so the variables need to be re-sorted as each batch is loaded

Proposed solution

Add an option to return the paginated variables already sorted alphabetically

MR Implementation table

Group Issue Link
Add sorting by key to GraphQL ciVariables field !109276 (merged)

Issue Implementation table

Group Issue Link
backend #385767 (closed)
backend 👈 You are here
frontend #380873 (closed)

Usage

You can set sort: in the ciVariables field with value KEY_ASC or KEY_DESC.

e.g.

query getVariables($after: String, $first: Int = 2, $sort: CiVariableSort) {
  ciVariables(after: $after, first: $first, sort: $sort) {
...
}

Query Variables:

{"sort": "KEY_ASC"}
Edited by Mark Nuzzo