0

I have an issue where i make a snapshot of a slave VM after is completed the slave is connected but the workspace is not refreshed in the VM.

    pipeline{
agent none
stages
{
    stage('Pre-requisites') {
        agent { label 'Master' }
       steps{
            cleanWs()   
                dir ('C:\\Users\\user\\Desktop\\Powershell_scripts'){
                stash name: "Install", includes: '**/Install*' 
                }
                // Start VM´s
        }
    }
    stage('Clean install')
    {
                agent { label 'win7'}
                stages
                {
                    stage("Snapshot clean VM")
                    {
                        steps
                        {
                            vSphere buildStep: [$class: 'RevertToSnapshot', snapshotName: 'Jenkins', vm: 'Win7'], serverName: 'VCS'
                            vSphere buildStep: [$class: 'PowerOn', timeoutInSeconds: 600, vm: 'Win7'], serverName: 'VCS'
                        echo 'waiting  for  VM to Start'
                        sleep 180
                        }
                    }
                    stage("InstallClean")
                    {
                        steps
                        {

                            script{
                            dir ('C:\\Users\\desktop'){
                                echo 'Get file from stash'
                                echo 'run script'
                                unstash name:"Install"
                            }
                        }
                        }
                    }
                }

    }
}
}

The issue is when it tries to unstash it sends an error that the file is not found

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.