zoukankan      html  css  js  c++  java
  • jenkins pipeline之stash/unstash

    在使用jenkins时,经常会问到文件怎么存储?

    正好jenkins有一个stash的功能,下面简单介绍下:

    先看看官方是怎么解释的:

    stash: Stash some files to be used later in the build
    Saves a set of files for use later in the same build, generally on another node/workspace. 
    Stashed files are not otherwise available and are generally discarded at the end of the build.
    Note that the stash and unstash steps are designed for use with small files.
    For large data transfers, use the External Workspace Manager plugin, or use an external repository manager such as Nexus or Artifactory.
    This is because stashed files are archived in a compressed TAR,
    and with large files this demands considerable on-master resources, particularly CPU time.
    There's not a hard stash size limit, but between 5-100 MB you should probably consider alternatives.

      大致翻译下就是:

       暂时将文件存储起来(具体存在哪,没看到管方解释),后需通过unstash方式调用

       但是呢:

          stash会将文件打包成一个tar包来敦促,所以大文件时会耗CPU,而且stash有文件大小限制,尽量在100M以下

    除了stash方法,还有一个archive的方法也可以存文件

    但是这二者区别是:

       stash会在pipeline任务结束后将文件全部删除,而archive会一直保存文件,且在jenkins页面上显示

    在实际使用过程中,有一点需要注意的是:

    stash只能放在最后,且只能一次,多次是不执行的,如下面方式是错误的

    stash includes: 'aa\*', name: BUILD_NUMBER
    stash includes: 'bb\*', name: bb

    实际测试中发出,只会stash aa文件夹内容,后面的bb stash都没有执行

  • 相关阅读:
    关于乔布斯,互联网上全部的视频资源有哪些
    Spring MVC 文件下载最佳实践
    HMC 的升级方法
    linux软件包合集
    9117-MMA几种具有分离背板(split backplane)功能选件的区别
    Utility Capacity on Demand(服务器按需扩容技术)
    ent en et的区别
    IBM-UK ftp资料站
    ntpd和chrony
    bosboot -a的作用
  • 原文地址:https://www.cnblogs.com/landhu/p/10880321.html
Copyright © 2011-2022 走看看