-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incorporate release.rss generation into our build process (#257)
* Remove legacy build tooling, we have long since migrated * Update and move the releas.rss.groovy generation into the site build process This doesn't make sense to execute as a separate process, we can just put it inline with our existing site generation infrastructure Fixes INFRA-663 * Ensure the fetchReleaseHistory task will execute if build/ does not yet exist With a clean clone, this was breaking
- Loading branch information
R. Tyler Croy
committed
May 23, 2016
1 parent
447c4fd
commit 48f44ff
Showing
2 changed files
with
80 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env groovy | ||
/* | ||
generate the plugin/core release history RSS | ||
Usage: release-rss.groovy <URL of release-hisotory.json> | ||
*/ | ||
|
||
import groovy.json.JsonSlurper | ||
import groovy.xml.MarkupBuilder | ||
import java.text.* | ||
|
||
def xsd(dt) { | ||
s = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(dt); | ||
return s[0..-3]+':'+s[-2..-1] | ||
} | ||
def df = new SimpleDateFormat("MMM dd, yyyy"); | ||
|
||
def json = new JsonSlurper().parse(new URL(args[0])); | ||
|
||
def toGA(gav) { | ||
return gav.substring(0,gav.lastIndexOf(':')) | ||
} | ||
|
||
def first = [:]; // GA -> GAV to indicate the first version of the release | ||
json.releaseHistory.reverse().each { i -> | ||
i.releases.each { r -> | ||
gav = r.gav | ||
if (gav) { | ||
first[toGA(gav)] = gav | ||
} | ||
} | ||
} | ||
|
||
def xml = new MarkupBuilder(new OutputStreamWriter(System.out)) | ||
xml.feed(xmlns:"http://www.w3.org/2005/Atom") { | ||
title("Jenkins plugin releases") | ||
link(href:"http://jenkins-ci.org/") | ||
link(href:"http://kohsuke.org/test.atom",rel:"self",type:"application/atom+xml") | ||
updated(xsd(new Date())) | ||
author { name("Jenkins History Bot") } | ||
id("urn:63067410335c11e0bc8e0800200c9a66:feed") | ||
|
||
json.releaseHistory.reverse().subList(0,30).each { i -> | ||
i.releases.each { r -> | ||
if (r.gav) { | ||
entry { | ||
s = (first[toGA(r.gav)] == r.gav) ? " (new)" : "" | ||
title("${r.title} ${r.version}${s}") | ||
link(href:r.wiki,rel:"alternate",type:"text/html") | ||
id("urn:63067410335c11e0bc8e0800200c9a66:${r.gav}") | ||
pubished(xsd(new Date(r.timestamp))) | ||
updated(xsd(new Date(r.timestamp))) | ||
summary("${r.title} ${r.version}") | ||
} | ||
} | ||
} | ||
} | ||
} |