question

Harrie H. avatar image
Harrie H. asked ·

Generating test performance reports in Jenkins from jenkins pipeline file

Hello,

I have integrated our jenkins build pipeline with the dynatrace test performance monitoring. I came as far to generate a test id and executing multiple test instances on different slave nodes and collect all that in one test report in Dynatrace. This is all done with maven and groovy (the pipeline language of jenkins).

I also installed both Dynatrace plugins in jenkins, but I am not able to generate a report in a pipeline job. Also I can not find any documentation on it. It seems only possible through the old style jenkins jobs, which are not very flexible and do not meet our needs.

Is there away that at the end of the build and test process I can collect the test results from Dynatrace and trigger the dynatrace jenkins plugin to generate a report with the test performance results like it does in the old style jenkins jobs?

Best regards,

Harrie Hoogeveen

continuous deliverytest automation
1 comment
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Hi Harrie,

I am new to the Jenkins code pipeline, but we have a requirement to integrate Jenkins pipeline that uses Jmeter tests with Dynatrace. We have succesfully integrated regular junit tests via Ant/Maven build files with Dynatrace without issue. Could you please walk us through how you have integrated the DT jenkins plugin with the pipeline? - where is the test registration done etc. Any help is greatly appreciated!

Thanks,

Sharada Chukka

0 Likes 0 · ·
Mike L. avatar image
Mike L. answered ·

Our Jenkins 2.1.0 release came out a couple of weeks ago and it added support for pipelines! Find instructions on how to use it here:

https://github.com/jenkinsci/dynatrace-plugin/blob...

Mike

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Wiktor B. avatar image
Wiktor B. answered ·

Hello Harrie,

Currently Jenkins pipelines are not supported by our Jenkins plugin, as you noticed, it works correctly only with old style jobs.

We have a plan to research implementation of the new Jenkins pipelines support in our plugin. I think watching our GitHub repository is the best way to get notified about the updates:

https://github.com/jenkinsci/dynatrace-plugin

Regards,

Wiktor

1 comment Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Hello Wiktor,

Sinds the current dynatrace-plugin for jenkins is not compatible with the pipeline we did not use it. I used the Maven integration to trigger the test performance monitoring. So in the start of the pipeline I get the dynatraceid using the dtAutomation plugin:

sh "mvn dynaTrace:dtAutomation:6.5.0:startTest -pl .  org.codehaus.mojo:exec-maven-plugin:1.3.1:exec -Dexec.executable=\"echo\" -Dexec.args='\${dtTestrunID}' -Dexec.outputFile=dynatraceid -DdtVersionBuild=${buildNumber}-unit -DdynaTrace.category=performance"dynatraceid = readFile("dynatraceid").trim()

This I pass to all agents and test runs we do on the different jenkins nodes we have. This will generate the results in dynatrace, at this point we do not have a option to the dynatrace results back into a jenkins report. We make dynatrace report to slack and look at that.

Regards,

Harrie

0 Likes 0 · ·
Harrie H. avatar image
Harrie H. answered ·

com.dynatrace.sdk.server.exceptions.ServerResponseException: Not Found
at com.dynatrace.sdk.server.Service.doRequest(Service.java:147)
at com.dynatrace.sdk.server.Service.doPostRequest(Service.java:202)
at com.dynatrace.sdk.server.Service.doPostRequest(Service.java:207)
at com.dynatrace.sdk.server.Service.doPostRequest(Service.java:220)
at com.dynatrace.sdk.server.sessions.Sessions.startRecording(Sessions.java:61)
at com.dynatrace.jenkins.dashboard.TABuildWrapper.setUp(TABuildWrapper.java:160)
at org.jenkinsci.plugins.workflow.steps.CoreWrapperStep$Execution.start(CoreWrapperStep.java:80)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:224)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeDescribable(DSL.java:353)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:153)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
at sun.reflect.GeneratedMethodAccessor175.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:155)
at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:133)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:153)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:157)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:127)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:127)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46)
at com.cloudbees.groovy.cps.Next.step(Next.java:83)
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:122)


Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Harrie H. avatar image
Harrie H. answered ·

I think its try to access:

/api/v1/profiles/Jenkins

But some how it uses the wrong url. If I use wget from the jenkins server with the same credentials I have no issue getting the response.

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Harrie H. avatar image
Harrie H. answered ·

When hitting the test connection button in the jenkins management screen after configureing the url and credentials it says that and the logfile shows:

line 1:0 no viable alternative at character '<'
line 1:1 no viable alternative at character 'h'
line 1:3 mismatched character 'm' expecting 'r'
line 1:4 no viable alternative at character 'l'
line 1:5 no viable alternative at character '>'
line 2:0 no viable alternative at character '<'
line 2:1 no viable alternative at character 'h'
line 2:2 no viable alternative at character 'e'
line 2:3 no viable alternative at character 'a'
line 2:4 no viable alternative at character 'd'
line 2:5 no viable alternative at character '>'
line 3:0 no viable alternative at character '<'
line 3:1 no viable alternative at character 'm'
line 3:2 no viable alternative at character 'e'
line 3:4 mismatched character 'a' expecting 'r'
line 3:6 no viable alternative at character 'h'
line 3:8 mismatched character 't' expecting 'r'
line 3:9 no viable alternative at character 'p'
line 3:11 required (...)+ loop did not match anything at character 'e'
line 3:11 no viable alternative at character 'e'
line 3:12 no viable alternative at character 'q'
line 3:13 no viable alternative at character 'u'
line 3:14 no viable alternative at character 'i'
line 3:15 no viable alternative at character 'v'
line 3:16 no viable alternative at character '='
line 3:32 no viable alternative at character 'c'
line 3:33 no viable alternative at character 'o'
line 3:35 mismatched character 't' expecting 'u'
line 3:36 no viable alternative at character 'e'
line 3:38 mismatched character 't' expecting 'u'
line 3:39 no viable alternative at character '='
line 3:70 no viable alternative at character '/'
line 3:71 no viable alternative at character '>'
line 4:0 no viable alternative at character '<'
line 4:2 mismatched character 'i' expecting 'r'
line 4:4 mismatched character 'l' expecting 'r'
line 4:5 no viable alternative at character 'e'
line 4:6 no viable alternative at character '>'
line 4:7 no viable alternative at character 'E'
line 4:8 no viable alternative at character 'r'
line 4:9 no viable alternative at character 'r'
line 4:10 no viable alternative at character 'o'
line 4:11 no viable alternative at character 'r'
line 4:17 no viable alternative at character '<'
line 4:18 no viable alternative at character '/'
line 4:20 mismatched character 'i' expecting 'r'
line 4:22 mismatched character 'l' expecting 'r'
line 4:23 no viable alternative at character 'e'
line 4:24 no viable alternative at character '>'
line 5:0 no viable alternative at character '<'
line 5:1 no viable alternative at character '/'
line 5:2 no viable alternative at character 'h'
line 5:3 no viable alternative at character 'e'
line 5:4 no viable alternative at character 'a'
line 5:5 no viable alternative at character 'd'
line 5:6 no viable alternative at character '>'
line 6:0 no viable alternative at character '<'
line 6:1 no viable alternative at character 'b'
line 6:2 no viable alternative at character 'o'
line 6:3 no viable alternative at character 'd'
line 6:4 no viable alternative at character 'y'
line 6:5 no viable alternative at character '>'
line 7:0 no viable alternative at character '<'
line 7:1 no viable alternative at character 'h'
line 7:3 no viable alternative at character '>'
line 7:4 no viable alternative at character 'H'
line 7:5 no viable alternative at character 'T'
line 7:6 no viable alternative at character 'T'
line 7:7 no viable alternative at character 'P'
line 7:9 no viable alternative at character 'E'
line 7:10 no viable alternative at character 'R'
line 7:11 no viable alternative at character 'R'
line 7:12 no viable alternative at character 'O'
line 7:13 no viable alternative at character 'R'
line 7:19 no viable alternative at character '<'
line 7:20 no viable alternative at character '/'
line 7:21 no viable alternative at character 'h'
line 7:23 no viable alternative at character '>'
line 8:0 no viable alternative at character '<'
line 8:1 no viable alternative at character 'p'
line 8:2 no viable alternative at character '>'
line 8:3 no viable alternative at character 'P'
line 8:4 no viable alternative at character 'r'
line 8:5 no viable alternative at character 'o'
line 8:6 no viable alternative at character 'b'
line 8:7 no viable alternative at character 'l'
line 8:8 no viable alternative at character 'e'
line 8:9 no viable alternative at character 'm'
line 8:11 no viable alternative at character 'a'
line 8:12 no viable alternative at character 'c'
line 8:13 no viable alternative at character 'c'
line 8:14 no viable alternative at character 'e'
line 8:15 no viable alternative at character 's'
line 8:16 no viable alternative at character 's'
line 8:17 no viable alternative at character 'i'
line 8:19 mismatched character 'g' expecting 'u'
line 8:21 no viable alternative at character '/'
line 8:22 no viable alternative at character 'a'
line 8:23 no viable alternative at character 'p'
line 8:24 no viable alternative at character 'i'
line 8:25 no viable alternative at character '/'
line 8:26 no viable alternative at character 'v'
line 8:28 no viable alternative at character '/'
line 8:29 no viable alternative at character 'p'
line 8:30 no viable alternative at character 'r'
line 8:31 no viable alternative at character 'o'
line 8:33 mismatched character 'i' expecting 'a'
line 8:34 no viable alternative at character 'l'
line 8:35 no viable alternative at character 'e'
line 8:36 no viable alternative at character 's'
line 8:37 no viable alternative at character '/'
line 8:38 no viable alternative at character '.'
line 8:40 no viable alternative at character 'R'
line 8:41 no viable alternative at character 'e'
line 8:42 no viable alternative at character 'a'
line 8:43 no viable alternative at character 's'
line 8:44 no viable alternative at character 'o'
line 8:46 mismatched character ':' expecting 'u'
line 9:0 no viable alternative at character '<'
line 9:1 no viable alternative at character 'p'
line 9:2 no viable alternative at character 'r'
line 9:3 no viable alternative at character 'e'
line 9:4 no viable alternative at character '>'
line 9:9 no viable alternative at character 'N'
line 9:10 no viable alternative at character 'o'
line 9:12 mismatched character ' ' expecting 'r'
line 9:13 no viable alternative at character 'F'
line 9:14 no viable alternative at character 'o'
line 9:15 no viable alternative at character 'u'
line 9:17 mismatched character 'd' expecting 'u'
line 9:18 no viable alternative at character '<'
line 9:19 no viable alternative at character '/'
line 9:20 no viable alternative at character 'p'
line 9:21 no viable alternative at character 'r'
line 9:22 no viable alternative at character 'e'
line 9:23 no viable alternative at character '>'
line 9:24 no viable alternative at character '<'
line 9:25 no viable alternative at character '/'
line 9:26 no viable alternative at character 'p'
line 9:27 no viable alternative at character '>'
line 10:0 no viable alternative at character '<'
line 10:1 no viable alternative at character 'h'
line 10:2 no viable alternative at character 'r'
line 10:4 no viable alternative at character '/'
line 10:5 no viable alternative at character '>'
line 10:6 no viable alternative at character '<'
line 10:7 no viable alternative at character 'i'
line 10:8 no viable alternative at character '>'
line 10:9 no viable alternative at character '<'
line 10:10 no viable alternative at character 's'
line 10:11 no viable alternative at character 'm'
line 10:12 no viable alternative at character 'a'
line 10:13 no viable alternative at character 'l'
line 10:14 no viable alternative at character 'l'
line 10:15 no viable alternative at character '>'
line 10:16 no viable alternative at character 'P'
line 10:17 no viable alternative at character 'o'
line 10:18 no viable alternative at character 'w'
line 10:19 no viable alternative at character 'e'
line 10:20 no viable alternative at character 'r'
line 10:21 no viable alternative at character 'e'
line 10:22 no viable alternative at character 'd'
line 10:24 no viable alternative at character 'b'
line 10:25 no viable alternative at character 'y'
line 10:27 no viable alternative at character 'J'
line 10:28 no viable alternative at character 'e'
line 10:30 mismatched character 't' expecting 'r'
line 10:31 no viable alternative at character 'y'
line 10:33 no viable alternative at character '/'
line 10:34 no viable alternative at character '/'
line 10:35 no viable alternative at character '<'
line 10:36 no viable alternative at character '/'
line 10:37 no viable alternative at character 's'
line 10:38 no viable alternative at character 'm'
line 10:39 no viable alternative at character 'a'
line 10:40 no viable alternative at character 'l'
line 10:41 no viable alternative at character 'l'
line 10:42 no viable alternative at character '>'
line 10:43 no viable alternative at character '<'
line 10:44 no viable alternative at character '/'
line 10:45 no viable alternative at character 'i'
line 10:46 no viable alternative at character '>'
line 11:0 no viable alternative at character '<'
line 11:1 no viable alternative at character '/'
line 11:2 no viable alternative at character 'b'
line 11:3 no viable alternative at character 'o'
line 11:4 no viable alternative at character 'd'
line 11:5 no viable alternative at character 'y'
line 11:6 no viable alternative at character '>'
line 12:0 no viable alternative at character '<'
line 12:1 no viable alternative at character '/'
line 12:2 no viable alternative at character 'h'
line 12:4 mismatched character 'm' expecting 'r'
line 12:5 no viable alternative at character 'l'
line 12:6 no viable alternative at character '>'
line 3:17 no viable alternative at input '"Content-Type"'

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Harrie H. avatar image
Harrie H. answered ·

Yes, I did that, but this is before building in the configure screen. I did specify the profile there.

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Harrie H. avatar image
Harrie H. answered ·

This results in:


               
Starting session recording via Dynatrace Server REST interface...
ERROR: Dynatrace AppMon Plugin - build set up failed (see the stacktrace to get more information):
com.dynatrace.sdk.server.exceptions.ServerResponseException: Not Found
[Pipeline] {
[Pipeline] appMonRegisterTestRun
Failed to set up environment for Dynatrace AppMon Plugin - test run won't be registered

When calling the plugin from the jenkins pipeline script.

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Harrie H. avatar image
Harrie H. answered ·

Hi, very excited. Small problem doh, if I configure our dynatrace server in the plugin setup and I run test connection it says: Connection failure - System profile with the given name could not be found

But I can not specify a system profile... do we need to create a profile with a specific name?

1 comment Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

On the page I linked it states how to define a system profile. Is the following not working for you?

appMonBuildEnvironment(systemProfile: 'test_jenkins') {
    //your pipeline logic
}
0 Likes 0 · ·