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

CopyArtifacts build selector broken when using Job DSL + Promoted Builds

    XMLWordPrintable

    Details

    • 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

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Mike Lueders
          Path:
          src/main/java/hudson/plugins/promoted_builds/integrations/jobdsl/JobDslPromotionProcessConverter.java
          src/test/java/hudson/plugins/promoted_builds/integrations/jobdsl/PromotionsDslContextExtensionTest.java
          http://jenkins-ci.org/commit/promoted-builds-plugin/0b86ed8fe086b9a49f0d9c8b318aa47a635b6489
          Log:
          [FIXED JENKINS-34204] include node attributes when writing job dsl nodes

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mike Lueders Path: src/main/java/hudson/plugins/promoted_builds/integrations/jobdsl/JobDslPromotionProcessConverter.java src/test/java/hudson/plugins/promoted_builds/integrations/jobdsl/PromotionsDslContextExtensionTest.java http://jenkins-ci.org/commit/promoted-builds-plugin/0b86ed8fe086b9a49f0d9c8b318aa47a635b6489 Log: [FIXED JENKINS-34204] include node attributes when writing job dsl nodes
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          src/main/java/hudson/plugins/promoted_builds/integrations/jobdsl/JobDslPromotionProcessConverter.java
          src/test/java/hudson/plugins/promoted_builds/integrations/jobdsl/PromotionsDslContextExtensionTest.java
          src/test/resources/copyartifacts-example-dsl.groovy
          http://jenkins-ci.org/commit/promoted-builds-plugin/30f9c6b81d0fc6fc727a5400343e1dbcfc48eb33
          Log:
          Merge pull request #88 from Blackbaud-MikeLueders/demonstrate-copy-artifacts-dsl-issue

          [FIXED JENKINS-34204] include node attributes when writing job dsl nodes

          Compare: https://github.com/jenkinsci/promoted-builds-plugin/compare/6936b07c951a...30f9c6b81d0f

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: src/main/java/hudson/plugins/promoted_builds/integrations/jobdsl/JobDslPromotionProcessConverter.java src/test/java/hudson/plugins/promoted_builds/integrations/jobdsl/PromotionsDslContextExtensionTest.java src/test/resources/copyartifacts-example-dsl.groovy http://jenkins-ci.org/commit/promoted-builds-plugin/30f9c6b81d0fc6fc727a5400343e1dbcfc48eb33 Log: Merge pull request #88 from Blackbaud-MikeLueders/demonstrate-copy-artifacts-dsl-issue [FIXED JENKINS-34204] include node attributes when writing job dsl nodes Compare: https://github.com/jenkinsci/promoted-builds-plugin/compare/6936b07c951a...30f9c6b81d0f

            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: