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

Unable to create spec-based Artifactory publisher via Job DSL

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • artifactory-plugin
    • None

      When using the Job DSL plugin to script the definition of a job, it is currently not possible to add a generic Artifactory publisher which uses an inline spec script. From what I can tell the underlying problem is that both filePath and spec parameters are both mandatory when defining the uploadSpec DSL block, and when the former is defined - even if it is defined with an empty string - the latter parameter is ignored. However since both are mandatory parameters you can't omit the one you don't want.

      So, for example, the flowing DSL snippet shows how the upload spec must be defined due to the mandatory parameters:

      artifactoryGenericConfigurator {
        ..... // other config options here, too verbose to mention
        uploadSpec {
          filePath('')
          spec('{ "files": [ { "patern": "*.gz", "target": "repo/path"}]}')
        }
      }
      

      However, since the filePath property is defined it takes precidence over the spec property. Omitting the filePath property triggers a DSL parsing error something like this:

      ERROR: (script, line 72) the following options are required and must be specified: filePath

      Other than using manual configure blocks to generate the job XML directly I haven't found any way to circumvent this problem.

          [JENKINS-45158] Unable to create spec-based Artifactory publisher via Job DSL

          There are no comments yet on this issue.

            eyalbe Eyal Ben Moshe
            leedega Kevin Phillips
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: