Conditional Post-Build step in Jenkins (Ideally without plugins)

吃可爱长大的小学妹 提交于 2019-12-05 12:39:40

问题


If I understand correctly I can make a build step conditional using this plugin: https://wiki.jenkins-ci.org/display/JENKINS/Conditional+BuildStep+Plugin

First does this plugin work the Post-Build steps? Second is there a way to make Post-Build steps conditional without a plugin?

The scenario I have is I am supporting both WebDriver and Selenium IDE tests with one universal Jenkins Job setup. If they have checked in either type of test it runs them. I then want it to conditionally look if any results files show up and if so then do the publish results Post-Build step, otherwise skip that step.

Currently if no results show up it simply marks the build as a failure since no test results were found.

Any suggestions would help!


回答1:


You can make any Build step execute as Post-build step.

  • Install Flexible Publish plugin
  • Install Any Build Step plugin
  • Under Configure System, look for "Flexible publish", and choose Any build step from drop-down.

The configure Job.

  • In your Job configuration, add Post-build action called "Flexible Publish".
  • Select condition.
  • Select action.



回答2:


It is posssible but it is a bit messy and can not be done with ui only.

Create the the conditional build step in the build block and save the konfiguration. Edit the xml file and move the whole conditional build step it to the post build block. Reload the jenkins configuration and it works like intended.



来源:https://stackoverflow.com/questions/26614985/conditional-post-build-step-in-jenkins-ideally-without-plugins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!