Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-32946] Remove attempt to fetch release info from code.google…
….com.
  • Loading branch information
Christopher Orr committed Apr 22, 2016
1 parent b776a46 commit 4e302ce
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions golang.groovy
Expand Up @@ -5,32 +5,22 @@ import com.gargoylesoftware.htmlunit.WebClient

import net.sf.json.*

// Fetch the latest downloads from the Go website
def latestUrl = "http://golang.org/dl/"
// Fetch the list of downloads from the Go website
def downloadsUrl = "http://golang.org/dl/"

// Also fetch the list of downloads archived at Google Code, ordered newest to oldest.
// We can't just scrape their Atom feed, as it only contains files tagged as "current"
def olderUrl = "https://code.google.com/p/go/downloads/list?can=1&sort=-uploaded&num=10000"

// Gather a list of URLs from both sources
// Gather a list of URLs
def urls = []

// Disable JS, as we don't care about it
WebClient webClient = new WebClient()
webClient.setJavaScriptEnabled(false);

// Fetch URLs in order from latest...
HtmlPage latest = webClient.getPage(latestUrl)
latest.selectNodes("//td/a").each { HtmlAnchor e ->
// Fetch the page and gather the links
HtmlPage page = webClient.getPage(downloadsUrl)
page.selectNodes("//td/a").each { HtmlAnchor e ->
urls << e.getHrefAttribute()
}

// ..to oldest
HtmlPage older = webClient.getPage(olderUrl)
older.selectNodes("//td/a[starts-with(@href, '//go.googlecode.com/files/')]").each { HtmlAnchor e ->
urls << "https:" + e.getHrefAttribute()
}

// Build a map of Go versions -> platform archives
def releases = [:]
urls.each { url ->
Expand Down

0 comments on commit 4e302ce

Please sign in to comment.