circleci-docs icon indicating copy to clipboard operation
circleci-docs copied to clipboard

Scheduled Pipelines: can we continue to use regex branch filtering

Open GaxZE opened this issue 3 years ago • 6 comments

Missing Information

Scheduled pipelines, there is nothing stated about or examples of regex branch filters.

Already Looked

https://circleci.com/blog/using-scheduled-pipelines/ https://circleci.com/docs/2.0/scheduled-pipelines/

Potential Locations

https://circleci.com/docs/2.0/scheduled-pipelines/

GaxZE avatar Jan 07 '22 15:01 GaxZE

Thank you, @GaxZE -- we'll work on adding an example for this soon, but in the meantime here's how you'd do it for scheduled pipelines:

  • Use a when clause for the workflows in question, with a matches logic statement against the pipeline.git.branch or pipeline.git.tag pipeline value
  • If you want this to apply to just scheduled pipelines, you could do the regex match in conjunction with a check of the pipeline.trigger_source pipeline value (where the value can be webhook, api, or scheduled_pipeline).

kbatuigas avatar Jan 13 '22 21:01 kbatuigas

@kbatuigas this is not working, triggering tags is v1.0.1 and the regex should match

version: 2.1

[...]

workflows:
  [...]
  production:
    when:
      matches:
        pattern: /v[0-9]+(\.[0-9]+)*([^-])*$/
        value: << pipeline.git.tag >>
    jobs:
      - job_1
      - job_2

Outcome: image

I've read that each jobs needs to have the tag filter for them to be executed, this is not specified in the doc where you mentioned conditional workflow using when clause and is really counter intuitive when it's working fine for branches. this is mentioned deep in the doc but not in the workflow section.

CircleCI does not run workflows for tags unless you explicitly specify tag filters. Additionally, if a job requires any other jobs (directly or indirectly), you must specify tag filters for those jobs.

For instance another user being frustrated with this: https://discuss.circleci.com/t/use-of-pipeline-git-tag-in-workflows-name-when/36159/3

Maxwell2022 avatar Feb 16 '22 03:02 Maxwell2022

Hi @Maxwell2022 , thank you for the details - our engineers are helping to further investigate and we'll update this thread when we have more info.

kbatuigas avatar Feb 23 '22 21:02 kbatuigas

Also, once you add these filters to all the jobs, the breadcrumbs in the dashboard are broken because the workflow is not triggered by a branch image

Maxwell2022 avatar Feb 28 '22 04:02 Maxwell2022

Hello World, yes of course.

Plataformaalgoritmica avatar Mar 31 '22 18:03 Plataformaalgoritmica

I should've actually fully read the page. https://circleci.com/docs/scheduled-pipelines#faq

Q: Do you support regex?

A: Not currently. Scheduled pipelines require highly deterministic inputs such as a commit SHA, branch, or tag (fully qualified, no regexes) included in the webhook, API call, or schedule.

GaxZE avatar Sep 16 '22 16:09 GaxZE

I should've actually fully read the page. https://circleci.com/docs/scheduled-pipelines#faq

Q: Do you support regex?

A: Not currently. Scheduled pipelines require highly deterministic inputs such as a commit SHA, branch, or tag (fully qualified, no regexes) included in the webhook, API call, or schedule.

Hi @GaxZE - no worries, that was actually only confirmed and added to the docs after you opened the issue and my initial response to you.

kbatuigas avatar Nov 16 '22 20:11 kbatuigas

Hi @Maxwell2022 - thank you for bringing that to our attention; we have since added that information to the Workflows documentation.

With regards to the breadcrumbs, we've filed an internal ticket with our team who works on the CirceCI web UI. Thanks!

kbatuigas avatar Nov 16 '22 20:11 kbatuigas