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

CopyArtifacts build selector broken when using Job DSL + Promoted Builds

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: promoted-builds-plugin
    • Labels:
      None
    • Similar Issues:

      Description

      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') {
      buildSelector

      { buildNumber('PROMOTED_NUMBER') }

      }

      something like this is generated at the top level:

      <hudson.plugins.copyartifact.CopyArtifact>
      <selector class="hudson.plugins.copyartifact.SpecificBuildSelector">
      <buildNumber>PROMOTED_NUMBER</buildNumber>
      </selector>
      </hudson.plugins.copyartifact.CopyArtifact>

      but this is what is generated within promotions/actions:

      <hudson.plugins.copyartifact.CopyArtifact>
      <selector>
      <buildNumber>PROMOTED_NUMBER</buildNumber>
      </selector>
      </hudson.plugins.copyartifact.CopyArtifact>

      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.

        Attachments

          Activity

            People

            • Assignee:
              blackbaud_oss Mike Lueders
              Reporter:
              blackbaud_oss Mike Lueders
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: