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

Exclusion Plugin Resources set in jobs generated from DSL do not show up on the list of declared resources inside Exclusion control panel.

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Trivial
    • Resolution: Fixed
    • Labels:
    • Environment:
    • Similar Issues:

      Description

      Used DSL script:

      freeStyleJob('Example_Exclusion_job'){
        wrappers {
            exclusionResources('first', 'second')
        }
        steps {
            criticalBlock {
                shell('echo Hello World!')
            }
        }
      }
      

      When a job generated from the above DSL script gets created, the managed resources 'first' and 'second' do not show up on the list of declared resources inside the Exclusion panel (<JENKINS_URL>/administrationpanel/. However when you enter the configuration page of said generated job and just click the Save button(without making ANY changes), they will appear on the list(the xml config of a job gets modified).

      Please note that I do have in mind the "List declared resources" list, not "List of currently allocated resources". However the currently used resources always show up properly on the list of allocated resources, even if it was started right after creation (from DSL).

      I am attaching xml config of the job generated from DSL (generated.xml) and the one after clicking the 'Save' button.

        Attachments

          Activity

          Hide
          daspilker Daniel Spilker added a comment -

          The problems seems to be upper vs lower case for the resource names. The Exclusions plugin seems to use upper case only and converts lower case to upper case when saving the config page.

          This should do:

          job('example') {
            wrappers {
              exclusionResources('FIRST', 'SECOND')
            }
            steps {
              criticalBlock {
                shell('echo Hello World!')
              }
            }
          }
          

          I will fix Job DSL so that it generates upper case names.

          Show
          daspilker Daniel Spilker added a comment - The problems seems to be upper vs lower case for the resource names. The Exclusions plugin seems to use upper case only and converts lower case to upper case when saving the config page. This should do: job( 'example' ) { wrappers { exclusionResources( 'FIRST' , 'SECOND' ) } steps { criticalBlock { shell( 'echo Hello World!' ) } } } I will fix Job DSL so that it generates upper case names.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Daniel Spilker
          Path:
          docs/Home.md
          docs/Migration.md
          job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/helpers/wrapper/WrapperContext/exclusionResources.groovy
          job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/step/StepContext.groovy
          job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/wrapper/WrapperContext.groovy
          job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/step/StepContextSpec.groovy
          job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/wrapper/WrapperContextSpec.groovy
          http://jenkins-ci.org/commit/job-dsl-plugin/d1cbde540034bf5f7689d60e5ce8771a909000d9
          Log:
          enhanced support for the Exclusion Plugin, deprecated support for older versions

          [FIXES JENKINS-36683]

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Spilker Path: docs/Home.md docs/Migration.md job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/helpers/wrapper/WrapperContext/exclusionResources.groovy job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/step/StepContext.groovy job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/wrapper/WrapperContext.groovy job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/step/StepContextSpec.groovy job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/wrapper/WrapperContextSpec.groovy http://jenkins-ci.org/commit/job-dsl-plugin/d1cbde540034bf5f7689d60e5ce8771a909000d9 Log: enhanced support for the Exclusion Plugin, deprecated support for older versions [FIXES JENKINS-36683]
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Daniel Spilker
          Path:
          docs/Home.md
          docs/Migration.md
          job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/helpers/wrapper/WrapperContext/exclusionResources.groovy
          job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/step/StepContext.groovy
          job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/wrapper/WrapperContext.groovy
          job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/step/StepContextSpec.groovy
          job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/wrapper/WrapperContextSpec.groovy
          http://jenkins-ci.org/commit/job-dsl-plugin/80b71024094058646227ffa69635ec49df732bbb
          Log:
          Merge pull request #913 from daspilker/JENKINS-36683

          JENKINS-36683 enhanced support for the Exclusion Plugin

          Compare: https://github.com/jenkinsci/job-dsl-plugin/compare/830438dc6833...80b710240940

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Spilker Path: docs/Home.md docs/Migration.md job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/helpers/wrapper/WrapperContext/exclusionResources.groovy job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/step/StepContext.groovy job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/wrapper/WrapperContext.groovy job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/step/StepContextSpec.groovy job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/wrapper/WrapperContextSpec.groovy http://jenkins-ci.org/commit/job-dsl-plugin/80b71024094058646227ffa69635ec49df732bbb Log: Merge pull request #913 from daspilker/ JENKINS-36683 JENKINS-36683 enhanced support for the Exclusion Plugin Compare: https://github.com/jenkinsci/job-dsl-plugin/compare/830438dc6833...80b710240940

            People

            • Assignee:
              daspilker Daniel Spilker
              Reporter:
              puratopadawan Alan Matuszczak
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: