Search code examples
jenkins-pipelinejenkins-pluginsartifactory

Artifactory plugin for Jenkins Pipeline saving files in Artifactory like folder structure


The question is if this is the expected behavior when downloading an artifact, given that:

pattern: "Repository/Modules/SoftwareName/Number/file.zip" target: "folderInWorkspace/"

Result the file is downloaded in: folderInWorkspace/Repository/Modules/SoftwareName/Number/file.zip

Expected result: folderInWorkspace/file.zip

If that is the expected behavior can this be changed to the desired behavior?

I tried specifing the file in target like: target: "folderinWorkspace/file.zip" but this gives the same result.


Solution

  • This is indeed the expected behavior.

    Jenkins Artifactory plugin preserves by default the directory structure in Artifactory.

    In order to change that behavior, add flat: "true" to the file spec:

      "pattern": "Repository/Modules/SoftwareName/Number/file.zip",
      "target": "folderInWorkspace/",
      "flat": "true"
    

    For more information see: Download spec schema.