I have two stages which are in same Jenkins files,The requirement is i want to stash a repository on stage('AAA') and unstash from the another kubernetes pod within stage('BBB')
I have come across a code like below, after struggling many hours, I could-not fix it.
stage('AAA') {
steps {
script {
// HERE WE CLONES MANY GIT REPOSITORIES into app directory
//Please repository is cloned to the {PWD}/app directory
}
dir('app') {
stash name: "sunnyday"
}
}
}
stage('BBB') {
agent {
kubernetes {
label "dotnet"
yaml """
apiVersion: v1
kind: Pod
metadata:
namespace: sandbox-test
spec:
containers:
- name: dotnet-core-sdk
image: mcr.microsoft.com/dotnet/core/sdk:2.2
imagePullPolicy: IfNotPresent
command:
- /bin/cat
tty: true
"""
}
}
steps {
container(name: "dotnet-core-sdk") {
unstash sunnyday
}
}
}