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

a year ago

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

11 Replies

razvanparaschiv
PROOP

a year 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


a year 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

a year 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

a year ago

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


a year ago

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


a year ago

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


razvanparaschiv
PROOP

a year 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

a year 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 ?


a year ago

yes it should, why does it fail


a year ago

but also, did you try my suggestion?


razvanparaschiv
PROOP

a year 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


Loading...