pipeline {
agent {label 'master'}
parameters {
string(name: 'string1', defaultValue: 's1', description: 's1')
choice(name: 'CHOICES', choices: ['one', 'two', 'three'], description: 'chose')
password(name: 'password', defaultValue: 'SECRET', description: 'password')
}
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"
}
}
}
}
Day: June 5, 2021
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"
}
}
}
}