Gist for https://youtu.be/41uUsWQjKRw
def animal="cat"
node {
stage('hello') {
echo animal
animal = "dog"
}
stage('goodbye') {
echo animal
}
}
def animal="cat"
pipeline {
agent any
stages {
stage("hello") {
steps {
script {
echo animal
animal = "dog";
}
}
}
stage("goodbye") {
steps {
script {
echo animal
}
}
}
}
}
How does one consume the variable in a shell snippet?
I mean something like:
sh'''
echo ${animal}
'''