Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add In Review, Verified
Excerpt
hiddentrue

Use a publisher more than once. Select the execution order of the publishers. Use run conditions to decide whether a publisher should be run.

Wiki Markup
{jenkins-plugin-info:pluginId=flexible-publish}

Table of Contents
maxLevel3

Anchor
features
features

Features

...

Tip
titleAlways use Always

If you always add your Post-build Actions to Flexible publish, then not only will you be able to change the execution order afterwards, but you will have the ability to temporarily disable a publisher without losing the publishers' configuration.
You can just switch between the Always and the Never run conditions.

Gallery
includeflex-pub1.png,flex-pub3.png,flex-pub4.png,flex-pub2.png
columns4

Anchor
install
install

Install

...

In Manage Jenkins/ Script console, copy the following to see which publishers can be moved (for a job named 'My Job')

Code Block

import static org.jenkins_ci.plugins.flexible_publish.JobUpdater.*

def job = hudson.model.Hudson.instance.getItem('My Job')
list job

Or, if you like doing it the hard way ...

Code Block

org.jenkins_ci.plugins.flexible_publish.JobUpdater.list(hudson.model.Hudson.instance.getItem('My Job'))

You should see a list something like this

Code Block

Result: Enabled publishers that can be moved:
	[Publish Checkstyle analysis results]
	[Publish FindBugs analysis results]
	[Publish PMD analysis results]
	[Publish duplicate code analysis results]
	[Scan for compiler warnings]
	[Scan workspace for open tasks]
	[Publish combined analysis results]
	[Archive the artifacts]
	[Publish JUnit test result report]
	[Publish Javadoc]
	[Record fingerprints of files to track usage]
	[Git Publisher]
	[Send build artifacts over FTP]
	[Send build artifacts over SSH]
	[Send build artifacts to a windows share]

Enabled publishers that cannot be moved:
	[Aggregate downstream test results]
	[Build other projects]
	[Record Emma coverage report]
	[Report Violations]
	[E-mail Notification]

You can move a publisher into Flexible publish

Code Block

import static org.jenkins_ci.plugins.flexible_publish.JobUpdater.*

def job = hudson.model.Hudson.instance.getItem('My Job')
movePublisher job, 'Publish JUnit test result report'

...

If you like to live on the edge, and would like to move all of the publishers in one go, then ...

Code Block

import static org.jenkins_ci.plugins.flexible_publish.JobUpdater.*

def job = hudson.model.Hudson.instance.getItem('My Job')
moveAllPublishers job

...

Anchor
changelog
changelog

Anchor
caveats
caveats

How flexible publish works when a publisher fails

  • Available since flexible-publish-0.15.
  • You can specify "Execution Strategy" with which flexible publish decides how to work when a publisher fails.

    Execution Strategy

    Behavior on a failure of a publisher

    Fail at end

    Continues to run following publishers. The default behavior in flexible-publish 0.15 and later.

    Fail fast

    Doesn't run following publishers. The default behavior for flexible-publish configured in 0.13 and 0.14.1.

  • This works as followings:
    • Example configuration

      No Format
      Flexible Publish
          Condition 1
              Publisher 1
              Publisher 2
          Condition 2
              Publisher 3
      
    • When Publisher 1 fails, following publishers are handled as:

      Execution Strategy for Condition 1

      Publisher 2

      Publisher 3

      Fail at end

      Performed

      Performed

      Fail fast

      Not performed

      Performed

      • Following conditions are always performed even prior publishers failed.
      • Following publishers in a same condition is performed when the execution strategy is "Fail at end".

Limitations

Some publishers may not work with Flexible Publish.

...

Known plugins that doesn't work with Flexible Publish

Plugin

Details

Issue

Coverity Plugin

Causes NPE on execution

JENKINS-20632

Post build task

Tasks will be duplicated if a project contains multiple Post build task

JENKINS-23952

Naginator

Join Plugin

Never reruns

Ignores dependencies wrapped with Flexible publish

JENKINS-

23984

28709

Build Pipeline Plugin

"Manually Execute Downstream Project" always triggers downstream projects automatically

JENKINS-30272

Clone Workspace SCM Plugin

Doesn't show up the configured project in the list of options for selection on a consuming project

JENKINS-30567

Slack Plugin

Silently does nothing

GitHub #41

Side links are duplicated

...

Known plugins that duplicates site links in build pages with Flexible Publish

Why named "Flexible Publish" ?

  • It's often accused that "Flexible Publish plugin should have been named Conditional Publisher plugin"
  • You couldn't reorder publishers with old Jenkins (Jenkins < 1.463). Also see https://groups.google.com/forum/?fromgroups#\!topic/jenkinsci-dev/UQLvxQclyb4
  • A feature to reorder publishers was as important as a feature to launch publishers conditionally. So named "Flexible Publish".

Issues

Jira Issues
renderModestatic
columnstype;priority;key;summary
width80%
anonymoustrue
urlhttp://issues.jenkins-ci.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+JENKINS+AND+status+in+%28Open%2C+%22In+Progress%22%2C+Reopened%29+AND+component+%3D+%27flexible-publish-plugin%27

Change log

To report a bug or request an enhancement to this plugin please create a ticket in JIRA (you need to login or to sign up for an account). Also have a look on How to report an issue

Jira
serverJenkins JIRA
columnskey,type,priority,summary
maximumIssues1000
jqlQueryproject = JENKINS AND status in (Open, "In Progress", Reopened, "In Review", Verified) AND component = 'flexible-publish-plugin'
serverIddd058dce-0c66-3b77-8b09-71b1d7728747

Change log

0.15.2 (Jun 06, 2015)

  • FIXED: Conditions are evaluated for matrix parent builds even if contained publishers doesn't support aggregations (JENKINS-28585)
    • Regression in 0.15.

0.15.1 (Mar 29, 2015)

0.15 (Mar 28, 2015)

  • Introduced "Execution strategy" which controls the behavior when a publisher fails. (JENKINS-26936, JENKINS-27278)
  • The condition is evaluated only once when multiple actions in a condition (JENKINS-27171).
    • Example Configutraion

      No Format
      Flexible Publish
          Condition 1
              Publisher 1
              Publisher 2
      
    • It was evaluated like this in flexible-publish 0.14.1

      No Format
      if(Condition 1)
      {
          Publisher 1
      }
      if(Condition 1)
      {
          Publisher 2
      }
      
    • flexible-publish 0.15 now evaluates as following

      No Format
      if(Condition 1)
      {
          Publisher 1
          Publisher 2
      }
      
    • If you really need conditions evaluated for each actions, please update the configuration like this:

      No Format
      Flexible Publish
          Condition 1
              Publisher 1
          Condition 1
              Publisher 2
      

0.14.1 (Jan 17, 2015)

This is a bug fix for 0.13.
This should be released as 0.13.1, but I mistook. Sorry.

...

0.1 (07/11/2011)

  • Initial release
Info
titleQuestions, Comments, Bugs and Feature Requests

Please post questions or comments about this plugin to the Jenkins User mailing list.
To report a bug or request an enhancement to this plugin please create a ticket in JIRA.