Possible in Jenkins to add sleep time between build actions? - jboss

I am starting a JBoss server in Jenkins as a build action. The next action runs a set of tests. I need to add sleeptime between the two actions. Does anyone know how to do this easily?

It is possible to use sleep step in your Jenkins Pipeline. The step is included in Pipeline: Basic Steps.
Example:
steps {
sleep time: 250, unit: 'MILLISECONDS'
}

You can add sleep command (on Unix) in the test build action before test execution.

If you mean to know how to sleep between those build steps you can use sleep with Execute shell type.
sleep 30s

There is a built-in feature in Jenkins to put a sleep but it is not easy to find it because they call it differently.
On the following screenshot
You can see there is a Quiet period setting in the advanced project options that is "executed" before the current job (project).
If you have 3 jobs you can as well set this setting for jobs 2 and 3 which will make:
job1 -> (sleep -> job2) -> (sleep -> job3)

I just added a Powershell step to run script with Start-Sleep -sec 240

all previous answers are correct, here is more detailed info for linux envirnment.
Search you existing Job Configuration for "Add build step"
Select Execute Shell and then add sleep some_number.

Related

Rudeck: Using node environment variables, inside a scheduled job

I have a scheduled job on rundeck (2.6.2).
This jobs run a script that needs an node environment variable available (like $HOME, $USER or $PWD. A custom one. ) for all user in the node/nodes.
I could use jobs options to solve this if I wanted trigger the job from API ( Or manually. Rundeck ask me for the option ) but is a scheduled job. I can't use Options -> Default Value because the jobs could run in nodes with different values for this environment variable.
There is any way to offers all / some node environment variables to rundeck to be used inside the scheduled jobs?
(I have thought in use Options -> Allowed Values -> Remote URL but is a mess. Too complicated to me requirement)
Thanks.
The easy way in my case has been to customize /etc/rundeck/profile adding into it all the stuff I wanted.
Seems a pretty good solution to me.
I succeeded to perform this by adding the following lines:
set -a
. /etc/environment
. /etc/profile
1) put those lines into the file: /etc/rundeck/profile
2) put those lines into a script step
Remark: I'm using only script steps in my rundeck and I'm always put this lines in the first line of the script step:
#!/usr/bin/env bash

controlling teamcity steps using powershell

I have the following scenario.
I have 5 build steps in teamcity for a project . I want 5th step to be executed only if the branch is master. The team city process should exit without executing 5th step if the branch is not master. Is it something I can achieve through powershell?
I think the only way to do this is to have a powershell step as step 5 which simply checks the current branch (%teamcity.build.branch%) and errors if its not master, then have the step that you want to run which is currently step 5 as step 6.
Team city doesn't always like to fail if the powershell steps fail, especially in versions before the current one.
To get around this we use the as the source script, but it assumes the script you want to run is in source control:
& "%teamcity.build.checkoutDir%\Path\To\PowershellScript.ps1" "%teamcity.build.checkoutDir%"
Write-Host "The result was of the previous script was " $LASTEXITCODE
Exit $LASTEXITCODE
The linked answer contains more options depending on which version you are using, so I'll assume you can find exactly how to get a failure to stop the build there.

jmeter start in no pause mode from command line

I have a test plan in JMeter using some Timers.
In some situations I would like to execute the test plan from the command line with all Timers disabled (Same as with the Menu Option "Start no pause"), is it possible to use this option from the command line?
It is not possible as of jmeter 2.13.
You should open an enhancement request.
A possible way to do it is to make timers use a property as pause and pass it as command line property with:
-JmyPauseProperty=0
Edit 10 may 2015:
You created bugzilla enhancement:
https://bz.apache.org/bugzilla/show_bug.cgi?id=57912

ANT_ Introducing delay between each target

I have an ant file with multiple targets (task 1 , task 2, task3..) I want to implement sleep between each target execution. I did that by introducing new target of sleep (it is Perl file execution contains sleep Perl script). Now, I called the target as:
target name="task1" description="XX" depends="sleep"
target name="task2" description="XX" depends="sleep"
When I do this, my sleep target is executed only once. It is not executing for all the targets. Please guide me to introduce sleep between each target.
The simplest way would be to execute a sleep Ant task at the start of each target:
<target name="targetX" description="xxx">
<sleep seconds="2"/>
...
</target>
You might be Suffering from Buffering. You can set $| to 1 if you need unbuffered output.
Your sleep target is executed only once -- and this is the expected behaviour in Ant to avoid duplicate execution.
You can write a BuildListener.
Put Thread.sleep(sleepTime) in targetFinished method.

Scheduled Task in XP: Disable "Stop Task If Runs X Hours and X Mins" in command line

I'm trying to disable the Stop Task If Runs X Hours and X Mins option on some scheduled tasks on our client machines by using the command line. It appears that in Vista and above there is a /K option that allows this, but no such switch exists in XP.
Is there no way to change this using command line? If not, could you recommend a C# library that would let me do this?
After a little more looking I didn't find anything, so I'm instead using the CodeProject Task Scheduler library.