How can I disable a cron job on PR environment?
razvanparaschiv
PROOP

2 years ago

Project id: 8eeaf105-a438-44c0-9215-78f268bcf4a9.

Closed

11 Replies

razvanparaschiv
PROOP

2 years ago

[build]

builder = "DOCKERFILE"

dockerfilePath = "./cron/router-stats/Dockerfile"

watchPatterns = ["cron/", "packages/", "!/*.md", "bun.lockb", "package.json"]

[deploy]

cronSchedule = "0 * * * *"

region = "europe-west4"

[environments.pr.deploy]

cronSchedule = "null"

cronSchedule = ""

none works. They both still deploy the service


2 years ago

the service is still going to be deployed, just not as a cron service.

you would also need to overwrite the build and start commands to noop type commands so nothing is ever run


razvanparaschiv
PROOP

2 years ago

hey Brody! Thanks for your answer could you please give me an example or at least point me to the docs where I can find this?


razvanparaschiv
PROOP

2 years ago

or is there another way of excluding this service from existing on a PR environment?


2 years ago

it looks like you already know how to use environment overwrites, but here are the docs for them -


2 years ago

maybe you could base your pr env off of an env that doesnt have the cron services?


razvanparaschiv
PROOP

2 years ago

I tried doing this:

[build]

builder = "DOCKERFILE"

dockerfilePath = "./cron/router-stats/Dockerfile"

watchPatterns = ["cron/", "packages/", "!/*.md", "bun.lockb", "package.json"]

[deploy]

cronSchedule = "0 * * * *"

region = "europe-west4"

[environments.pr.deploy]

cronSchedule = ""

startCommand = "echo skipping service execution on PR environments"

This makes the container fail for some reason. Shouldn't it override the startCommand of the Docker entry point command ?


razvanparaschiv
PROOP

2 years ago

I tried doing this:

[build]

builder = "DOCKERFILE"

dockerfilePath = "./cron/router-stats/Dockerfile"

watchPatterns = ["cron/", "packages/", "!/.md", "bun.lockb", "package.json"]

[deploy]

cronSchedule = "0 * * *"

region = "europe-west4"

[environments.pr.deploy]

cronSchedule = ""

startCommand = "echo skipping service execution on PR environments"

This makes the container fail for some reason. Shouldn't it override the startCommand of the Docker entry point command ?


2 years ago

yes it should, why does it fail


2 years ago

but also, did you try my suggestion?


razvanparaschiv
PROOP

2 years ago

of having multiple environments? I tried it but I don't like it because I will have to constantly maintain that environment as well


Welcome!

Sign in to your Railway account to join the conversation.

Loading...