Skip to content

Instantly share code, notes, and snippets.

@markuman
Created May 26, 2015 18:44
Show Gist options
  • Save markuman/d5bafbae49045549a44a to your computer and use it in GitHub Desktop.
Save markuman/d5bafbae49045549a44a to your computer and use it in GitHub Desktop.
jenkins failed/pass ratio SVG
#!/bin/bash
JSON=$(curl --silent http://127.0.0.1:8080/job/mutest/lastBuild/testReport/api/json?pretty=true)
# get fail counts
FC=$(echo $JSON| sed s#,#\\n#g|grep failCount|awk -F : '{print$2}')
# get pass counts
PC=$(echo $JSON| sed s#,#\\n#g|grep passCount|awk -F : '{print$2}')
NC=$(echo $FC "/" $PC|sed 's/ //g')
sed s,unknown,"$NC",g counts.svg > test.svg
Display the source blob
Display the rendered blob
Raw
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" width="98" height="18">
<linearGradient id="a" x2="0" y2="100%">
<stop offset="0" stop-color="#fff" stop-opacity=".7"/>
<stop offset=".1" stop-color="#aaa" stop-opacity=".1"/>
<stop offset=".9" stop-opacity=".3"/>
<stop offset="1" stop-opacity=".5"/>
</linearGradient>
<rect rx="4" width="98" height="18" fill="#555"/>
<rect rx="4" x="37" width="61" height="18" fill="#9f9f9f"/>
<path fill="#9f9f9f" d="M37 0h4v18h-4z"/>
<rect rx="4" width="98" height="18" fill="url(#a)"/>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="19.5" y="13" fill="#010101" fill-opacity=".3">build</text>
<text x="19.5" y="12">ratio</text>
<text x="66.5" y="13" fill="#010101" fill-opacity=".3">unknown</text>
<text x="66.5" y="12">unknown</text>
</g>
</svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment