如何从 TeamCity 中提取工件? [英] How can I pull artifacts from TeamCity?
问题描述
我想从 teamcity 中提取工件.
I would like to pull artifacts from teamcity.
我一直在尝试使用 c# 和 HtmlAgilityPack 来访问网站并找到最新版本及其工件.我目前卡在登录状态,我想我只需要发送会话 Cookie.
I've been trying to use c# and the HtmlAgilityPack to goto the website and find the latest version and its artifacts. I'm currently stuck at the login, I think I just need to be sending Session Cookies out.
我的方向是否正确,有没有其他人尝试过?
Am I going in the right direction, has anyone else tried this?
我意识到使用构建脚本推送文件很容易,但我希望尽量减少对 Ant、NAnt 文件的更改,因为我正在考虑将其扩展到 100 个应用程序.
I realize that pushing files out with the build scripts is easy but I'd like to minimize changes to the Ant,NAnt files since I'm looking at scaling this to 100 apps.
这个问题看起来很有希望从登录后的页面获取 HTML
this question looks promising Getting HTML from a page behind a login
现在可以了,我只需要编写一些代码来解析它
this works now, I just need to write some code to parse it
WebClient ww = new WebClient();
ww.Credentials = CredentialCache.DefaultCredentials;
ww.DownloadString("http://yourteamcity.com/login.html");
ww.Headers.Add("Cookie",ww.ResponseHeaders["Set-Cookie"]);
NameValueCollection post = new NameValueCollection();
post.Add("username", "name");
post.Add("remember","true");
post.Add("submitLogin", "Login");
post.Add("publicKey","long thing to intercept with fiddler");
post.Add("encryptedPassword","not giving you this");
post.Add("_", "");
byte[] values = ww.UploadValues("http://yourteamcity.com/loginSubmit.html", "POST",post);
string s = ww.DownloadString("http://yourteamcity.com/overview.html");
推荐答案
有更简单的解决方案,请阅读:http://www.jetbrains.net/confluence/display/TCD4/Patterns+For+Accessing+Build+Artifacts
There are simpler solutions, please read this: http://www.jetbrains.net/confluence/display/TCD4/Patterns+For+Accessing+Build+Artifacts
这篇关于如何从 TeamCity 中提取工件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!