catching hudson build abort signal? - hudson

how to catch the signal generated when a build is aborted on hudson.I can catch the aborted build when done directly on linux machinethat is executing perl script directly but how to do it when script executed from hudson.

Related

How to resolve below error-ERROR: Child Process Error: Test runner sel (JUnitTester) has failed with retcode 1

When I ran the selenium script using Taurus and want to convert in JMX then got the error-
10:55:54 ERROR: Child Process Error: Test runner sel (JUnitTester) has failed with retcode 1
10:55:54 ERROR: JUnitTester STDERR:
May 02, 2022 10:55:50 AM com.blazemeter.taurus.junit.CustomRunner main
INFO: Starting: [C:\Users\sss\2022-05-02_10-55-36.435651\runner.properties]
Exception in thread "main" com.blazemeter.taurus.junit.exception.CustomRunnerException: Nothing to test
at com.blazemeter.taurus.junit.CustomRunner.main(CustomRunner.java:54)
How it resolved?
It means that Taurus JUnit Executor failed somewhere somehow, inspect logs in the Artifacts Directory and look for Java/JUnit-related errors there.
Most probably JUnit executor wasn't able to detect any test cases to run, it's impossible to tell for sure what is the root cause without seeing the full logs and your automation code.
Be aware that you can use another approach not involving Taurus, i.e.
Kick off BlazeMeter Proxy Recorder
Configure your tests to use the above recorder as the proxy
Run your tests from IDE or console
The BlazeMeter proxy recorder will capture the requests and convert them into .jmx file (you can also export it as "SmartJMX" with automatic detection and correlation of the dynamic parameters)

Getting logs/more information during start-build command execution

Jenkins pipeline is building Docker images. OpenShift plugin(s) are used for the same.
An example command:
openshift.selector(BUILD_CONFIG_NAME, "${appBcName}").startBuild("--from-dir=${artifactPath}", '--wait','--follow')
While this works smoothly most of the time, whenever this command fails due to some underlying platform issues, almost no information is seen in the Jenkins build job console:
[Pipeline] }
[start-build:buildconfig/amld5-car-reporting-spacetime-ubi-openshift-java-runtimejd] ............................................................
[start-build:buildconfig/amld5-car-reporting-spacetime-ubi-openshift-java-runtimejd] Uploading finished
[start-build:buildconfig/amld5-car-reporting-spacetime-ubi-openshift-java-runtimejd] Error from server (BadRequest): unable to wait for build amld5-car-reporting-spacetime-ubi-openshift-java-runtimejd-857 to run: timed out waiting for the condition
[Pipeline] }
ERROR: Error running start-build on at least one item: [buildconfig/amld5-car-reporting-spacetime-ubi-openshift-java-runtimejd];
{err=, verb=start-build, cmd=oc --server=https://api.scp-west-zone02-z01.net:6443 --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt --namespace=sb-1166-amld5-car-service-se --token=XXXXX start-build buildconfig/amld5-car-reporting-spacetime-ubi-openshift-java-runtimejd --from-dir=./build/libs --wait --follow -o=name , out=Uploading directory "build/libs" as binary input for the build ...
............................................................
Uploading finished
Error from server (BadRequest): unable to wait for build amld5-car-reporting-spacetime-ubi-openshift-java-runtimejd-857 to run: timed out waiting for the condition
, status=1}
[Pipeline] // catchError
I need more verbosity, detailed error information. I checked the start-build command reference, and I thought --build-loglevel [0-5] might help here. When I used it, I got a warning that since I am using source type as 'Binary' in the BuildConfig, logging isn't supported(seriously???)
NOTE: the selector returned when -F/--follow is supplied to startBuild() will be inoperative for the various selector operations.
Consider removing those options from startBuild and using the logs() command to follow the build output.
[start-build:buildconfig/casc-docs-spacetime-ubi-openshift-java-runtimeadoptopenjdk] WARNING: Specifying --build-loglevel with binary builds is not supported.
[start-build:buildconfig/casc-docs-spacetime-ubi-openshift-java-runtimeadoptopenjdk] WARNING: Specifying environment variables with binary builds is not supported.
[start-build:buildconfig/casc-docs-spacetime-ubi-openshift-java-runtimeadoptopenjdk] Uploading directory "build/libs" as binary input for the build ...
[start-build:buildconfig/casc-docs-spacetime-ubi-openshift-java-runtimeadoptopenjdk] ..
How do I get more logs, info. while executing the start-build command?
I was facing the same problem, I just used something like:
def build = openshift.selector(BUILD_CONFIG_NAME, "${appBcName}").startBuild("--from-dir=${artifactPath}", '--wait','--follow')
build.logs('-f')
And so far it seems to work, I got the logs from my openshift build in my Jenkins pipeline. Now I'll try to get the logs only if build does not Complete, to reduce the overall logs.
(for future searchers like me ^^)

SSIS 2014 Package Execution through a proxy fails

I'm trying to run an SSIS package with a SQL Server Job. I want to find a way to run the package without assigning a user with sysadmin role to the job owner. I've created a credential and proxy to run the job step, but I get a stream of errors. I can get the package to run by setting a sysadmin user to the job owner and setting the job step to run under the sql server agent service account. When I try to run as the proxy I get errors, even when I've set the credential of the proxy to a sysadmin user. I tried what the error suggests and opened all the script tasks in the package. They all build successfully. Does anyone know what I have to do to get the proxy account to run this package successfully?
Error: 2015-10-08 09:35:53.46
Code: 0x00000005
Source: Script Task Script Task
Description: Failed to compiled scripts contained in the package. Open the package in SSIS Designer and resolve the compilation errors.
End Error
Error: 2015-10-08 09:35:53.46
Code: 0x00000005
Source: Script Task Script Task
Description: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
End Error
Error: 2015-10-08 09:35:53.48
Code: 0x00000005
Source: Script Task Script Task
Description: The binary code for the script is not found. Please open the script in the designer by clicking Edit Script button and make sure it builds successfully.
End Error
I had to upgrade the packages to 2014. After that they ran successfully under the proxy.

how to get control-c to kill only the running process and not sbt itself? [duplicate]

How do you terminate a run in SBT without exiting?
I'm trying CTRL+C but it exits SBT. Is there a way to only exit the running application while keeping SBT open?
From sbt version 0.13.5 you can add to your build.sbt
cancelable in Global := true
It is defined as "Enables (true) or disables (false) the ability to interrupt task execution with CTRL+C." in the Keys definition
If you are using Scala 2.12.7+ you can also cancel the compilation with CTRL+C. Reference https://github.com/scala/scala/pull/6479
There are some bugs reported:
https://github.com/sbt/sbt/issues/1442
https://github.com/sbt/sbt/issues/1855
In the default configuration, your runs happen in the same JVM that sbt is running, so you can't easily kill them separately.
If you do your run in a separate, forked JVM, as described at Forking, then you can kill that JVM (by any means your operating system offers) without affecting sbt's JVM:
run / fork := true
I've found the following useful when I have control over the main loop of the application being run from sbt.
I tell sbt to fork when running the application (in build.sbt):
fork in run := true
I also tell sbt to forward stdin from the sbt shell to the application (in build.sbt):
connectInput in run := true
Finally, in the main thread of the application, I wait for end-of-file on stdin and then shutdown the JVM:
while (System.in.read() != -1) {}
logger.warn("Received end-of-file on stdin. Exiting")
// optional shutdown code here
System.exit(0)
Of course, you can use any thread to read stdin and shutdown, not just the main thread.
Finally, start sbt, optionally switch to the subproject you want to run, run.
Now, when you want to stop the process, close its stdin by typing CTRL-D in the sbt shell.
Consider using sbt-revolver. We use it in our company and it's really handy.
For what you're asking can be done with:
reStart
reStop
Without need to configure build.sbt file.
Your can use this plugin by adding:
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
To your project/plugins.sbt

hudson build timedout | how to perform cleanup in such case?

Suppose a particular job is executing for more then x minutes then I abort it using the build timout plugin
Now after the build is aborted in such manner I want to perform some cleanup actions. Want to know - how can I do it?
How can I kill all process that my build had started?
To perform such action I found a post build plugin.http://wiki.hudson-ci.org/display/HUDSON/Post+build+task
But I get follwing error when it tries to execute my bat script
Build timed out. Aborting
Build was aborted
Performing Post build task...
Match found for :aborted : True
Logical operation result is TRUE
Running script : C:\aks.bat
[workspace] $ cmd /c call C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\hudson6930497910994453428.bat
Exception when executing the batch command : null
Finished: ABORTED
Why is it so? Can anyone suggest some other plugin?