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
:bannedor: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
- the state change triggers
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) )
- start a rails console
$rails cand enable the feature flagFeature.enable(:notify_pipeline_schedule_owner_unavailable) - Log into gdk as root user or super admin role
- Navigate to a project you own and has members
- Navigate to Users --> Members (ie http://gdk.test:3000/flightjs/Flight/-/project_members)
- click on the account of an owner (first column) who is a maintainer or owner
- Click on the icon to view user in admin area
- click button to Impersonate user
- While impersonating user create a scheduled pipeline on the project Project Repo view --> Build(sidebar left) --> Pipeline Schedules --> New Schedule
- Stop impersonating the user
- Navigate User admin page (http://gdk.test:3000/admin/users)
- Find the user you had impersonated, click 3 dots on side of row and click
Block - 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