Jenkins pipeline how to change to another folder
Solution 1:
You can use the dir step, example:
dir("folder") {
sh "pwd"
}
The folder
can be relative or absolute path.
Solution 2:
The dir
wrapper can wrap, any other step, and it all works inside a steps
block, for example:
steps {
sh "pwd"
dir('your-sub-directory') {
sh "pwd"
}
sh "pwd"
}
Solution 3:
Use WORKSPACE environment variable to change workspace directory.
If doing using Jenkinsfile, use following code :
dir("${env.WORKSPACE}/aQA"){
sh "pwd"
}