Jenkins does not recognize command sh?

后端 未结 9 1920
心在旅途
心在旅途 2020-12-09 09:27

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(\'         


        
9条回答
  •  温柔的废话
    2020-12-09 10:13

    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
                    '''
                    }
                    }
                    }
    

提交回复
热议问题