i got this method inside recipe
script "bashbashed" do
interpreter "bash"
user "root"
code <<-EOH
cd /my/path
ant clean
ant build
ant deploy
EOH
end
returns
localhost STDERR: /tmp/chef-script20131004-5434-823zxp: line 1: cd: tarball: No such file or directory
localhost /tmp/chef-script20131004-5434-823zxp: line 4: ant: command not found
localhost /tmp/chef-script20131004-5434-823zxp: line 5: ant: command not found
localhost /tmp/chef-script20131004-5434-823zxp: line 6: ant: command not found
login to guest and do ant -version.
ant is installed in the guest. am i still missing something here?
The error messages indicate 2 problems:
the path /my/path does not exist.
it does not contain path to your java ant installation in $PATH.
An updated version:
script "bashbashed" do
interpreter "bash"
user "root"
cwd "/my/path" # make sure this path exists
path "#{ENV['PATH']}:/opt/ant/bin" # customize to the location of your ant command
code <<-EOH
ant clean build deploy
EOH
end
Your problem is that the environment files supplied under "/etc/profile.d/*" are not sourced by the root user, this would explain why your bash script (running as root) does not have ant configured in its path.
Perhaps a simple solution would be to run the build as a normal user account?
Related
I am trying to run python test through jenkins. I have pytest framework.
I have also installed python 3.8 on jenkins slave machine and set path in the environment variables
I have added below path under PATH section of environment variable as below
C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\Scripts
C:\Users\Admin\AppData\Local\Programs\Python\Python38-32
But still I am getting below error on while running job.
Below are my windows batch command to run from Jenkins:
echo '#### Create Virtual Environment ####'
python -m venv .UIAutomation/venv
echo '#### Activate Virtual Environment ####'
echo '#### Run tests ####'
pytest -s -v --alluredir=.UIAutomation/reports ./UIAutomation/tests --env=staging --browser=chrome
Please help
More details about console error :
warning: manifest_maker: standard file '-c' not found
12:04:12 Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
Note:
Below is my first requirement from file
Collecting psycopg2==2.8.6 (from -r ./UIAutomation/requirements.txt
So after execution I am seeing below error at first line of console-
12:04:12 Error: pg_config executable not found.
12:04:12 pg_config is required to build psycopg2 from source. Please add the directory
From what I see, I find the batch call suspicious.
I think call launches a new console and returns to the script, if its done. So in your case, you activate your venv in another console and then use your standard python env, not the venv and there is no pytest dependency installed.
See also: https://ss64.com/nt/call.html
I had a similiar problem in a yaml script I wrote for Azure DevOps.
I did solve that, with creating the venv and then adding the venv path to the environment variables.
I have a problem when i try to execute php bin/phpunit from docker.
Warning: require(/user/project/bin/.phpunit/phpunit-7.5-0/vendor/composer/../symfony/phpunit-bridge/bootstrap.php): failed to open stream: No such file or directory in /user/project/bin/.phpunit/phpunit-7.5-0/vendor/composer/autoload_real.php on line 69
If i execute php bin/phpunit from terminal in my computer it works.
If i delete phpunit folder from /bin directory in symfony project and i try to execute php bin/phpunit from docker it works (after phpunit re-installation in /bin folder) on docker machine but not on my pc. Perhaps the problem is in symlink but i'm not able to solve this issue.
Please be sure that when you build your container you execute the composer install command.
If the problem still persist please share a snap of your Dockerfile
I am fairly new to Informatica. I am trying to automate deployment of Powercenter code from one environment to another using jenkins.
Script:
node('')
{
def application = 'powercenter'
stage('deploy'){
sshagent(['group']) {
sh """ssh -o StrictHostKeyChecking=no user#123.com 'cd /opt/hub/infapwc/server/bin && pmrep connect -r Repository_Service_L1 -d domain -n username -x password'"""
}
}
}
My job is failing with error: pmrep command not found. Informatica is installed on the linux server i am doing ssh in. This works fine in putty. I am not sure what the issue is. Can anyone please help?
You can use $INFA_HOME/bin to $PATH or you can use absolute path of pmrep file.
pmrep file is available in $INFA_HOME/bin. You can check with infa admin person about path.
That won't work; pmrep uses a couple of libraries which are located in the .../server/bin directory as well.
In order to make this work, please add the .../server/bin directory of the PowerCenter installation path (resp. ...\server\bin on Windows) to the PATH environment variable of the user ID which runs the Jenkins script before trying to invoke pmrep.
I did following to install jenkins on my Mac for a ruby on rails project with a rspec test suite
1- installed with brew
2 - started jenkins and installed git/rake/rvm plugins
3 - managed to run bundle exec spec after installing rails in "/Users/me/.jenkins/workspace/myp-project"
4 - But I am getting an error while running a build on jenkins interface
$ bundle exec rake spec
FATAL: rake execution failed
java.io.IOException: Cannot run program "bundle"
(in directory "/Users/me/.jenkins/workspace/my-project"): error=2, No such file or directory
any pointers how can I fix this ?
I recently faced the same issue
When running from Console everything is ok , when running from execute shell all is alright when in Jenkins the Jenkins-man simply could not execute "gem" or "bundler" or X sample :
18:20:40 Caused by: org.apache.maven.plugin.MojoExecutionException: An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "bundler" (in directory "/home/builder/lcg-qa-jenkins-slave/workspace/delete_me2/target/src/main"): error=2, No such file or directory
18:20:40 around Ant part ...<exec failonerror="false" dir="target/src/main" executable="bundler">... # 78:76 in /home/builder/lcg-qa-jenkins-slave/workspace/delete_me2/target/antrun/build-main.xml
The error is totally misleading as the files do exist but for some weird reason cannot pick up executable stuff from /.rbenv/shims.
I tried uninstalling - reinstalling through numerous official and unofficial rbenv or rvm and each time got the same issue with Jenkins.
Note that this only occurs on Jenkins when Jenkins is executing while works perfect when actually running from the actual Jenkins slave or running localy.
My issue is solved with getting those executables with simlinks to /usr/bin
So when you see jenkins doing the I cant execute thingy.. then symlink the executables:
sudo ln -sfn /home/builder/.rbenv/shims/bundler /usr/bin/bundler
None of the below additions to the 'execute shell' in Jenkins had any effect at all when previous tries:
##!/bin/bash
#export PATH=$PATH:/usr/local/bin:$HOME/.rbenv/bin:$HOME/.rbenv/shims
#eval "$(rbenv init -)"
#rbenv local
#rbenv rehash
#export PATH="$HOME/.rbenv/shims:$PATH"
#echo "$PATH"
#echo 'source "/etc/profile.d/rvm.sh"' >> ~/.bashrc
#echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
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.