Is there an easy way to configure post build actions for Jenkins jobs via code?
Without a way for doing so, any such actions need to be set up manually again after each instance restart/regeneration. It would be nice if this chore could be avoided.
As I see, this is not possible via the jenkins php file, although that would be the simplest. Or am I missing something…? (I hope, otherwise custom building will be the only option remaining…)
Answers
-
You can extend/override
vendor/spryker/scheduler-jenkins/src/Spryker/Zed/SchedulerJenkins/Business/TemplateGenerator/Template/jenkins-job.default.xml.twig
Depending on what you're hoping to accomplish, this may or may not work for you :)
1 -
Yep, looking at it just now, trying to find out the syntax for specifying the post build action there. Do you have any info about that, perhaps?
(I'm simply trying to chain jobs - one should start another once it's through, even if it fails.)
0 -
I did some studying before the summer holidays. Basically you can experiment in the Jenkins UI and then check the resulting job XML from e.g. http://scheduler.spryker.local/job/FI_queue-worker-start/config.xml
It is also technically possible to change the "free-style" default job template to a more flexible "pipeline" type job (which makes it easier to chain jobs and handle failures), but that makes Jenkins run out of memory real fast.
1 -
Yep, looking at the xml is what I ended up doing too (although the in-browser URL approach didn't work for me, had to use the cli), that's how I found that this is what it should look like:
<publishers> <hudson.tasks.BuildTrigger> <childProjects>{name of project to build}</childProjects> <threshold> <name>FAILURE</name> <ordinal>2</ordinal> <color>RED</color> <completeBuild>true</completeBuild> </threshold> </hudson.tasks.BuildTrigger> </publishers>
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 75 Spryker News
- 920 Developer Corner
- 780 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 34 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 25 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