Deactivating and reactivating a scheduled pipeline results in an incorrect next run time

Summary

  • Scheduled pipelines display the expected Next Run time on the scheduled pipelines page
  • If a scheduled pipeline is deactivated and then reactivated, the Next Run field will still show the old expected Next Run time (even if it has passed)
  • The scheduled pipeline will still execute upon the next actual expected Run Time, and the field will resume displaying the correct Next Run time

Steps to reproduce

  1. Create a scheduled pipeline (for testing purposes I used */7 * * * * to trigger the pipeline every 7 minutes)
  2. Create it in the active state to ensure a Next Run time is displayed
  3. Deactivate the scheduled pipeline (the Next Run field should contain Inactive)
  4. Wait until after the original expected Next Run time
  5. Reactivate the scheduled pipeline
  6. The Next Run field will display the previous expected Run Time until the actual next run time elapses (so for the cron provided above, this would be 7 minutes after reactivation)
  • After the actual Next Run time, the Next Run field will resume displaying the correct Next Run value

Example Project

  • I tested this in my ultimate sandbox, using the following .gitlab-ci.yml file:
test-job:
  script:
    - echo "test-job"

With the scheduled pipeline cron set to */7 * * * *

What is the current bug behavior?

  • The Next Run field displays the incorrect time for the next scheduled pipeline execution

What is the expected correct behavior?

  • Upon reactivation the scheduled pipeline Next Run value should be regenerated and the field should display the correct predicated execution time

Possible fixes

Assignee Loading
Time tracking Loading