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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.