2022-04-23

compile c++ through shell with jenkins

I'm trying to make a jenkinsfile to compile c++ file through the shell however i'm having the following error:

1.scripts/Linux-Build.sh: 5: cmake: not found

  1. scripts/Linux-Build.sh: 5: make: not found

my jenkinsfile:

    pipeline {    
          agent any  
         /*  environment {
           PATH = "${env.PATH}:/usr/bin"    }
        */ stages{
             stage('Build'){
                steps{
                 echo "Building..."
                 echo "PATH is: ${env.PATH}"
                 sh 'chmod +x scripts/Linux-Build.sh'
                 sh 'scripts/Linux-Build.sh'
          }    }    stage('Test'){
            steps{
                sh 'echo "Running..."'
                sh 'chmod +x scripts/Linux-Run.sh'
                sh 'scripts/Linux-Run.sh'
           }    
  }
}
    

Linux-Build.sh: #!/bin/sh

echo "${PATH}"

cmake . make

jenkins console output:

> git config core.sparsecheckout # timeout=10
 > git checkout -f eba9957b24cf36c5d5666036e45669ea04bea366 # timeout=10
 > git branch -a -v --no-abbrev # timeout=10
 > git branch -D master # timeout=10
 > git checkout -b master eba9957b24cf36c5d5666036e45669ea04bea366 # timeout=10
Commit message: "Update"
 > git rev-list --no-walk c712362f967199fdd279560bad38e3f26e3a5759 # timeout=10
Cleaning workspace
 > git rev-parse --verify HEAD # timeout=10
Resetting working tree
 > git reset --hard # timeout=10
 > git clean -fdx # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] echo
Building...
[Pipeline] echo
PATH is: /opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[Pipeline] sh
+ chmod +x scripts/Linux-Build.sh
[Pipeline] sh
+ scripts/Linux-Build.sh
/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
scripts/Linux-Build.sh: 6: cmake: not found
scripts/Linux-Build.sh: 7: make: not found
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Test)
Stage "Test" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 127

GitHub has been notified of this commit’s build result

Finished: FAILURE


No comments:

Post a Comment