Show when scheduled runs are turned off and block adding new schedules

What does this MR do and why?

Part of #634139. MR 4 of 6

Nothing in the triggers UI said why a scheduled flow had stopped running. With duo_scheduled_triggers_enabled off, RunFlowScheduleWorker skips the run and deliberately records no failure, so the schedule keeps showing as Active with an advancing next run time. The only way to find out was to read the logs.

This MR adds two indicators, both driven by the project's resolved duo_scheduled_triggers_enabled, so they appear whichever level turned it off.

We also block the option to add new schedules event type when the Scheduled triggers setting is off

Where What
Trigger form in the schedule section warning alert: "Scheduled automations are turned off"
Trigger list rows, both "old" and "new automation" views "Not running" badge beside the active toggle

How to set up and validate locally

Prerequisites

  • Duo Enterprise enabled
  • GDK running with all services up
  • Self Managed Local Instance

1. Checkout this branch: 634139/sq/scheduled-triggers-indicator

2. In Rails console (set up)

# Enable FFs 
Feature.enable(:ai_flow_schedules) 
Feature.enable(:autonomous_service_account_execution)

3. In GDK UI:

  • Pick a project and create a trigger with the Schedule event type while the setting is on, so there's something to observe: http://172.16.123.1:3000/test-status-bot-e63fd58e/test/-/automate/triggers/
  • Also create a second, non-scheduled trigger like mention
  • Turn the setting off at any level (instance, group or the project's ancestors)

4. (GDK UI): Trigger list with the "not running" badge in the old "Triggers" UI

  • Go to http://172.16.123.1:3000/test-status-bot-e63fd58e/test/-/automate/triggers/
  • With the setting off:
    • There's a "Scheduled automations are are turned off" page-level warning
    • The scheduled trigger's row shows a warning Not running badge, next to the schedule summary for scheduled triggers that are active.
      • Hovering it reads "Scheduled automations are turned off in GitLab Duo settings. This schedule is kept but does not run."
      • Inactive triggers do not have the warning label. Switch them on and the warning label should appear with the hovering behaviour
    • The row's active toggle stays on since the schedule is still active and still has a next run time; the badge is what tells you it won't fire.
  • The non-scheduled trigger must show no badge.
  • Turn the setting back on and reload: the badge disappears the scheduled trigger.

5. (GDK UI): Trigger list with the "not running" badge in the new "Automations UI"

  • Enable the feature flag in rails console: Feature.enable(:duo_automations)
  • Reload the triggers page.
  • Repeat step 4 and the badge appears in the same way beside the schedule summary, in the card view beside the event tokens.
  • Disable the feature flag: Feature.disable(:duo_automations)

6. (GDK UI) Trigger form: the alert

  • Open the scheduled trigger for editing, or start a new trigger and tick the Schedule event type.
  • With the setting off:
    • Verify: "Scheduled automations are turned off for this project." is present in the **Conditions" panel text.
    • Verify: No "On schedule" is available when you click "Add condition"
    • For trigger creation:
      • Verify: Under conditions, the text Scheduled automations are turned off for this project is included.
    • For trigger edit:
      • Click the pencil to edit the schedule
      • Verify:
        • Warning component/alert appears with Scheduled automations are turned off for this project. Existing schedules are kept but do not run, ...
        • Under conditions, the text Scheduled automations are turned off for this project is included.
        • Under the "Frequency" component, verify that the composite identity text appears, i.e. Scheduled automations do not use composite identity....
  • With the setting on: no alert, and the composite identity warning is unchanged in position and wording.

7. (GDK UI) The indicator follows the cascade

  • The indicators read the project's resolved value, so they should appear no matter which level turned the setting off.
    • Instance: /admin/gitlab_duo/configuration (self-managed mode), uncheck, save.
  • Group: /groups/<group>/-/settings/gitlab_duo/configuration (SaaS mode), uncheck, save.
  • Verify: In both cases, reload the triggers page and confirm the badge and alert appear.

8. (GDK UI): The indicator only appears when the setting is off

  • The indicators must never appear randomly. With the setting on, confirm:
    • No badge on any trigger, scheduled or not.
    • No alert on the trigger form.

9. (GDK UI) Scheduled event types option are unavailable when scheduled triggers setting is off for new trigger creation

  • Switch off the "Allow scheduled triggers" option in settings at the group / instance level
  • Go to the triggers page in the project: AI> Triggers> or http://172.16.123.1:3000/test-status-bot-e63fd58e/test/-/automate/triggers/new
  • Select a flow and click the "Add condition" dropdown
  • Verify: no "On a schedule" option and only "On an event" option is available
  • Turn the "Allow scheduled triggers" option again at the group / instance level
  • Create a trigger and click the "Add condition" dropdown
  • Verify: both "On a schedule" option and "On an event" option is available

10. (GDK UI) Scheduled event types option are unavailable when scheduled triggers setting is off for an existing trigger edit

  • Switch off the "Allow scheduled triggers" option in settings at the group / instance level
  • Go to the triggers list in the project: AI> Triggers> or http://172.16.123.1:3000/test-status-bot-e63fd58e/test/-/automate/triggers
  • Select an existing scheduled trigger and edit
  • Remove the existing schedule
  • Click the "Add condition" dropdown
  • Verify: no "On a schedule" option and only "On an event" option is available
  • Turn the "Allow scheduled triggers" option again at the group / instance level
  • Edit a trigger, remove the existing schedule and click the "Add condition" dropdown
  • Verify: both "On a schedule" option and "On an event" option is available

MR Stack

  1. Add duo_scheduled_triggers_enabled cascading se... (!264600 - merged)
  2. Enforce the scheduled triggers setting (!265174 - merged)
  3. Add the scheduled automations setting to the Du... (!265569 - merged)
  4. This MR
  5. Add scheduled automations setting to Projects (!266298 - merged)
  6. Exposes duo_scheduled_triggers_enabled in the p... (!267069)

References

Screenshots or screen recordings

Triggers Page (Create, Edit, List)

Automations Page (Create, Edit, List and Modal)

  • Towards the end of the video, the same user journey is shown but with a user that can't turn the setting on, prompting them to contact their admin.

U

Before After

MR acceptance checklist

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

Edited by Shola Quadri

Merge request reports

Loading
Loading