User deactivated notify and deactivate pipeline_schedules

What does this MR do and why?

This MR adds additional resolution a customer reported issue where pipeline_schedules were no longer running when users were deactivated, banned or blocked. This MR ensures that when a user state transitions to deactivated, blocked or banned, a check is performed to identify any pipeline schedules that would no longer run due to the pipeline_schedule.owner being unavailable.

  • When a user is :deactivated:

    • the check is performed in a private method on the user model
    • the owners and maintainers of the project are notified
    • the schedules are deactivated
  • When a user is :banned or :blcoked:

    • the state change triggers Ci::DropPipelinesAndDisableSchedulesForUserService
    • the check is performed in the service
    • the owners and maintainers of the project are notified
    • the schedules are deactivated

All functionality is behind a FeatureFlag :notify_pipeline_schedule_owner_unavailable

How to set up and validate locally

User Banned, Deactivated or Blocked Change

(See also Validation Steps & screen recording in the related MR !195067 (merged) )

  1. start a rails console $rails c and enable the feature flag Feature.enable(:notify_pipeline_schedule_owner_unavailable)
  2. Log into gdk as root user or super admin role
  3. Navigate to a project you own and has members
  4. Navigate to Users --> Members (ie http://gdk.test:3000/flightjs/Flight/-/project_members)
  5. click on the account of an owner (first column) who is a maintainer or owner
  6. Click on the icon to view user in admin area
  7. click button to Impersonate user
  8. While impersonating user create a scheduled pipeline on the project Project Repo view --> Build(sidebar left) --> Pipeline Schedules --> New Schedule
  9. Stop impersonating the user
  10. Navigate User admin page (http://gdk.test:3000/admin/users)
  11. Find the user you had impersonated, click 3 dots on side of row and click Block
  12. Navigate back to the Pipeline Schedules view( ie http://gdk.test:3000/flightjs/Flight/-/pipeline_schedules) and observe that the pipeline has been deactivated

Repeat for: Deactivate, Ban

Related to #548938 (closed)

Edited by Vlad Wolanyk

Merge request reports

Loading