I'm running the following SGE command thru Jenkins without any problem:
qsub -N my_job_name -q my_queue -l hostname=my_hostname -w e -notify -m n -cwd -b y -o /dev/null -e my_error_path -v my_env_var ...
Your job 1082782 ("my_job_name") has been submitted
Finished: SUCCESS
I'm running a tool/script thru Jenkins that calls the previous SGE command and I get the following issue:
Q: Submitting my_job_name to SGE queue my_queue
S: my_job_name not compared:
SGE job exited
Job ID was 1082783
---------- Full accounting info from SGE ----------
SGE job entered error state: 1082783
TextTest terminated this job as a result. SGE's error reason follows:
error reason 1: can't get password entry for user "jenkins". Either the user does not exist or NIS error!
Results:
Tests that did not succeed:
my_job_name not compared: SGE job exited
Tests Run: 1, Incomplete: 1
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Any ideas? Thanks :)
Related
I am trying to set the Build name/Build description based on the outcome of a shell script.
For example, I am executing the following lines in shell:
echo `date`
if [ $test == true ]then
echo "BuildSuccess"
else
echo "NoBuild"
fi
I am then running the build step "Changes build description". In this, I have added the macro:
${BUILD_LOG,maxLines=1}
After running the job I get the output as:
[SSH] executing...
Thu May 20 00:47:42 PDT 2021
BuildSuccess
[SSH] completed
[SSH] exit-status: 0
New run description is '[...truncated 478 B...]
'
Evaluated macro: '#37'
New run name is '#37'
Finished: SUCCESS
Can anyone help me understand why the macro is getting evaluated to [...truncated 478 B...]?
Is there a way I can capture the text "BuildSuccess" from the log?
I am in effect trying to capture the last line of the build log.
Please note that this is a freestyle project and not a pipeline.
I solved a similar issue by:
BUILD_LOG_REGEX
email-ext plugin
Here is a tutorial http://siddesh-bg.blogspot.com/2012/04/using-buildlogregex-in-jenkins-email.html .
By BUILD_LOG_REGEX the above mentioned plugin is able to query and extract parts of the build log.
I have a Jenkins job running kitchen converge that is giving the following error:
---- Begin output of /bin/systemctl restart docker ----
STDOUT:
STDERR: Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
---- End output of /bin/systemctl restart docker ----
I'm looking for a way to capture the output of both commands above so I can diagnose what's wrong with the cookbook in that environment.
Running kitchen converge locally gives no error and I don't have access to the Jenkins node where this job is running.
I could get output adding the following code:
require 'mixlib/shellout'
Chef.event_handler do
on :run_failed do
systemctl = Mixlib::ShellOut.new("/bin/systemctl status docker.service")
systemctl.run_command
Chef::Log.info "Recipe failed miserably"
Chef::Log.info systemctl.stdout
Chef::Log.info systemctl.stderr
journalctl = Mixlib::ShellOut.new("/bin/journalctl -xe")
journalctl.run_command
Chef::Log.info journalctl.stdout
Chef::Log.info journalctl.stderr
end
end
Which doesn't seem to be optimal.
you didn't specify which chef resource executes the commands above, but generally speaking - execute chef-client with debug log level:
$ chef-client --log_level debug
you can achieve it by setting the log level in kitchen provisioner
---
provisioner:
name: chef_zero
log_level: :debug
I have created a jenkins "freestyle" job, in which I am trying to run multiple BDD testing process. Following is the "commands" I have put in "Jenins/Build/execute shell" section:
cd ~/FEXT_BETA_BDD
rm -rf allure_reports allure-reports allure-results
pip install behave
pip install selenium
pip install -r features/requirements.txt
# execute features in plan section
behave -f allure_behave.formatter:AllureFormatter -f pretty -o ./allure-reports
./features/plan/*.feature
# execute features in blueprint section
behave -f allure_behave.formatter:AllureFormatter -f pretty -o ./allure-reports
./features/blueprint/*.feature
What I have found is in Jenkins, if there is any test case intermittent failure, such message is shown in the Console Output:
"
...
0 features passed, 1 failed, 0 skipped
0 scenarios passed, 1 failed, 0 skipped
3 steps passed, 1 failed, 1 skipped, 0 undefined
Took 2m48.770s
Build step 'Execute shell' marked build as failure
"
And the leftover test cases are skipped. But if I was to run the behave command on my local host directly, I don't get this type of behaviour. The failure will be detected and the remaining test cases continues till all are finished.
So How may I work around this issue in Jenkins ?
Thanks,
Jack
You may try the following syntax:
set +e
# execute features in plan section
behave -f allure_behave.formatter:AllureFormatter -f pretty -o ./allure-reports
./features/plan/*.feature || echo 'ALERT: Build failed while running the plan section'
# execute features in blueprint section
behave -f allure_behave.formatter:AllureFormatter -f pretty -o ./allure-reports
./features/blueprint/*.feature || echo 'ALERT: Build failed while running the blueprint section'
# Restoring original configuration
set -e
Note:
Goal of set -e is to cause the shell to abort any time an error occurs. If you will see your log output, you will notice sh -xe at the start of execution which confirms that Execute Shell in Jenkins uses -e option. So, to disable it, you can use +e instead. However, it's good to restore it once your purpose is fulfilled so that subsequent commands produce expected result.
Ref: https://superuser.com/questions/1113014/what-would-set-e-and-set-x-commands-do-in-the-context-of-a-shell-script
The ConsoleOutput from the SummaryReporter above indicates that you have only one feature with one scenario (that fails). Behave has no such thing that it stops when the first scenario fails.
An early abortion of the test run can only occur if critical things happen:
A failure/exception in the before_all() hook occurs
A critical exception is raised (SystemExit, KeyboardInterrupt) to end the test run
Your implementation tells behave to abort the test run (make sense on critical failures when all other tests will also fail; why waste the time)
BUT: If the test run is aborted early, all the features/scenarios that are not executed yet are reported as untested counts in the SummaryReporter.
...
0 features passed, 1 failed, 0 skipped, 2 untested
0 scenarios passed, 1 failed, 0 skipped, 3 untested
0 steps passed, 1 failed, 0 skipped, 0 undefined, 6 untested
HINT: Untested counts are normally hidden. They are only shown if the counter is not zero (greater than zero).
This is not the case in your description.
SEE ALSO:
behave: features/runner.abort_by_user.feature
I am trying to set up a job in Jenkins using this p4 plugin. I successfully installed the plugin and set up the p4 configuration to point to my company's p4 executable.
Now the actual failure happens when I build the project. I am seeing the following:
Started by user anonymous
Building remotely on scspr0011492003.gdl.englab.netapp.com (scspr0011492003) in workspace /tmp/workspace/TestP4
Using remote perforce client: test--2000486220
[TestP4] $ /usr/software/rats/bin/p4 workspace -o test--2000486220
Last build changeset: 2464123
[TestP4] $ /usr/software/rats/bin/p4 changes -s submitted -m 1 //test--2000486220/...
[TestP4] $ /usr/software/rats/bin/p4 -s changes -s submitted //test--2000486220/...#2464124,#2515192
[TestP4] $ /usr/software/rats/bin/p4 describe -s 2515192
[TestP4] $ /usr/software/rats/bin/p4 -G where //...
[TestP4] $ /usr/software/rats/bin/p4 -s users alirezam
[TestP4] $ /usr/software/rats/bin/p4 user -o alirezam
Sync'ing workspace to changelist 2515192.
[TestP4] $ /usr/software/rats/bin/p4 -s sync //test--2000486220/...#2515192
Sync complete, took 1755 ms
[TestP4] $ /usr/software/rats/bin/p4 -xe /tmp/hudson6814857322401659205.sh
(b4p4: for help on the 'b4p4' wrapper, use 'p4 b4p4help'; p4 -V for version)
Perforce client error:
open for read: e: No such file or directory
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I am not sure what -xe is in p4 and not sure why it's failing. Can someone help? Thank you.
The issue here appears to be a combination of things. Wrong p4 command syntax and a possible non-valid file name.
The ‘-x’ global option in Perforce is for feeding a list of files as arguments to a command. For example, see the reference here:
http://www.perforce.com/perforce/doc.current/manuals/cmdref/global.options.html
I see a couple of things wrong with this command:
/usr/software/rats/bin/p4 -xe /tmp/hudson6814857322401659205.sh
1] Unless the ‘e’ is a file or file list it is not passing anything in
2] On that line, there is no Perforce command used with the global option -x. For example, a command such as ‘edit’ or ‘add’.
Should this line instead be perhaps like this?:
/usr/software/rats/bin/p4 -x /tmp/hudson6814857322401659205.sh edit
You could also try something like this here:
echo /tmp/hudson6814857322401659205.sh|p4 -x - edit
to see if you get the same error of “Perforce client error:
open for read: e: No such file or directory”? That error indicates that it might be returning something that is not a valid filename.
When I run PhpUnit tests in shell, they run OK, but when run from Jenkin's build step (Execute Shell), it fails with:
[workspace] $ /bin/sh -xe /tmp/hudson3868615221631158667.sh
+ phpunit --log-junit trunk/tests/phpunit_results.xml --bootstrap trunk/tests/bootstrap.php trunk/tests/
E_WARNING: mkdir(): No such file or directory
in Nette/common/Configurator.php(255)
in Nette/common/Configurator.php(255) mkdir()
in Nette/common/Configurator.php(141) Nette\Configurator->getCacheDirectory()
in trunk/tests/bootstrap.php(14) Nette\Configurator->createRobotLoader()
in phpunit/Util/Fileloader.php(93) include_once()
in phpunit/Util/Fileloader.php(77) PHPUnit_Util_Fileloader::load()
in phpunit/TextUI/Command.php(808) PHPUnit_Util_Fileloader::checkAndLoad()
in phpunit/TextUI/Command.php(586) PHPUnit_TextUI_Command->handleBootstrap()
in phpunit/TextUI/Command.php(141) PHPUnit_TextUI_Command->handleArguments()
in phpunit/TextUI/Command.php(132) PHPUnit_TextUI_Command->run()
in local/bin/phpunit(586) PHPUnit_TextUI_Command::main()
Build step 'Execute shell' marked build as failure
I found some similar questions, but none of them answered/fixed my problem.
Here is the result of running from shell:
user#server:~/$ phpunit --log-junit trunk/tests/phpunit_results.xml --bootstrap trunk/tests/bootstrap.php trunk/tests/
ccccPHPUnit 4.1.3 by Sebastian Bergmann.
.......
Time: 128 ms, Memory: 6.75Mb
OK (7 tests, 8 assertions)
I welcome every suggestion.