Disable jenkins build slaves from a job - continuous-integration

I would like a periodic job that rebuilds jenkins build slaves, but I don't want it to fire if jobs are currently running. My thoughts are either to
consume all possible build slots on a slave, or
disable the slave from the job and wait for it to go idle
I don't know how to do either from a job. Is it possible? Maybe another approach?
Thanks!

I think the way I'm going to solve this is to use the "launch slave via script" option. The slave has options for periodically turning the slave off, and then I can just use the script to clean it up, rebuild it, and relaunch the slave.
The offline process has safeguards to make sure it won't happen when a build is executing.

Related

How can I see all the processes that were run during a specific time period

I know that PS will show me all the currently running processes. But that won't show me anything that's started, then stopped, during some time span. Is there any other way that I can see all the processes that were run during some event?
I'm trying to setup a way of auditing all the processes that ran during a build compilation. I can use PS to check all the running processes at the start of the build, and even run it again at the end. And I can setup a separate thread that will run PS over and over and over again during the build to catch all the processes that might have been run in the middle. But is there some better way of accomplishing this task that I'm not aware of?
This build is being run on a mac, so it uses the mac version of bash.
After your processes have run you can go to the Console (in the Applications/Utilities Folder) and check the system logs for the time period of interest. Many messages are written so the narrower the time window the better.

Scheduling Cucumber test features to run repeatedly

I have a Cucumber test (feature files) in the RubyMine IDE and lately I have a need to execute one of the feature repeatedly on a scheduled time.
I haven't found a way to do so. Any idea or thoughts on scheduling that feature file?
You can create a cron job which will execute a rake.
The software utility Cron is a time-based job scheduler in Unix-like
computer operating systems. People who set up and maintain software
environments use cron to schedule jobs (commands or shell scripts) to
run periodically at fixed times, dates, or intervals.
These links might help
How to create a cron job using Bash
how to create a cron job to run a ruby script?
http://rake.rubyforge.org/
I solved the problem by simply installing Jenkins on my machine from its official site,https://jenkins-ci.org/. I configured master and slave nodes on my own machine because I just needed to run one feature file(it has the script I want to run on daily basis).
Although, it is recommended to configure slave on a different machine if we have multiple jobs to run and our jobs are resource intensive.
There is a very good illustration on installing, configuring and running jobs in this link http://yakiloo.com/setup-jenkins-and-windows/

How to improve Jenkins server performance?

Our Jenkins server(linux machine) slows down over a period of time and it gets unresponsive. All the jobs take unexpectedly long time(even though they run on slaves which are different machines from server). One of things I have observed is increase in the number of open files. The number seems to be increasing as shown in the image below. Does anyone have a solution to keep check on this without restarting the server? Also, are there any configurations/tweaks that could improve the performance of the jenkins server?
We are using Jenkins for four years and we tried to keep it up-to-date (Jenkins + plug-ins).
Like you we experimented some inconvenience, depending on new versions of Jenkins or plug-ins...
So we decided to stop this "continuous" upgrade
Here are humble tips:
Avoid technical debt. Update Jenkins as much as you can, but use only "Long Term Support" versions (latest is 2.138.2)
Backup your entire jenkins_home before any upgrade!
Restart Jenkins every night
Add RAM to your server. Jenkins use file system a lot and this will improve caching
Define JVM min/max memory parameters with the same value to avoid dynamic reallocation, for example: -Xms4G -Xmx4G
Add slaves and execute jobs only on slaves
In addition to above, you can also try:
Discarding old builds
Distribute the builds on multiple slaves, if possible.

Does TeamCity clean-up really require you to shut down the server?

TeamCity seems to completely shut down during the clean-up process, including stopping all active builds. The only option for scheduling seems to be nightly. I have builds that take up to several days to run. Do I have any options other than disabling the scheduled process?
Even for my play server the build process took almost 30min to execute. I'm a bit worried as well about what a production server would look like, especially running daily!
You need a heavy infrastructure in place for CI if you are planning to make it robust. See whether the build artifacts are cleared and configured properly in teamcity. Instead of doing a cleanup in one setting, you can automate it and probably remove relatively older build history periodically
And the ansewr to your question is No, cleanup does not require you to shutdown the server unless it crashes.
Edit : The teamcity shutdown may be due to innumerous reasons i can only speculate on. It might have gotten shut down because of a crash. But according to the policy given in Jebrains wiki, there is no mention about the server shutdown. And it is totally not logical to shutdown the entire server for a cleanup. Source.

Jenkins/Hudson - Run script on all slaves

I have a requirement to run a script on all available slave machines. Primarily this is so they get relevant windows hotfixes and new 3rd party tools before building.
The script I have can be run multiple times without undesirable side effects & is quite light weight, so I'm happy for this to be brute force if necessary.
Can anybody give suggestions as to how to ensure that a slave is 'up-to-date' before it works on a job?
I'm happy with solutions that are driven by a job on the master, or ones which can inject the task (automatically) before normal slave job processing.
My shop does this as part of the slave launch process. We have the slaves configured to launch via execution of a command on the master; this command runs a shell script that rsync's the latest tool files to the slave and then launches the slave process. When there is a tool update, all we need to do is to restart the slaves or the master.
However - we use Linux whereas it looks like you are on Windows, so I'm not sure what the equivalent solution would be for you.
To your title: either use Parameter Plugin or use matrix configuration and list your nodes in it.
To your question about ensuring a slave is reliable, we mark it with a 'testbox' label and try out a variety of jobs on it. You could also have a job that is deployed to all of them and have the job take the machine offline it fails, I imagine.
Using Windows for slaves is very obnoxious for us too :(

Resources