Skip to content

Add Read only Deploy keys to /api/v4/deploy_keys

Proposal

According to https://docs.gitlab.com/ee/api/deploy_keys.html There is an endpoint to be able to list all the Deploy keys configure within the instance, including which projects they have write access to. Surprisingly enough, while the UI shows both Read only and Write Deploy keys, there is no way to usi the REST API to retrieve this information.

The only way that would not require to make many API calls and derive this list is to directly use gitlab-rails with something like this:

id = DeployKey.find_by(fingerprint_sha256: 'put the fingerprint here').id
Project.find_each {|project|
  puts project.full_path if project.deploy_key_ids.include? id
}

Similar to projects_with_write_access, I would like to suggest adding projects_with_read_access to the response given by /api/v4/deploy_keys.

Implementation guide

See the diff in #390283 (comment 1318786600)

Edited by Viktor Nagy (GitLab)