• 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都没有执行

  • 相关阅读:
    golang 引用相对路径package
    LiteIDE 在 Windows 下为 Go 语言添加智能提示代码补全
    C#代码实现把网页文件保存为mht文件
    AE开发中关于 “无法嵌入互操作类型.........请改用适用的接口”问题的解决方法
    Windows下visual studio code搭建golang开发环境
    Eclipse配置开发Go的插件——Goclipse
    go语言条件语句 if else
    Go语言基础:method
    GO语言基础之method
    go中的接口
  • 原文地址:https://www.cnblogs.com/landhu/p/10880321.html
Copyright © 2020-2023  润新知