Skip to content

Create todos for expiring SSH keys

Thomas Hutterer requested to merge todos_for_expiring_ssh_keys into master

What does this MR do and why?

This MR is part 2 of implementing Create todos for expiring SSH keys (#490325). Part one was Create todos for expired SSH keys (!166168 - merged).

With this MR, we now also create a todo for "expiring soon" SSH keys. So when a user gets that email, their also get a todo now.

And, this "expiring soon" todo is automatically resolved ("mark as done") when the same SSH key finally expires.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

"expiring" in Haml "expiring" in Vue "expired" and resolved in Haml "expired" and resolved in Vue
image image recording_1728917742840 recording_1728917703117

How to set up and validate locally

  • First, create a new SSH key at http://gdk.test:3000/-/user_settings/ssh_keys.
  • Now let's set its expiry date to "soon"! In the rails console:
    • Key.last.update(expires_at: 2.days.from_now)
    • SshKeys::ExpiringSoonNotificationWorker.new.perform
  • Now check your todo list, both the classic Haml version (http://gdk.test:3000/dashboard/todos) and the new Vue version (http://gdk.test:3000/dashboard/todos/vue):
    • You should see a "is expiring soon" todo for this key.
    • You should be able to filter for this new type of todo.
    • This fitler should persist in the URL. Reload to test that.
  • Now let's make that key expired! In the console again:
    • Key.last.update(expires_at: 2.days.from_now)
    • SshKeys::ExpiredNotificationWorker.new.perform
  • The last part, creating a todo for an expired key, existed before this MR, but what's new is that it auto-resolved your first "expiring soon" todo. Make sure this worked, by finding it in the Done tab of your todos.
Edited by Thomas Hutterer

Merge request reports

Loading