Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-34204

CopyArtifacts build selector broken when using Job DSL + Promoted Builds


      Description copied from https://github.com/jenkinsci/promoted-builds-plugin/pull/88

      The issue is that jenkins ends up interpreting all configuration as 'latest successful build', regardless of how 'buildSelector' is configured. It looks like the resulting config.xml of the copyArtifacts step is incorrect. Specifically, the class of the selector is missing.

      given the following partial dsl:

      copyArtifacts('source-job') {

      { buildNumber('PROMOTED_NUMBER') }


      something like this is generated at the top level:

      <selector class="hudson.plugins.copyartifact.SpecificBuildSelector">

      but this is what is generated within promotions/actions:


      The result is Jenkins will mis-interpret the configuration as 'latest' (I'm guessing b/c it's the default class for the selector).

      I've tracked it down to hudson.plugins.promoted_builds.integrations.jobdsl.PromotionsExtensionPoint#notifyItemCreated(hudson.model.Item, javaposse.jobdsl.plugin.DslEnvironment, boolean), where the conversion to xml is performed - but I don't know enough to venture a guess as to why it works with standard dsl but not when as a promotion step.

            blackbaud_oss Mike Lueders
            blackbaud_oss Mike Lueders
            0 Vote for this issue
            2 Start watching this issue