Jenkins multiple artifacts for the same build

前端 未结 5 942
误落风尘
误落风尘 2021-01-31 13:33

Is there a way to save/archive multiple artifacts from the same build?

Jenkins only allows a single \'Archive the Artifacts\' post build step, and grey\'s out the option

相关标签:
5条回答
  • 2021-01-31 13:48

    You can use Ant-style pattern, e.g. target/*.jar to archive multiple artifacts.

    And it is possible to use a comma separated list of patterns if your files can't be matched with one pattern, e.g. target/*.jar, target/*.war.

    The ? button next to the input field reveals this info.

    0 讨论(0)
  • 2021-01-31 13:52

    You can comma separate the paths, like this:

    XXX.UnitTests\bin\Release\**.* , XXX.WriteAPI.Service/bin/Release/**.*
    

    Then you get two separate artifacts.

    See http://ant.apache.org/manual/Types/fileset.html for details of the Ant Pattern syntax.

    0 讨论(0)
  • 2021-01-31 14:06

    All the answers on here show how to combine multiple file patterns into 1 artifact which is not what the OP asked for.

    An example of what was asked for is to have something like a Single Page Web app build that has environment specific settings compiled into the JavaScript for QA, Staging and Production.

    As you would want to deploy the same build to multiple environments, you would need 3 builds, each with it's own environment settings in it. When you deploy the archive, you would not want to deploy the contents of all 3 to each environment and extract just the content for that one environment, because it is expensive to copy 66% more than is needed each time and could be error prone.

    So, it is reasonable to generate 2 or more builds into their own artifacts and deploy 1 of those artifacts, depending on the target environment.

    Jenkins should support multiple artifacts, not just making 1 artifact bigger.

    0 讨论(0)
  • 2021-01-31 14:08

    If you want to save two different types of files like zip files and html files, then you can use

    *.html,*.zip
    

    It will help you to archive all zip files and html files in that directory.

    0 讨论(0)
  • 2021-01-31 14:08

    No, jenkins does not provide only one artifact to save. You can use wild card pattern to same any number of artifacts, For example All Jars - **/*.jar All War - **/*.war and so on.

    **/ means Any directory.

    0 讨论(0)
提交回复
热议问题