Anji
Anji

Reputation: 73

Verify the Software via Jenkins Pipeline

stage('Verfiy Software') {
      dir('sudo /opt/tomcat/apache/bin/') {
       sh './version.sh'

I am running tomcat in Ubuntu box, and its installed following path location /opt/tomcat/apache/. I have created pipeline script to verify tomcat version and i am referring bin location to get the tomcat version, but unfortunately i am getting below error message.

[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Verfiy Software)
[Pipeline] dir
Running in /var/lib/jenkins/workspace/project/sudo /opt/tomcat/apache/bin/version.sh
[Pipeline] {
[Pipeline] sh
+ ./version.sh
/var/lib/jenkins/workspace/project/sudo /opt/tomcat/apache/bin/version.sh@tmp/durable-5c73b35b/script.sh: 1: /var/lib/jenkins/workspace/project/sudo /opt/tomcat/apache/bin/version.sh@tmp/durable-5c73b35b/script.sh: ./version.sh: not found
[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 127
Finished: FAILURE

can you please help me on this.

Upvotes: 0

Views: 31

Answers (1)

Joao  Vitorino
Joao Vitorino

Reputation: 3256

You need sudo only to run version.sh.

stage('Verfiy Software') {
     sh 'sudo /opt/tomcat/apache/bin/version.sh'

Upvotes: 1

Related Questions