Skip to content

Change the option to use scheduling instead of next_run_scheduled

Tianwen Chen requested to merge 338609-change-to-use-scheduling into master

What does this MR do and why?

This is a fix forward for !110716 (merged) to use scheduling option.

Because if next_run_scheduled is used, we will need to update all the other places and make sure they pass next_run_scheduled: true.

If we use scheduling, we only need to update only one place which is the PipelineScheduleWorker.

Screenshots or screen recordings

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

How to set up and validate locally

  1. Enable feature flag by running:
    rails runner 'Feature.enable(:ci_use_run_pipeline_schedule_worker)'
  2. create a new project 338609-test-play-button
  3. add CI config by going to CI/CD -> Editor with the following content:
    image: busybox:latest
    
    build:
      script:
        - echo "Do your build here"
        - sleep 15
  4. go to CI/CD -> Schedules and create a schedule
  5. click the Play button for the created schedule
  6. go to CI/CD -> Pipelines and check if the pipeline for this schedule is created and runs
  7. wait until the next schedule time and see if the pipeline is triggered as scheduled or run this command in Rails console to trigger it now:
    Ci::PipelineSchedule.find($ID_FOR_THE_CREATED_PIPELINE_SCHEDULE).update_columns(next_run_at: 1.day.ago)
    PipelineScheduleWorker.new.perform

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #338609 (closed)

Edited by Tianwen Chen

Merge request reports