I'm getting a "command not found" error while executing the below jenkns code. Could someone please help me to solve this?
def myVariable = "foo"
pipeline {
agent none
stages {
stage ('npm publish on web package') {
agent {label 'master'}
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
script{
def pom = readMavenPom file: 'Project1/pom.xml'
sh "echo ${pom.version}"
sh 'ssh -tt [email protected] cd /opt/admin/projects/as/ && echo "${myVariable}" >/opt/automation/projects/automation_suite/.version'
}
}
}
}
}
}
Log is attached below. This is the part of the log which is related to the jenkins error.
Commit message: "fff"
[Pipeline] withEnv
[Pipeline] {
[Pipeline] tool
[Pipeline] envVarsForTool
[Pipeline] withEnv
[Pipeline] {
[Pipeline] catchError
[Pipeline] {
[Pipeline] script
[Pipeline] {
[Pipeline] sh
+ 1.1.39
/opt/software/jenkins/workspace/automation_suite/Test_Pipeline_2@tmp/durable-14b3d621/script.sh: line 1: 1.1.39: command not found
[Pipeline] }
[Pipeline] // script
[Pipeline] }
ERROR: script returned exit code 127
[Pipeline] // catchError
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
Double-check your pipeline code. The error you see can be caused by
The example you posted uses
but if this was the case, you would see something like this in the console log:
Your console log proves that it is not the case and you pass
${pom.version}
to thesh
command somewhere clearly.