在整个管道中分多个阶段解开藏匿处

min*_*rse 7 jenkins jenkins-plugins jenkins-pipeline

我在我的管道中使用 stash\unstash,想知道你能在多个阶段 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'
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

那么我可以在以下任何一个阶段中多次检索在早期阶段制作的藏品吗?

小智 9

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