在整个管道中的多个阶段中取消存储

时间:2017-03-29 14:49:57

标签: jenkins jenkins-plugins jenkins-pipeline

我在我的管道中使用stash \ unstash,并且想知道你可以在多个阶段中解冻吗?

例如:

stage('One') {
  steps {
    echo 'Stage one...'
    stash includes: 'dist/**/*', name: 'builtSources'
    dir('/some-dir/deploy') {
      unstash 'builtSources'
    }
  }
}
stage('Two') {
  steps {
    echo 'Stage two...'
    node('OtherNode') {
      dir('/some-other-dir/deploy') {
        unstash 'builtSources'
      }
    }
  }
}

那么我可以在任何一个阶段中,在以下任何一个阶段中,多次检索一个藏匿物?

1 个答案:

答案 0 :(得分:2)

是的,你绝对可以在多个阶段多次解冻文件,并充分利用它。