How can I disable a cron job on PR environment?

Project id: 8eeaf105-a438-44c0-9215-78f268bcf4a9.
8 Replies
Percy
Percy3mo ago
Project ID: 8eeaf105-a438-44c0-9215-78f268bcf4a9
Raz | Ooga
Raz | OogaOP3mo 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
Brody
Brody3mo 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
Raz | Ooga
Raz | OogaOP3mo 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? or is there another way of excluding this service from existing on a PR environment?
Brody
Brody3mo ago
it looks like you already know how to use environment overwrites, but here are the docs for them - https://docs.railway.app/reference/config-as-code#setting-environment-overrides maybe you could base your pr env off of an env that doesnt have the cron services?
Raz | Ooga
Raz | OogaOP3mo 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 ?
Brody
Brody3mo ago
yes it should, why does it fail but also, did you try my suggestion?
Raz | Ooga
Raz | OogaOP3mo 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
Want results from more Discord servers?
Add your server