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

patterns arg not being evaluated by the DSL plugin

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Not A Defect
    • Component/s: ws-cleanup-plugin
    • Labels:
      None
    • Environment:
      Jenkins ver. 2.73.3, Workspace Cleanup Plugin 0.34
      and
      Jenkins ver. 2.176.3, Workspace Cleanup Plugin 0.37
    • Similar Issues:

      Description

      This snippet compiles correctly, but the pattern is not included in ws-cleanup's box in the job config GUI:

      job.publishers {
          cleanWs {
              cleanWhenAborted(true)
              cleanWhenFailure(true)
              cleanWhenNotBuilt(true)
              cleanWhenSuccess(true)
              cleanWhenUnstable(true)
              deleteDirs(true)
              patterns: [
                  [
                      pattern: '.propsfile',
                      type: 'EXCLUDE'
                  ]
              ]
          }
      }
      

      Thank you for the help!

        Attachments

          Activity

          Hide
          drewsonos Drew Waranis added a comment -

          Any update here? This is blocking work.

          Show
          drewsonos Drew Waranis added a comment - Any update here? This is blocking work.
          Hide
          olivergondza Oliver Gondža added a comment - - edited

          Thanks for the report! Have this syntax ever worked? Where did you get that?

          The DSL reference generated on my instance suggests something like:

          patterns {
              pattern {
                  pattern(String value)
                  type(String value)
              }
          } 
          

          Which I have not made to work either.

          Show
          olivergondza Oliver Gondža added a comment - - edited Thanks for the report! Have this syntax ever worked? Where did you get that? The DSL reference generated on my instance suggests something like: patterns { pattern { pattern(String value) type(String value) } } Which I have not made to work either.
          Hide
          olivergondza Oliver Gondža added a comment -

          Ok, so I have tested this syntax is accepted by job DSL plugin:

          publishers {
              cleanWs {
                  cleanWhenAborted(true)
                  cleanWhenFailure(true)
                  cleanWhenNotBuilt(false)
                  cleanWhenSuccess(true)
                  cleanWhenUnstable(true)
                  deleteDirs(true)
                  notFailBuild(true)
                  disableDeferredWipeout(true)
                  patterns {
                      pattern {
                          type('EXCLUDE')
                          pattern('.propsfile')
                      }
                      pattern {
                          type('INCLUDE')
                          pattern('.gitignore')
                      }
                  }
              }
          }
          
          Show
          olivergondza Oliver Gondža added a comment - Ok, so I have tested this syntax is accepted by job DSL plugin: publishers { cleanWs { cleanWhenAborted(true) cleanWhenFailure(true) cleanWhenNotBuilt(false) cleanWhenSuccess(true) cleanWhenUnstable(true) deleteDirs(true) notFailBuild(true) disableDeferredWipeout(true) patterns { pattern { type('EXCLUDE') pattern('.propsfile') } pattern { type('INCLUDE') pattern('.gitignore') } } } }
          Hide
          olivergondza Oliver Gondža added a comment -

          I am closing this as not a defect. Feel free to reopen in case there are some tools / docs that advise this syntax.

          Show
          olivergondza Oliver Gondža added a comment - I am closing this as not a defect. Feel free to reopen in case there are some tools / docs that advise this syntax.

            People

            Assignee:
            olivergondza Oliver Gondža
            Reporter:
            drewsonos Drew Waranis
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: