0
votes

I added an Execute Shell build step in my jenkins job.

I need to start Oracle NoSQL shell and run some DDLs.

I wrote shell script.

#Run Client
java -jar /root/software/kv-3.2.5/lib/kvcli.jar -host localhost -port 5000

#Run scripts
plan remove-table -name PersonnelUni1To1FK -wait
plan remove-table -name HabitatUni1To1FK -wait

When I excecute the same from my teminal, it's working fine. Becuase after 1st command database shell started and remaining scripts ran over that shell.

But build failed in Jenkins.

Jenkins job console output:

+java -jar /root/software/kv-3.2.5/lib/kvcli.jar -host localhost -port 5000

kv-> + plan remove-table -name PersonnelUni1To1FK -wait /tmp/hudson2708562803834708095.sh: line 17: plan: command not found

Build step 'Execute shell' marked build as failure

Its trying to execute this all on my ubuntu shell not on database shell.

2

2 Answers

0
votes

plan is a command to be executed by the shell, right? The error message just says that it doesn't find the command, so the problem could be the setting of the PATH variable. What happens if you specify the absolute path to plan in your shell script? Alternatively, make sure that the PATH variable on Jenkins is correct.

0
votes

As a workaround,

I put all my scripts

plan remove-table -name PersonnelUni1To1FK -wait
plan remove-table -name HabitatUni1To1FK -wait

and many more...

in a file /home/dev/ons/oracle-kv-db.script

modified shell command for jenkins job

java -jar /root/software/kv-3.2.5/lib/kvcli.jar -host localhost -port 5000 < /home/dev/ons/oracle-kv-db.script

Now it does not need database shell explicitly.