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
sh "${myVariable}"
=>sh "foo"
? Isfoo
a valid command? – Szymon Stepniakcommand not found
does not leave any clue about which command may cause the issue. – Szymon Stepniak