Add new filter option runner type for jobs page in admin area
What does this MR do and why?
This MR is an addition to the work that has been done in the context of #22626 (closed) .
This MR adds the filter option runner_type
to the jobs admin page. Currently, it is only possible to filter by status. Other useful filters are disregarded in this MR.
In our organization, we also need to filter jobs based on the type of runners runner_type
. In our GitLab instance, we have deployed setup different runners that are used in various projects accross the system. Being able to filter by runner_type
helps us to investigate problems concerning the individual runner types. The use case is quite similar to being able to filter by status
.
Screenshots or screen recordings
Before | After |
---|---|
Until now, only the filter option status was available. |
Added new filter option runner_type to filter the jobs by the type of the associated runner. |
2023-06-09-gitlab-merge-request-filter-runner-type-demo-low
DB SQL queries
- The new admin jobs page is written in vue and uses the graphql api to query the jobs with certain fitlers
- This MR adds a new filter option to the graphql API which is converted / applied to the SQL queries
- The new SQL queries shows the sql query applied with the new graphql param
runnerType
- The old SQL queries shows the sql query applied without the new graphql param
runnerType
- This MR affects two sql queries:
- SQL query for job count
- SQL query to retrieve the data
Old SQL queries
SQL query for job count
SELECT COUNT(*) FROM (SELECT 1 AS one FROM "ci_builds" WHERE "ci_builds"."type" = 'Ci::Build' AND ("ci_builds"."status" IN ('success')) LIMIT 1001) subquery_for_count
https://console.postgres.ai/gitlab/gitlab-production-ci/sessions/19727/commands/64579
SQL query to retrieve the data
SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" = 'Ci::Build' ORDER BY "ci_builds"."id" DESC LIMIT 51
https://console.postgres.ai/gitlab/gitlab-production-ci/sessions/20091/commands/65551
New SQL queries
SQL query for job count
SELECT COUNT(*) FROM (SELECT 1 AS one FROM "ci_builds" INNER JOIN "ci_runners" "runner" ON "runner"."id" = "ci_builds"."runner_id" WHERE "ci_builds"."type" = 'Ci::Build' AND "runner"."runner_type" = 1 AND ("ci_builds"."status" IN ('success')) LIMIT 1001) subquery_for_count
https://console.postgres.ai/gitlab/gitlab-production-ci/sessions/19727/commands/64578
SQL query to retrieve the data
SELECT "ci_builds".* FROM "ci_builds" INNER JOIN "ci_runners" "runner" ON "runner"."id" = "ci_builds"."runner_id" WHERE "ci_builds"."type" = 'Ci::Build' AND "runner"."runner_type" = 1 ORDER BY "ci_builds"."id" DESC LIMIT 51
https://console.postgres.ai/gitlab/gitlab-production-ci/sessions/20091/commands/65836
How to set up and validate locally
- In rails console, you need to enable two feature flags
Feature.enable(:admin_jobs_vue) Feature.enable(:admin_jobs_filter_runner_type)
- Go to
Admin > CI/CD > Jobs
- Compare it to
Project > CI/CD > Jobs
- Select / deselect the filter option as you want => the url and the table should change accordingly
Other scenario
- You should also be able to visit the page http://127.0.0.1:3000/admin/jobs?statuses=SUCCESS&runnerTypes=GROUP_TYPE (as an admin user)
- Two filters from the query param in the url should have been applied automatically, i.e. status and runnerType
TODO
-
@gerardo-navarro Extend filter options for frontend -
@gerardo-navarro Extend graphql backend -
Include tests for grapphql backend -
Include tests for frontend -
Add test for Resolvers::Ci::AllJobsResolver
-
Add translation for English and German -
Finalize first commit message -
Add (ops) feature flag for job filter :runner_type
so that it can be disabled (inlcude)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR. -
Changelog entry added, if necessary -
Documentation created/updated via this MR -
Documentation reviewed by technical writer or follow-up review issue created -
Tested in all supported browsers -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the javascript style guides -
Conforms to the database guides
Related to #22626 (closed)!