Created
November 7, 2012 21:51
-
-
Save dotob/4034731 to your computer and use it in GitHub Desktop.
teamcity sample artifact vs. buildinfo
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
private Uri CreateArtefactUri(Build build) { | |
string finalArtifactName = string.Empty; | |
try { | |
string artifactInfoUriString = string.Format("http://{0}/guestAuth/repository/download/{1}/{2}/teamcity-ivy.xml", this.teamCityHost, this.buildType, build.Number); | |
using (WebClient wc = new WebClient()) { | |
var artefactInfo = wc.DownloadString(artifactInfoUriString); | |
XDocument artifactInfoXmlDoc = XDocument.Parse(artefactInfo); | |
foreach (var artifactElement in artifactInfoXmlDoc.Element("ivy-module").Element("publications").Elements("artifact").Where(e => e.Attribute("ext").Value == "exe")) { | |
var artifactName = artifactElement.Attribute("name").Value; | |
if (Regex.IsMatch(artifactName, this.artifactNameMatch)) { | |
finalArtifactName = artifactName; | |
} | |
} | |
} | |
} | |
catch (Exception exception) { | |
nlogger.Error("error while CreateArtefactUri for build: {0}, {1}", build, exception); | |
} | |
string artifactDownLoadUriString = string.Format("http://{0}/guestAuth/repository/download/{1}/{2}/{3}.exe", this.teamCityHost, this.buildType, build.Number, finalArtifactName); | |
var artifactDownLoadUri = new Uri(artifactDownLoadUriString); | |
return artifactDownLoadUri; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
I'm Maxim Manuylov from Oredev.
We have an issue in our tracker about listing build artifacts via REST: TW-20830 - can it help you? If yes, please vote for this issue.