I have automation project which i'm running through Jenkins . With build successful or failure all html reports are being displayed after i click on link "Cucumber Feature Level Overview Report" .
Added dependency in pom
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>email-ext</artifactId>
<version>2.25</version>
</dependency>
Added code in jenkins job :-
Section : Editable Email Notification -> Default Content
${FILE,path="https://jenkins.company.com/dareProject/job/Automation_Jobs/job/Dare_Project_job/Cucumber_Steps_Level_Overview_Report/"}
The mail which i'm getting with error :-
ERROR: File 'https://jenkins.company.com/dareProject/job/Automation_Jobs/job/Dare_Project_job/Cucumber_Steps_Level_Overview_Report/' does not exist
And how to display report in Body Text of email ?
The mail which i'm getting with error
In path parameter you must use the location of file in filesystem relative to job's workspace, not the hyperlink to it!
And how to display report in Body Text of email ?
Set correct path in Default Content field and choose HTML (text/html) in Content Type field.
Related
I'm new to apple scripting and I'm trying to copy two image from a folder and paste into outlook mail body, below is the code I have written so far to compose mail and I need help in pasting two images in the mail body.
I don't want it to be an attachment file, image needs to be pasted in mail body itself.
tell application "Microsoft Outlook"
activate
set theSubject to "Subject"
set theContent to "This is my content"
set theAttachmentFile to "XXXXX"
set sendToAddress to "abc"
set msg to make new outgoing message with properties {subject:theSubject, content:theContent} -> I'm missing something here
with properties {file:theAttachmentFile}
open msg
end tell
So in case if someone is struggling with this same question. I would like to answer what I implemented.
Compose your mail body content in html format and use img tag for inserting images in your mail body.
In Jenkins classic interface it is possible to create a link in the output console, but I can't see how I can make something clicable in the Blue Green interface.
You can get the solution here :
How to display a hyperlink in hudson/jenkins build output console
You can also use a workaround for that which is fairly customisable than the method mentioned above.
After finishing your build you can add functionality to your build to send a mail with the report link.
You can do it through the Jenkinsfile or using the job configuration as well.
The Jenkinsfile groovy script is as follows.
script {
emailext subject: ' REPORT-Version/'+ "${G_BRANCH}" + ' $DEFAULT_SUBJECT' ,
body: "Click the link below to show Mocha Testing Results for your current build :<br><br>BAE 4.5 Release Report" ,
attachLog: true,
replyTo: '$DEFAULT_REPLYTO',
to: '$DEFAULT_RECIPIENTS'
}
Through Job configuration you can go to Job --> Configure --> Post Build Actions --> Editable Email Notifications.
Well, it works almost out of the box. Blue Ocean automatically recognizes URL patterns and transform it in a clickable link. For example:
echo "CUCUMBER: ${BUILD_URL}cucumber-html-reports/overview-features.html"
Unfortunately it looks like it isn't possible to create a clickable arbitrary text.
I am using Cppcheck Plugin. I am trying to send Cppcheck Results URL in email once the Jenkins job is completed.
I tried setting Default Content to following:
View this URL for Cppcheck Results: $BUILD_URL + "cppcheckResult/"
But the email which I got had following text:
View this URL for Cppcheck Results: https://myurl/job/fscopy/7/+"cppcheckResult/"
Can someone help me figuring out how can I send correct URL in email which is following:
https://myurl/job/fscopy/7/cppcheckResult/
I managed to resolved it by creating CPPCHECK environment variable and using it as below:
View this URL for Cppcheck Results: $BUILD_URL$CPPCHECK
which gave me output in email as following:
View this URL for Cppcheck Results: https://myurl/job/fscopy/7/cppcheckResult/
For each build in jenkins there's a page with a short summary of what happened in that build.
In my setup this page contains the list of commit messages that were added in this build, the name of the user who started that build and a note from the git plugin about the commit SHA1 and the branch name.
Is there a way for a normal script that I run as a build step to add something to this page? Is there a plugin which allows this?
I want to add a line with an HTML link to where the user can download this build.
You can use the Description Setter plugin to add a custom HTML description.
A quick example :)
Does it help?
UPDATE: here is the syntax for a Jenkins pipeline script
currentBuild.description = "<a href='http://stackoverflow.com'>Stackoverbuild build" + env.BUILD_ID + "</a>"
I used Badge Plugin for something like this.
Example:
def summary1 = createSummary(icon:"notepad.png", text:"started Builds:<br>")
summary1.appendText("myBuild1: SUCCESS<br>", false)
summary1.appendText("myBuild2: UNSTABLE<br>", false)
I am using Grails 1.3.5, SQL Server 2005, iReports 3.7.6, Jasper Plugin 1.1.3. In my GSP page I have given the jasperReprt tag as:
<g:jasperReport jasper="report1" format="PDF">
<input type="hidden" name="test_id" id="test_id"/>
<input type="hidden" name="order_no" id="order_no" />
</g:jasperReport>
For development, in Config.groovy I have specified the
jasper.dir.reports = './reports'
There are two files created in the reports folder when a new report is created and saved, i.e. report.jrxml and report.jasper.
When clicked on the PDF icon in IE or Firefox, an 500 server error is thrown and below is stack trace.
[2010-11-27 01:13:14.998] ERROR groovy.grails.web.errors.GrailsExceptionResolver Invalid byte 1 of 1-byte UTF-8 sequence.
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:684)
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:554)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1742)
at
But if I delete the report1.jasper, the error is no longer thrown when PDF icon is clicked and the PDF report is shown fine.
Is this the correct way to do it?
My second issue is with using Sub Reports. Sub report is in the same folder as the main report. But When the report is executed from the application, below error is thrown:
[2010-11-27 01:30:27.556] ERROR groovy.grails.web.errors.GrailsExceptionResolver Could not load object from location : ./reports\report1sub_report.jasper
net.sf.jasperreports.engine.JRException: Could not load object from location : ./reports\urine_routinepatient_details_sub_report.jasper
at net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation(JRLoader.java:262)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateReport(JRFillSubreport.java:301)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:327)
It does not find the sub report. How can I fix it?
Thank you.
Jay Chandran.
Edit:
I have been searching during this whole time, but still could not find a proper solution. So I did some trial and error. I figured out that, deleting report1.jasper and just leaving jasper.jrxml in the report directory works just fine as I said earlier.
For the sub-report issue: It was giving error Could not load object from location : ./reports\report1sub_report.jasper For some strange reason, the main report name report was getting appended to the name sub_report.jasper and was looking for a file named report1sub_report.jasper
So I created a sub-folder under reports folder and named it report1 and updated report1.jrxml file
<subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "\\sub_report.jasper"]]></subreportExpression>
I had to add the extra \\ slash even though the "SUBREPORT_DIR" parameter had \\ the slashes at the end of the path as shown below.
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["F:\\Workspace\\SpringSource2.5.0\\GrailsProjec\\reports\\report1\\"]]></defaultValueExpression>
</parameter>
Notice the \\ at the end. I don't know why it was not getting appended!
Another way would have been to just change the sub-report name from sub_report.jasper
to report1sub_report.jasper!!! :)
I have tested this in production mode and it works fine. I am not sure if this is the way to do it, but all other possible solutions did not work for me.
Feedback will be very helpful.
I assume you have a version conflict here. iReport stores JRXML files and seems to compile them automatically to .jasper. The Grails Jasper plugin picks up the compile variant and gets into trouble with it. So try to disable compiled output in ireport.
The Grails Jasper plugin 1.1.3 uses internally Jasper 3.7.4, the used ireport is 3.7.6.
Regarding the sub reports: no idea.
The MalformedByteSequenceException is caused by a character encoding conflict. I'd suggest to use UTF-8 instead of Windows' Win-1252 (similar to ISO-8859-1) everywhere.
In Jasper's etc/ireport.conf file, change the default_options to:
default_options="-J-Dfile.encoding=UTF-8 -J-Xms24m -J-Xmx64m"
(Where Xms and Xmx are unrelated memory settings. If there are default settings with that config entry, you can overtake them, else, just leave them out.)
See this forum thread for alternative configurations.
As for the error with subreports, take a look at the backslash \ that's probably wrong.
EDIT : There is some information about two issues which maybe could help in
http://grails.org/plugin/jasper#faqTab
i hope i can help with one of the issues: which one related with subreports dir.
The problem is the plugin code sets SUBREPORT_DIR to the complete file path of main report, including its name. However the code honour the user provided param with the same name, so if you fill this param with whatever value except null the plugin will use it.
For example if you chain directly the jasper controller you can do:
def renderAs(data,format) {
def reportParams=params.clone()
reportParams["_format"]=reportParams["_format"]?:"${format.toUpperCase()}"
reportParams["SUBREPORT_DIR"]=CH.config.jasper.dir.reports+"/"
chain(controller:'jasper',action:'index',model:[data:[]+data],params:reportParams)
}
In your scenario an (ugly) option would be create an hidden input with name SUBREPORT_DIR and value the desired one. I would fill the paremeter in other way.
EDIT:
Another annoying problem is where do we have to put the main reports and compiled subreports:
When you run the app with run-app they work if you put them all in a folder with the same name as CH.config.jasper.dir.reports(reportDir) in the root of the grails app.
But if you want to deploy a war you have to put the main reports in a folder reportDir in the root of war file and compiled subreports in WEB-INF/classes/reportDir.
I've opted to keep all files in grailsApp/reports and copy the resources in the appropiate folders in the war grails task. In my BuildConfig.groovy i've added (reportDir is "reports"):
grails.war.resources = { stagingDir,args ->
def classpathDir="${stagingDir}/WEB-INF/classes"
copy(toDir:"${stagingDir}/reports") {
fileset(dir:"reports",includes:"**")
}
copy(toDir:"${classpathDir}/reports") {
fileset(dir:"reports",excludes:"**.jrxml")
}
}
Hope it helps.