I am triggering a job in jenkins (from XL Release) to carry out code analysis. Is it possible to get the coverage reports(generated as .csv format) as an attachment to xl release ?
Thanks for posting! As far as I am aware, adding attachments is not currently possible using the public API. In order to access information such as this, we internally tend to use links to the documents, rather than attachments, since that avoids duplication of data.
If it's necessary to look at the data from within XL Release, without following a link to an external system, we usually retrieve the data and paste it as a Markdown code block in a comment. XL Release comments are Markdown-aware, and this usually renders the file content in a way that's pretty easy to read.
Here are some screenshots from a simple example template that demonstrates both approaches.
- The template: http://i.imgur.com/LsKeqOT.png
- The file to be retrieved, as shown by Jenkins: http://i.imgur.com/7S0WaKS.png
- The "trigger a Jenkins build" task. We're using an output variable here to capture the build number: http://i.imgur.com/8fkER5P.png
- The script task that makes an HTTP GET request to retrieve the file contents and add them to the task as a comment. Note the
print '```'lines that turn the response body into a Markdown-rendered code block: http://i.imgur.com/Lf9U9Qy.png
- A task with links to a workspace file and a build artifact. Note the use of variables in the Markdown links: http://i.imgur.com/Wnuoty6.png
- The body of the retrieved file in the comment: http://i.imgur.com/lZgT0hm.png
Hope that helps!
PS: If possible, I would recommend storing the desired file as a build artifact in Jenkins, rather than keeping it in the workspace. That avoids the possible race condition in which a new build of the job is kicked off and overwrites the file we're trying to retrieve before we have a chance to capture its contents.