Dynamic config with scheduled jobs

Hi! I’m using dynamic config like that :

And I don’t know why my schedules jobs stoped running. Can someone explain me why?

Hi @mankut14 – thanks for the question, happy to help here!

At the moment the “Scheduled Workflow” feature, where you set schedules in your configuration file, doesn’t work with the dynamic config feature.

However, we just released “Scheduled Pipelines” which does work with the Dynamic Config setup:

Essentially you’ll need to port over your previous schedules you had set in your configuration file to be “Scheduled Pipelines” via the API – you should then see your schedules continue.

Historically, here is some information around why it didn’t work and a previous workaround, though moving forward “Scheduled Pipelines” is the fix here:

Hope the above helps!
-Nick

Thanks for answer. I got something like that:
.circleci/config.yml

version: 2.1
setup: true
orbs:
  path-filtering: circleci/path-filtering@0.0.3
workflows:
  setup:
    jobs:
      - path-filtering/filter:
          base-revision: master
          mapping: |
            dir1/.* run_workflow1 true
            dir2/.* run_workflow2 true
          config-path: .circleci/workflows.yml

.circleci/workflows.yml
I got all jobs, all workflows, and scheduled jobs. my scheduled pipeline example is:


  run_tests:
    when:
      and:
        - equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
        - equal: [ "test_scheduled_pipeline", << pipeline.schedule.name >> ]

and curl:

curl --location --request POST 'https://circleci.com/api/v2/project/xxx/schedule' \
--header 'circle-token: <TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "run_tests",
    "description": "some description",
    "attribution-actor": "system",
    "parameters": {
      "branch": "my_feature_test_branch"
    },
    "timetable": {
        "per-hour": 3,
        "hours-of-day": [1,15],
        "days-of-week": ["MON", "WED"]
    }
}'

And that’s it? how can I trigger it manually or test it some other way? Should I add parameter I’m my “workflows.yml”?

Hi @mankut14 – happy to help further here.

The schedule will actually need to be at the top level config.yml instead of in your workflows.yml, I am not sure which jobs you were going to run in the “run_tests” workflow, but this is roughly what the setup would look like:

version: 2.1
setup: true
orbs:
  path-filtering: circleci/path-filtering@0.0.3
workflows:
  setup:
    when:
      not:
        equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
    jobs:
      - path-filtering/filter:
          base-revision: master
          mapping: |
            dir1/.* run_workflow1 true
            dir2/.* run_workflow2 true
          config-path: .circleci/workflows.yml
  run_tests:
    when:
      and:
        - equal: [ scheduled_pipeline, << pipeline.trigger_source >> ]
        - equal: [ "run_tests", << pipeline.schedule.name >> ]
    jobs:
      - test

Then you’ll replace:

    jobs:
      - test

With the jobs you want to execute. With the above when the schedule you set up triggers it would execute the run_tests workflow. Otherwise, all other commits will execute the setup workflow.

Hope that helps!