Display job metadata in CICD admin pages
What does this MR do and why?
Introduce read_build_metadata ability to grant users minimal read access to a build's information.
This ability can be granted to users to allow them to see minimal information
about a build (e.g. duration, finished_at, id, etc.) even without membership to
the build's project (membership grants read_build ability).
read_build_metadata is currently enabled for a user when any of the following conditions are met:
- user can
read_build - user can
read_admin_cicd- purpose: in admin area, the user will be able to see minimal information of a build (of a project the user is not a member of)
References
- Adjust views so that only allowed components an... (#525077 - closed)
- Display group, project, pipeline, build, commit... (#521119 - closed)
- read_admin_cicd: Hide projects assigned to proj... (#517905 - closed)
Screenshots or screen recordings
| Page | User: Admin | User: Non-admin w/ read_admin_cicd custom admin role |
|---|---|---|
| Admin Jobs page |
Note: Pointed elements are links
|
Note: Pointed elements are plain text
|
| Admin runner details page | ![]() |
![]() |
How to set up and validate locally
-
Enable feature flag
$ rails c > Feature.enable(:custom_admin_roles) -
Create a new admin member role with
read_admin_cicdpermission enabled> admin_member_role = MemberRole.create(name: 'Test', description: 'Test', read_admin_cicd: true) -
Assign the new admin role to a non-admin user
> user = User.find(<a_user_id>) > Users::UserMemberRole.create(member_role: admin_member_role, user: user)` -
Login with the user
-
Click global search in left sidebar ("Search or go to"). Click "Admin area" menu item.
-
In
/admin/jobspage, find a job for a project the current user is not a member ofOr, create one with the following commands in Rails console:
> p = FactoryBot.create(:project, namespace: FactoryBot.create(:namespace, name: 'unique namespace name laksjdf')) > > FactoryBot.create(:ci_build, :success, project: p) -
Verify that the status, ref, and commit values are displayed as plain text instead of links
-
Click on the job's runner to visit the runner details page. Click on Jobs tab then verify that the status, job, project, and commit columns values are displayed as plain text instead of links
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.




