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?
Make sure fpm is in /usr/bin..
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.
Related
I have a problem when running container_run_and_commit_layer, the error message I get is
docker not found; do you need to manually configure the docker toolchain?
from what I see this is related to DOCKER variable not set:
# Resolve the docker tool path
DOCKER=""
DOCKER_FLAGS=""
if [[ -z "$DOCKER" ]]; then
echo >&2 "error: docker not found; do you need to manually configure the docker toolchain?"
exit 1
fi
I'm calling container_repositories() in my workspace file, am I missing something?
That rule requires Docker to be installed. By default, it expects to find docker via $PATH. When it doesn't, you get that error.
The Setup section of the rules_docker documentation lists all the optional tools, and shows how to set custom paths to them. Some of the rules_docker rules don't need any of those, so they'll work fine. The rules which do need those tools give errors like this when run when the given tools aren't installed.
If you install docker now, you might have to bazel clean --expunge after installing it to ensure the repository rule is evaluated again.
I'm trying to get a Jenkins job to run sfdx force:data:soql:query commands in order to migrate configuration data sets between our production org and our sandboxes after a refresh. Certain configurations do not persist on a refresh so we need a way to move that data.
Running the queries from the command line on the Jenkins server work as expected, however the job when it runs fails with the following error:
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
Build step 'Execute shell' marked build as failure
The job does three things:
Authorizes to the DevHub, lists out the connected orgs, and then performs a SQOL query to just print some data - 16 lines to be exact. Here are the commands in the shell script of the job:
sfdx force:auth:jwt:grant -i ${CONNECTED_APP_CONSUMER_KEY} -u ${DEV_HUB} -f ${JENKINS_HOME}/certs/prod/server.key -r [...] -a DevHub
sfdx force:org:list
sfdx force:data:soql:query -u ${DEV_HUB} -q "SELECT Id, Name FROM [...tablename...]" -r human
I am completely stumped on why this is happening. Again, running the SOQL command directly on the server through PowerShell or Command Line works as expected. I would appreciate any help with this.
This one stumped me for a long time but we finally got it figured out.
If you are seeing this error, make sure to check your machine's environmental variables. I saw a TON of other answers pointing to this as the issue where the install of SFDX path name had spaces in it as in C:|P:rogram Files\SFDX\bin but only showed some weird command line FOR loop that made no sense what so ever.
What we did was to completely uninstall all of SFDX making sure none of it was left on the machine and reinstalled into a folder we made where there was no spaces in the path name.
Once we did that, our job worked like it was supposed to. I hope this helps others who run into this same issue.
Hey in Jenkins I'm trying to run robot framework tests:
with command python3 robot -d results mytestsuite.robot, and it has some line to open chrome browser, but the message in log shows me typical: WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see...
Everything works ok locally, and I'm not sure which PATH jenkins wants to use so my questions are:
why do I have to input python3 instead of python (with just python in command it tells me that robot is not found)
why chromedriver is not found, and how to set it up (in what PATH and how) to make it work
Is it possible to set jenkins up to use other drivers ex. geckodriver?
My jenkins job env looks like this:
#!/bin/bash
echo $JENKINS_HOME
which python3
echo $PATH
outputs:
/Users/MYUSER/.jenkins
/usr/bin/python3
/Users/MYUSER/.jenkins/tools/chromedriver:/usr/bin:/bin:/usr/sbin:/sbin
Ok so I've fixed it with:
export PATH=/Library/Frameworks/Python.framework/Versions/3.9/bin/:$PATH
this is the location where I have chromedriver locally.
in the build shell execute but is there a way to make it more permanent (I mean not to use it every time it runs build?)
I have installed gems binary at two places on my jenkins server, each is different version:
[myserver]$ /opt/chef/embedded/bin/gem --version
2.4.1
[myserver]$ /opt/chefdk/embedded/bin/gem --version
2.4.4
I am running a job on this jenkins server with following command : /opt/chefdk/embedded/bin/gem inabox
and I get an error saying :
ERROR: While executing gem ... (Gem::CommandLineError)
Unknown command inabox
However when i run the same command from the command line , it identifies the inabox option.
To debug , when I ran this command /opt/chefdk/embedded/bin/gem help commands from the console and command line the options available are different and the console output doesnt include "inabox" option.
To make sure that I use the correct binary , I have also exported the binary path : PATH=$PATH:/opt/chefdk/embedded/bin in the job , but that also doesnt solve any thing.
I suspect that for some reason , /opt/chef/embedded/bin/gem binary is getting executed instead of /opt/chefdk/embedded/bin/gem , but I am not sure how and how do I solve it. Any pointers?
EDIT1
Here is output of echo $PATH
Here is the output of the command when I run through Jenkins console : /opt/chefdk/embedded/bin/gem help commands
Here is the output of the command when I run through command line :
1) Restart Jenkins every time you make changes to environment variables
2) if jenkins is executing the code on a slave, you need to define the PATH in your Jenkins settings.
We identified that a GEM_PATH variable being injected into the Jenkins job was causing the gem command to not work as intended. To resolve the issue, we added the “unset GEM_PATH” line to the beginning of the shell portion of the Build steps. This allowed the gem command to again recognize the “inabox” option and successfully upload gems to the Ruby Gems server.
When I run parallelshell command (I installed parallelshell using npm install -g parallelshell), on the server, it works. But when Jenkins runs the command, I get the error, parallelshell command not found.
Why is Jenkins not recognizing the command? the command works for me when I log into the server.
Jenkins may be running under different user(That is default in Windows service, or linux installations). This will have different path variable and other user-specific settings.
You must give absolute path to command.