Thursday, October 28, 2021

[SOLVED] fpm is not recognised if executing script with jenkins and ssh

Issue

I am trying to execute a script over ssh connexion with Jenkins. I am using the SSH plugin and it is well configured. I arrive to execute the first part of the script, but when I try to execute a fpm command it says:

fpm: command not found

If I connect to the instance and run the same script that I call via Jenkins it runs and there is no error (fpm is installed).

So, I have created a test like a script test.sh:

#!/bin/bash -x 
fpm

but, with Jenkins, I get the same error: fpm: command not found, while if I execute it I get a normal "parameter needed":

Missing required -s flag. What package source did you want? {:level=>:warn}
Missing required -t flag. What package output did you want? {:level=>:warn}
No parameters given. You need to pass additional command arguments so that I know what you want to build packages from. For example, for '-s dir' you would pass a list of files and directories. For '-s gem' you would pass a one or more gems to package from. As a full example, this will make an rpm of the 'json' rubygem: `fpm -s gem -t rpm json` {:level=>:warn}
Fix the above problems, and you'll be rolling packages in no time! {:level=>:fatal}

What am I missing? Why it cannot find fpm if it is installed?


Solution

It seems that the problem came because the fpm was installed in the /home/user2connect/bin/, and the command was not recognised. For fixing this I had to call it wit the whole path:

/home/user2connect/bin/fpm ...

I have chosen to reinstall the fpm using sudo, so now it works.



Answered By - sop