What are the Slack Archives?
It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hey! Does anybody know, how to define if a cronjob should run on a certain environment? I see there
Hey! Does anybody know, how to define if a cronjob should run on a certain environment? I see there was a possibility to set run_on_non_production
in cronjob definitions. But this does not work anymore with scheduler module shipped by spryker. vendor/spryker/setup/src/Spryker/Zed/Setup/Business/Model/Cronjobs.php
is marked to be deprecated meanwhile and is still not used anymore.
Of course, i could check APPLICATION_ENV in config/Zed/cronjobs/jenkins.php
and set enable
accordingly. Should this be the "right" way?
Comments
-
I believe you need to switch\migrate to spryker/scheduler-jenkins where the issue with
run_on_non_production=>false
has been fixed - https://api.release.spryker.com/release-group/2637.0 -
I am already using spryker/scheduler-jenkins in version 1.2.1. There is nothing like 'run_on_non_production' or similar in the code
0 -
We have the following in jobs.php:
if (Environment::isProduction() === false) { //non production job definition }
0 -
Ya, this seems to be the only possibility. Thanks Alberto!
0 -
Although...Envíronment is also marked to be deprecated and will be removed without replacement.
0 -
Hey @UPPB2H525 👋
I think there is one more option, I didn’t not tried that myself, but looking from code should be possible:
1. You can introduce a new array property in jobs.php where you could specify an environment (or array of envs);
2. Extend the command “scheduler:setup” and introduce environment as a parameter (-e=your_env);
3. Introduce a new ChainableJobsFilterInterface that would filter out jobs based on environment parameter vs. environment in jobs.php array (\Spryker\Zed\Scheduler\Business\SchedulerBusinessFactory::createJobsFilter())
4. In respective config/install/your-environment.yml pipeline, you can call the command with the new parameter “vendor/bin/console scheduler:setup -e=your_env”0 -
it sounds like more todo comparing to @UL6DGRULR solution, but could be also a bit cleaner and more flexible. But if Alberto’s solution fully covers your needs - I would go with it
0 -
Thank you @UKJSE6T47
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random