Skip to content
Snippets Groups Projects

Expose new properties on `/deploy_keys` API endpoint

All threads resolved!

What does this MR do and why?

Makes the following changes to the /deploy_keys API endpoint:

  1. Add a public attribute that only return public deploy keys
  2. Expose the fingerprint property
  3. Expose the projects_with_write_access property

Related to #334874 (closed)

Currently the admin deploy keys table looks like this:

Screen_Shot_2021-10-25_at_4.54.48_PM

Data is passed to it from the deploy_keys_controller and it only shows projects with write access via the projects_with_write_access method.

We want to convert this table to GitLab UI so we can conform to the Pajamas designs system. We would like to use the /deploy_keys API endpoint as the data source.

For context when the table is converted to GitLab UI it will look like this:

Screen_Shot_2021-10-25_at_4.54.57_PM

Database query

This is the query that I am seeing in the performance bar: deploy_keys_perf_bar_1635206602891.json

How to set up and validate locally

  1. Navigate to /admin/deploy_keys and create two deploy tokens. You can use https://8gwifi.org/sshfunctions.jsp to quickly generate a dummy public key.
  2. Navigate to a project and then Settings -> Repository -> Deploy keys
  3. Click the Publicly accessible deploy keys tab and click Enable next to each deploy key.
  4. Navigate to the Enabled deploy keys tab. Click Edit next to each deploy key and check the Grant write permissions to this key checkbox
  5. Create a PAT in /-/profile/personal_access_tokens
  6. Run curl --header "PRIVATE-TOKEN: <your_access_token>" "http://<gdk-host>/api/v4/deploy_keys" in your terminal
  7. Click the + button in the performance bar and paste http://<gdk-host>/api/v4/deploy_keys to see the database query

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 Peter Hegman

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Peter Hegman added 108 commits

    added 108 commits

    • 53c76c3f...63f10d27 - 105 commits from branch master
    • e87dc830 - Expose new properties on `/deploy_keys` API endpoint
    • 179ac1e5 - Fix N+1 test failure on FOSS
    • f3d20462 - Switch to using lambda for conditional exposure

    Compare with previous version

  • Alishan Ladhani approved this merge request

    approved this merge request

  • Alishan Ladhani requested review from @lulalala and removed review request for @ali-gitlab

    requested review from @lulalala and removed review request for @ali-gitlab

  • :wave: @ali-gitlab, thanks for approving this merge request.

    This is the first time the merge request is approved. To ensure full test coverage, a new pipeline has been started.

    For more info, please refer to the following links:

  • Mark Chao
  • Mark Chao added 1 commit

    added 1 commit

    • cebcde55 - Test number of returned projects with write access.

    Compare with previous version

  • Peter Hegman requested review from @eread

    requested review from @eread

  • Evan Read
  • Evan Read removed review request for @eread

    removed review request for @eread

  • Peter Hegman added 471 commits

    added 471 commits

    • cebcde55...c9d4a405 - 467 commits from branch master
    • 36d4335b - Expose new properties on `/deploy_keys` API endpoint
    • 573a028f - Fix N+1 test failure on FOSS
    • 43be1987 - Switch to using lambda for conditional exposure
    • ff8453ed - Update name used in example response to match docs style guide

    Compare with previous version

  • Peter Hegman requested review from @eread

    requested review from @eread

  • Evan Read approved this merge request

    approved this merge request

  • Evan Read removed review request for @eread

    removed review request for @eread

  • Author Maintainer

    @lulalala looks like we have all required approvals now. Can you take another look at this when you have time?

  • Mark Chao resolved all threads

    resolved all threads

  • Mark Chao approved this merge request

    approved this merge request

  • Mark Chao enabled an automatic merge when the pipeline for f31a544c succeeds

    enabled an automatic merge when the pipeline for f31a544c succeeds

  • merged

  • Mark Chao mentioned in commit b420fea7

    mentioned in commit b420fea7

  • added workflowcanary label and removed workflowstaging label

  • added workflowproduction label and removed workflowcanary label

  • Please register or sign in to reply
    Loading