I\'ve been having a lot of trouble trying to get a Jenkinsfile to work. I\'ve been trying to run this test script:
#!/usr/bin/env groovy
node {
stage(\'
So it seems the reason was that the global property PATH was causing the issue. By going to Manage Jenkins -> Configure System and deleting the PATH global property solved my issue. See JENKINS-41339.
@XP84's solution worked for me. I was getting issue with running python3 on a Mac Jenkins, I added this to environment variable and it started working. Here's a screenshot if anyone was like me and was having trouble inputting the actual values in respective fields.
I tried all the above... but didn't work until I included in my steps container() for some reasons when Jenkins is trying to run the .sh file it's trying on Jenkins master, even if my agent is set up:
agent {
label "gen-java-slave"
}
Glob ENV:
environment {
PATH = "/usr/local/openjdk-11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
}
Example of a working stage:
stage('Create a Dump for Senapt Arango DB') {
steps {
container('general-container-name') {
withEnv(['PATH+EXTRA=/usr/bin/arangodump']) {
sh '''
./backup-arango-senapt.sh
'''
}
}
}