I am using Jenkins Pipline and Groovy script to download a zip on slave machine of jenkins.
Following is my code:
pipeline {
agent { label '<my slave label>' }
stage('Download') {
steps {
script {
def url = "<server url>"
def processDownload = ['bash', '-c', "curl -g -k --noproxy \"*\" -o <output-dir> \"${url}\""].execute()
processDownload.waitFor()
def processUnzip = ['bash', '-c', "7z e lwbs.zip"].execute()
processUnzip.waitFor()
}
}
}
}
I am getting following error:
Warning: Failed to create the file Warning:
output-dir/newFile.zip: No such file or directory
I have checked following:
- When I use the same
curl
command using command prompt, it run's successfully. - I have also ensured that proper user permissions are granted to allow jenkins to write to this directory.
- The directory exists and there are no spaces in the directory url
- There is enough disk space available on slave
- Server URL and certificates are correct
- Many SO but none mentions issue on
jenkins slave
Is there anything I am missing?
Any help is appreciated. Thank you.