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

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?

Related

Task 'installDebug' is ambiguous in project ':app'

I am trying to run a react native app.that time i am getting ****Task 'installDebug' is ambiguous in project **': app'. Candidates are: 'installProductionDebug', 'installProductionDebugAndroidTest', 'installStagingDebug', 'installStagingDebugAndroidTest'.
**
Could you please help me fix and complete it ? Thanks
BUILD FAILED in 37s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
What went wrong:
Task 'installDebug' is ambiguous in project ':app'. Candidates are: 'installProductionDebug', 'installProductionDebugAndroidTest', 'installStagingDebug', 'installStagingDebugAndroidTest'.
Try:
Run gradlew tasks to get a list of available tasks.
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 37s

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 doesn't run windows scheduler task correctly

I am trying to run a Windows scheduler task using schtasks.exe in an SSIS job. The task will be called using the same ID as is used to execute the task. The task itself works; It is currently started manually after the SSIS job is done.
I've tried running a script on my own PC with a space in the name and this worked. All other settings are the same. The name of this task is "DWH Upload DEV" and it's location is set to "\".
I'm calling the script from an Execute Process Task block, using schtasks.exe as the executable (with the full file path of course) and /RUN /TN "DWH Upload DEV" as the arguments.
I have RequireFullFileName set to False, FailTaskIfReturnCodeIsNotSuccessValue set to True and SuccessValue and TimeOut to 0
I am receiving the following error: [Execute Process Task] Error: In Executing "[location]\schtasks.exe" "/RUN /TN "DWH Upload DEV"" at "", The process exit code was "1" while the expected was "0".
The part here that confuses me is the error being at seemingly nothing.
Thanks in advance for any help!
EDIT:
I can't run the program that is performed by the scheduler from SSIS itself, due to the program needing to be run by a specific user. The use of task scheduler is a workaround for this.
So, as it turned out, the task DID trigger but it didn't actually properly work (I later heard the task stopped working about an hour before I started working with it). The task can now properly be run by using the following settings:
Executable: C:\Windows\System32\schtasks.exe
Arguments: /RUN /TN "DWHUploadDEV" (the new version has no spaces in the name)
The rest of the settings is as normal.

SonarRunner failed - Analysis is already running

Hi I'm running a Jenkins build with sonarRunner (in Gradle) and during this sonarRunner task, it's failing with the following error message. Any ideas! how to fix it?
09:57:21.410 ERROR - It looks like an analysis of 'MyProject' is already running (started less than a minute ago).
:****Runner FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':****Runner'.
> org.****.api.utils.SonarException: The project is already being analysed.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
OK, that was quick.
I used -Dsonar.forceAnalysis=true and the error went away.

Error in the build of project with gradle from Hudson and its deployment in artifactory

I just added the hudson-artifactory plugin, and everything run marvelously with Maven, but when I tried to build the project with gradle (I added the gradle plugin to hudson)
I got this error:
FAILURE: Build failed with an
exception. * Where: Initialization
script 'C:\Documents and
Settings\qqqqqqqqqqqq.hudson\jobs\skiiiiiiiiiin\builds\2010-08-10_10-45-03\init-artifactory.gradle'
line: 2 * What went wrong: A problem
occurred evaluating initialization
script. Cause: No signature of method:
org.gradle.invocation.DefaultGradle.apply()
is applicable for argument types:
(init_artifactory_gradle_bb54a6ea5f854f8feae8c6181e5acbf4$_run_closure1_closure2)
values:
[init_artifactory_gradle_bb54a6ea5f854f8feae8c6181e5acbf4$_run_closure1_closure2#1d7b222]
* Try: Run with -s or -d option to get more details. Run with -S option to
get the full (very verbose)
stacktrace. BUILD FAILED Total time:
1.942 secs Finished: FAILURE
The plugin requires Gradle 0.9-preview-3+
Try using the latest version.
we must add gradle.artifactoryonline.com/gradle/libs and gradle.artifactoryonline.com/gradle/plugins on remote repository :)) and everything works !