Allow creating deploy keys with an expiry date

Problem

In the User Settings > SSH Keys form, users can set Expiration date to the key.

2022-12-02_17-59

However, Project > Settings > Repository > Deploy Keys form doesn't have the field yet. We need to add the same field so that we can fill keys.expires_at in the database table.

2022-12-02_18-01

Especially, this becomes problematic when a Maximum allowed lifetime for SSH keys is set on an instance. It is not possible to use deploy keys at all.

Proposal

GitLab should provide the ability to create deploy keys with an expiry date, so that users can still make use of deploy keys even if a Maximum allowed lifetime for SSH keys is set in the instance settings.

Implementation guide

Please see PoC for more details.

Testing

Workaround

In the meantime, deploy tokens might be the best alternative.

Edited by Shinya Maeda