Calling java static methods from groovy dsl

2019-04-08 Thread Akshay Paturkar
Hi All ,
I am using jenkins shared library framework , where i have requirement to 
publish unit test results upon completion of stage.
i have written logic for publishing result to database in java file called 
JenkinsUtil.java which contains different static method to push results to 
database.
I am importing class as import com.jda.JenkinsUtil and using it in script 
file pipeline.groovy as below .
I am always facing issue as 

groovy.lang.MissingPropertyException: No such property: JenkinsUtil for class


can anyone please help 


I am using this as below,

try {
stage(stageName) {
withEnv(['INSTALLER_MODULE=' + instanceName])
{
if (instanceName == 'scsc') {
sh "ant -DBUILD_MODULES='scsc' -buildfile 
${BUILD_ROOT}/build/build.xml unittest_run_all create_files_for_sonaranalysis"
} else if (instanceName == 'DRM') {
withEnv(['INSTALLER_MODULE=drm'])
{
sh "ant 
-DBUILD_MODULES='pricing,markdown,apm' -buildfile ${BUILD_ROOT}/build/build.xml 
unittest_run_all"
}
} else {
sh "ant -DBUILD_MODULES='${instanceName}' 
-Dpatch.number='' -buildfile ${BUILD_ROOT}/build/build.xml " + target
}
}
}
println("before Jenkins Util class call")

JenkinsUtil.utStats("${BUILD_ROOT}/weblogic/utreports/dm/TESTS-TestSuites.xml", 
array[0], array[1], "2019.1", "${BUILD_ROOT} 
http://md1npdvbuild87:8080/view/Junit/job/Datamgmt-UT/Datamgmt_UT_Reports/";, "")
println("after Jenkins Util class call")
}
catch (e) {
println 'exception occured at module' + instanceName + "exception occured 
is" + e
}






-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b24b311a-6198-44eb-8a4f-3dae55b59774%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Requirement to run a set of tasks for a build in parallel, The tasks for the build are dynamic it may change

2019-04-08 Thread Akshay Paturkar
Hi Basanta ,
you can try custom implementation for parallal stage something like below.

def parallelConverge(instanceNames, targets, runPhase, customParam) {
def parallelNodes = [:]
for (instance in instanceNames) {
def moduleName = instance
else {
parallelNodes[moduleName] = this.getNodeForInstance(moduleName, 
targets)
}
}
parallel parallelNodes
}

and 

Closure getNodeForInstance(instanceName, target) {
return {
try {
stageName = "Build_" + instanceName
stage(stageName) {

{
else {
sh "ant -DBUILD_MODULES='${instanceName}' 
-Dpatch.number='' -buildfile ${BUILD_ROOT}/build/build.xml " + target
}
}
}

catch (e) {
println 'exception occured at module' + instanceName + 
"exception occured is" + e
}
}
}

Parameterise method as per your requirements .

Hope it willl solve your problem 


On Monday, April 8, 2019 at 4:12:52 PM UTC+5:30, pbasan...@gmail.com wrote:
>
> Hi All,
>
>
> I have a requirement to run a set of tasks for a build in parallel, The 
> tasks for the build are dynamic it may change. I need some help in the 
> implementation of that below are the details of it.
> For Component 1 : 2 jobs need to trigger in parallel 
> for Component 2 : 4 jobs need to trigger in parallel 
> For Component 3 : 3 jobs need to trigger in parallel 
>
> Regards,
> Basanta
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/657d2ba8-73b9-4801-8c8a-9d5be3085a88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


calling another job from parent job

2018-11-12 Thread Akshay Paturkar
Hi All,
i am trying to call job from another job and able to do it by following 
below instructions .
https://jenkins.io/doc/pipeline/steps/pipeline-build-step/

But I am not able to see stages executed under called job.
how do we enable stages of called job to be displayed under build job stage 
?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d86805e3-8792-41e8-895a-d77c2e7fec40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.