I have a multimodule maven project, Z (let's say Z is having modules A, B & C). Is it possible to run all the tests in A in parallel when I do mvn test. But the tests in B and C should run sequentially?
Related
I am trying to build pipeline for automation tests in jenkins pipeline.
I have N machines that is prepared and have label testingNode
I have M tests
I want to run the M tests on the nodes that is labeled by me with testingNode in parallel(that mean that any test can take any machine labelled and run in parallel in the machines)
machine is not limited to one test, it can run multi but not in parallel in one machine
I have done like that in groovy
for(int i=0;i<tests.size();i++) {
def tasks = [:]
tasks["run_${tests[i].name}"] = {
node("TestingLabel") {
//run tests on machine that have testingLabel
}
}
}
parallel tasks
This code works, but the problem with this code that if I have only 1 machine available it runs all the tests in that machine in parallel, How I can fix that?
Thanks
I have an a single java project (let's say its name is PROJ) build in gradle and I wanted to run this project X times parallel, using Jenkins jobs. In addition, I would like to pass some parameters strictly to this project and somehow using it during project execution. How to do that?
Example
I have three Jenkins jobs, all executed at 1am:
JOB1 is building a gradle project PROJ with parameter PAR=V1
JOB2 is building a gradle project PROJ with parameter PAR=V2
JOB3 is building a gradle project PROJ with parameter PAR=V3
Inside my java class I want to print the current value of the parameter PAR and the result should be as follows:
JOB1: Value of parameter PAR is V1
JOB2: Value of parameter PAR is V2
JOB3: Value of parameter PAR is V3
(of course due to the fact that tasks will be performed in parallel, messages could be in different order, e.g. V3, V1, V2)
Alternatively, is there a possibility that there can be only one job in Jenkins, but gradle has been configured to build project X times in parallel with different parameters?
I understand this post is similar to:
Aggregating results of downstream is no test in Jenkins
and also to:
Aggregating results of downstream parameterised jobs in Jenkins
Nonetheless, I am not able to figure out for my case, how to make this working. I am currently using Jenkins 1.655.
I have jobs A, B, C - A being the upstream job. What I want to do is to have A call B and B call C. All needs to block and wait for completion of the next. If one fails, all fails. B and C generate unit test reports. So I want to aggregate these reports in A and then Publish that result in A. So, here's the current setup of the jobs:
Job A:
Build Steps
Execute shell: echo $(date) > aggregate
Trigger Parametrized Buid Job: Job B
Post Build Steps
Aggregate downstream test results
Record fingerprints of files to track usage: set Files to fingerprint to aggregate
Publish JUnit test result report (report files from B and C)
Job B:
Build Steps
Copy artifacts from another project: copy from upstream job aggregate file
Run tests to generate unit test reports
Trigger Parametrized Build Job: Job C
It ultimately fails here because aggregate is only archived in the
Post Build Steps of Job A. How can I archive an artifact in the Build Step?
Post Build Steps
Aggregate downstream test results (unit test.xml generated)
Record fingerprints of files to track usage: set Files to fingerprint to aggregate
I won't post Job C here for simplicity but it follows pretty much what B does.
So, summing it up, I want to have interlinked jobs that depend on each other and uses the parametrized plugin and the upstream job must aggregate the test results of all downstream.
Any help appreciated, thanks!
If you have no limitation on where to run your jobs you can always specify it to run on the same workspace\machine - this will solve all your issues.
If for some reason you can't run it on the same workspace, instead of using the copy artifact plugin you can use the link in Jenkins to the WS (guessing you're using Parameterized Trigger Plugin) so it'll be easy to wget the "aggregate" file from A job from the triggered job using the defined: TRIGGERED_BUILD_NUMBER_="Last build number triggered" from A. This will also help you to keep track of the jobs B and C you triggered to get the artifacts from there.
Hope it helps!
I have a couple of jobs that have to be built in a specific order.
Job A triggers Job B that triggers Job C.
Job D must not start before A-B-C has run it course. However this job (D) is in it's turn triggered by a repository change. As D has run successfully it will trigger A
Any way to block D until A-B and C has run?
/J
You are looking for the "Throttle Concurrent Build" plugin.
https://wiki.jenkins-ci.org/display/JENKINS/Throttle+Concurrent+Builds+Plugin
Is it possible to setup a job X to build a sequence of jobs A, B and C sequentially (B does not start before A finished successfully C does not start before B....) without specifying in B that is should start after A is done etc?
Precisely I would like to setup a "Master" job which executes the subjobs sequentially without modifying the subjobs.
(OR)
Is there a way to specify which all jobs to run sequentially from a list file or text file??
Can I use some plugin to perform this ?
I guess you should try the plugin Build Pipeline Plugin