Stop build execution in Jenkins - jenkins

I am using Jenkins to run a Maven project having Junit tests in Sauce Connect. I created a job and to stop/abort the build in between I clicked the Cross button (X) shown near progress bar for build execution. But the build execution does not get stopped.
When I moved to console output for the build, it was showing message as "Closing Sauce Connect" and it takesd too much time and Jenkins does not stop build process.
Could anyone please advice as to how can we manually stop/abort build execution.
Additionally, is there any site where we can find proper documentation regarding Jenkins for Beginners as i have few more problems regarding its start and stop process.

I guess it is too late to answer but my help some people.
Install the monitoring plugin. (http://wiki.jenkins-ci.org/display/JENKINS/Monitoring)
Go to jenkinsUrl/monitoring/nodes
Go to the Threads section at the bottom
Click on the details buttom on the left of the slave the job is build on
Sort by User time (ms)
Then look at the name of the thread, you will have the name and number of the build
Kill it
Hope it can help

Jenkins will terminate the build nicely, i.e. wait for the running processes to end after sending the termination signal. If the processes take a long time to terminate, it will wait. The easiest way is to change your build/code such that it terminates immediately, or has a timeout for closing connections etc.
Regarding more documentation, have a look at the Jenkins wiki or get the Jenkins book.

Related

How to abort a Jenkins Job programmatically at a specified time

I want to abort my Jenkins Job before clock hits a particular time. I didn't find anything which stops it automatically at a specified time(I don't want to do it manually). Is there anything like that?
I have read this post, but none of the answer solves my problem How to stop an unstoppable zombie job on Jenkins without restarting the server?
If you want to stop a long running job, let's say, it is running more than 3 hours, then below jenkins plugins does exactly that for you.
Abort a build if it is likely stuck
Or, if you want certain build to abort on a specific time (i.e, no build should run at 5 pm daily), then you can configure groovy script to do that.

Jenkins job that calls cyclically a script

I'm having some difficulties in getting this one working.
How would I have to configure a job in Jenkins to call some script on a node, the node to execute and when exiting, the job to not declare the build finished but to wait for a certain amount of time and to call again the script. The waiting period would have to be dynamically calculated at runtime based on a target start time. Such a build would have to be stopped by some user input and not by aborting the build.
I know pipelining might be needed in this case but I'm not very sure how the build history would look like as I intend to have only one build appearing in there not a bunch of builds spawned by the main one. Hopefully, I was able to make myself easy to understand.
Thank you very much.

Cannot abandon a release on TFS2017 as one or more of the environments are in-progress

I want to abandon a release that is running multiple environments at the same time, but with every try on the Abandon option I am getting this error
Cannot abandon release 'Release-#' as one or more of the environments
are in-progress.
Each environment changes it own status after the release creation and you have to go and cancel it mannually. In order to abandon the release, each one needs to be canceled.
Then you can try to abandon the release.
Now trying to restart the agents on the server is the final step that we can try, there is another workaround, must of the time those agents have a process running on the server that is consuming the CPU's time, see which is the task that is running and kill it, automatically you will see how the steps on the release start failing, but you should try to avoid this way.
Now there is something that I want to add on the later. You can see after you kill a task that the agent can be in an inconsistent state, go to the services and see VSTS Agent service that runs the task, if it is not running, feel free to start it again.
According to the error info, since you are running multiple environments of your release. You need to abandon a status completed release either passed, canceled or a failed release.
Please just waiting for sometime and try the abandon action again. If you still get the same error info, check if a release has stuck In Progress. And check if the build which trigger the release stuck. You restart the build agent in this case.

How to make a specific job wait for a slave indefinitely?

Problem :
A certain task often crashes the slave, which then should reboot (sometimes it doesn't). If the reboot fails, it may take a week until someone reboots the computer. Then the build which failed couldn't archive the artifacts.
Idea to solve it (if there is a better one please tell me) :
To have a task always launch after this one which checks if the artifacts failed to be made (I have a way to check it), and then wait forever until the slave becomes available again, to archive the artifacts.
I know it's possible to do such for every job, but I cannot find how to do it for a specific job.
The best solution is to actually fix what crashes your server.
But for now you can add another job:
In Jenkins create a "New Item".
Make this a freestyle project.
In the "Build Trigger" section, select "Build after other projects are built".
Here you select the other job that causes the slave to crash.
Afterwards add you monitoring-and-restart-script as a build step.

Sonar execution via jenkins, sonar processing continue even after ANALYSIS SUCCESSFUL message

I am facing an issue while running sonar through Jenkins, after configuration when I making build by build now trigger my build runs and creating EAR successfully then sonar deployment starts which also run successfully and showing ANALYSIS SUCCESSFUL in the end of Jenkins build processing but even after successful analysis of sonar build continue to process and it never ends even after a long time wait. Very last line of build processing is
"12:55:14.159 INFO - <- Delete aborted builds"
pls see attached screenshot to refer.
can anybody help me out over this issue?
what is the reason behind this continuous processing of sonar analysis?
it never complete. what should I do at my end to complete build process so that my build become successful in the end?
Try restarting Jenkins. It solved the issue for me.
The ANALYSIS SUCCESSFUL message just means that all sensors and decorators have completed. There are still some post-analysis tasks which must take place (specifically, any class extending PostJob). I've found that the final log output message is not always an accurate indicator of what's wrong. There are some plugins which churn forever but don't produce any output. But I wouldn't be surprised if your analyses really are stuck at "Delete aborted builds." Sometimes the Database Cleaner can take a long time, but if it's more than 10 minutes, it's stuck. It's very likely a problem with database interaction.
The way to continue is to enable all possible SQL tracing. Enable all the options -- sonar.showProfiling=true, sonar.showSql=true, sonar.showSqlResults=true, and sonar.verbose=true. See the Sonar Analysis Parameters for more information.
If that doesn't tell you what's wrong, you might have some luck getting more information out of sonar.log by editing wrapper.conf to show DEBUG log output.

Resources