How can I pull artifacts from TeamCity?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-22 06:45:05

问题


I would like to pull artifacts from teamcity.

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?

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.

Edit: this question looks promising Getting HTML from a page behind a login

Edit: 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");

回答1:


There are simpler solutions, please read this: http://www.jetbrains.net/confluence/display/TCD4/Patterns+For+Accessing+Build+Artifacts



来源:https://stackoverflow.com/questions/190587/how-can-i-pull-artifacts-from-teamcity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!