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

  • 相关阅读:
    我的友情链接
    我的友情链接
    以太坊:根据例子学习Solidity
    以太坊:安装Solidity编译器
    以太坊:入门智能合约
    以太坊:Solidity手册
    Web3 :Tech Stack Overview
    Web3 – The Decentralized Web
    去中心化金融项目汇总 Defi
    跨链技术汇总
  • 原文地址:https://www.cnblogs.com/landhu/p/10880321.html
Copyright © 2011-2022 走看看