Jenkins stash and unstash

pipeline {
    agent {label 'master'}
    stages{
        stage('one'){
            steps{
                sh "echo abc > abc.txt"
                stash includes: 'abc.txt', name: 'abc'
                sh "rm -rf abc.txt"
            }
        }
        stage('two'){
            steps{
                unstash 'abc'
                sh "cat abc.txt"
            }
        }
    }
}

Published by

Leave a Reply

Your email address will not be published. Required fields are marked *