Workflow cron schedule does not trigger on specific time of day, only runs when set to every hour or min


#1

Lets say I set my workflow schedule to run everyday at midnight, it will not trigger. Only when I set it to run every hour or every 5 mins its when it runs all three builds. I have not encountered any build errors, so not entirely sure whats going on.

version: 2
jobs:
build:
docker:
- image: circleci/node:10.14-browsers
# parallelism: 1

working_directory: ~/repo

steps:
  - checkout
  - restore_cache:
      keys:
        - v1-dependencies-{{ checksum "package.json" }}
        - v1-dependencies-

  - run: npm install

  - save_cache:
      paths:
        - node_modules
      key: v1-dependencies-{{ checksum "package.json" }}

  - run: npm test

  - store_test_results:
      path: tests/test-reports

###########################################################################
build2:
docker:
- image: circleci/node:10.14-browsers
# parallelism: 1

working_directory: ~/repo

steps:
  - checkout
  - restore_cache:
      keys:
        - v1-dependencies-{{ checksum "package.json" }}
        - v1-dependencies-

  - run: npm install

  - save_cache:
      paths:
        - node_modules
      key: v1-dependencies-{{ checksum "package.json" }}

  - run: npm run testEditor

  - store_test_results:
      path: tests/test-reports

###############################################################################
build3:
docker:
- image: circleci/node:10.14-browsers
# parallelism: 1

working_directory: ~/repo

steps:
  - checkout
  - restore_cache:
      keys:
        - v1-dependencies-{{ checksum "package.json" }}
        - v1-dependencies-

  - run: npm install

  - save_cache:
      paths:
        - node_modules
      key: v1-dependencies-{{ checksum "package.json" }}

  - run: npm run testGuru

  - store_test_results:
      path: tests/test-reports

###############################################################################
workflows:
version: 2
commit-workflow:
jobs:
- build
- build2
- build3
nightly:
triggers:
- schedule:
cron: “0 * * * *”
filters:
branches:
only:
- master

jobs:
  - build
  - build2
  - build3

#2

It looks like the formatting might be messing with things, but I only see one workflow here. Can you share the cron line that works, and the one that doesn’t so I can take a look?


#3

Yeah sure. Below is how I have it formatted in GitHub. So I had my tests running everyday @ 1am and it was working fine but then quit a couple days back. Now I have them running every hour and so far so good.

####Everyday 1am
workflows:
version: 2
commit-workflow:
jobs:
- build
- build2
- build3
nightly:
triggers:
- schedule:
cron: “0 1 * * *”
filters:
branches:
only:
- master

jobs:
  - build
  - build2
  - build3

####Every hour
workflows:
version: 2
commit-workflow:
jobs:
- build
- build2
- build3
nightly:
triggers:
- schedule:
cron: “0 * * * *”
filters:
branches:
only:
- master

jobs:
  - build
  - build2
  - build3

#4

for some reason the editor is not keeping my original formatting. below is my github.


#5

Thanks for that. Everything looks fine. Could you link me a build that should have run but didn’t? I noticed a few changes and on of them was unsupported syntax, so I wonder if it might be that.

Note: Cron step syntax (for example, */1, */20) is not supported


#6

“Note: Cron step syntax (for example, */1, */20) is not supported” Yes, I’m aware thank you.

So below is an old commit (running two builds everyday @ 1am ) that was working fine but quit working within the last week. Just quit all together, no errors.


#7

Sorry just understood your question. There are no builds to show because they are not showing up in workflows at all, no errors. Last one was 21 hours ago. I changed the .yml file ( cron: “0 16 * * *”) to run at 4pm and nothing.

https://circleci.com/workflow-run/8692ae58-18e4-4235-a143-05996c082d6c


#8

Do I need to create an individual workflow for each build? or is my configuration fine?


#9

The configuration looks fine, so I’m not sure why things aren’t running as expected. I see https://circleci.com/workflow-run/9338d6e3-f4be-4738-b7c0-1017ee265a52 ran 2 hours ago, but I’m guessing that’s not what you are looking for.

Can I ask you to open a ticket so we can dig deeper into this for you?


#10

Could it be that my builds are running on a different time zone? I set my schedule for midnight and it ran at 7pm eastern time.


#11

Workflows use UTC as the timezone.

This feature enables you to schedule a workflow run by using cron syntax to represent Coordinated Universal Time (UTC) for specified branches.

That lines up because midnight UTC is around 7PM eastern.


#12

Would you happen to know how to change the time zone?


#13

You’re not able to change the timezone. So, what you should do is convert Midnight EST to UTC and use that as the value in your configuration.


#14

Thanks Bru. I’ll leave it as and see if it runs at the same time tomorrow.


#15

This forum uses the open source Discourse software, which uses Markdown. To format code, you can either use:

  • four space indents in front of every line
  • a triple backtick on a separate line before and after your code

You are able to edit your posts here, so if you post code that is not formatted, you are still able to

go back and repair it,

like so :-)

#16

Hello, is this working now, @devdelpiero?


#17

Yes turns out it was set to UTC time, so it’s been running fine. Thanks for all your help.