Branch Filtering using regex, jira ticket name

I’m trying to filter to make sure the branch has a jira ticket name in it. The ticket name can be anywhere in the branch name.

      - uploadToJira:
          requires:
            - testDebug
            - testRelease
          filters:
            branches:
              only: /.*(jira|JIRA)-\d+.*/

This should match names like feature-JIRA-18889-test or bug-JIRA-2344 or jira-1233, but it does not seem to do so. What am I doing wrong?

I can’t get any filtering by regex to work at all:

$ git branch | grep '*'
* feature-JIRA-10377-automate-release-and-testing-apk-process

config.yml:

workflows:
  version: 2
  buildAndTest:
    jobs:
      - setupEnvironment
      - assembleDebug:
          requires:
            - setupEnvironment
      - assembleRelease:
          requires:
            - setupEnvironment
      - testDebug:
          requires:
            - assembleDebug
      - testRelease:
          requires:
            - assembleRelease
      - uploadToJira:
          requires:
            - testDebug
            - testRelease
          filters:
            branches:
              only: /^feature.*$/

I’ve tried various regex with no success, including:

  • /feature.*/
  • /^feature.*/
  • /^f.*/

What does work is this /^pull.*/, which tells me it is not trying to match on the real branch name, rather, it’s trying to match on pull/348, which does not seem correct at all.

Cross posted here: