How to get artifacts via http or ftp.

Hello,

I am trying to figure out how to retrieve all build artifacts from the last successful build via wget. I never know what the file names will be but I do know that the file types are always rpms. Both the TeamCity server and the machine where I am tring to retrieve the files to are Linux boxes. I am running into 2 problems:
1) I always have to login in the server.
Can I get the files as a guestuser? If so how?
2) I don't know the whole file name because a build number is part of the name.

Whatever I try doesn't get the artifacts only the login page.

This is what I have tried recently and it doesn't seem to work:
wget -r -l1 --no-host-directories --no-parent -A.rpm --user="" --http-passwd="]]>" "http://buildserver.com:8111/viewArtifacts.html/buildTypeId/bt19/buildId/lastSuccessful/"

Any suggestions?

Thanks,
-Dave

4 comments
Comment actions Permalink

The only way it seems you can do this now it to create a server side plugin and register a listener that will process the BuildFinished event...

public class TCListener{

private final SBuildServer myServer;

public TCListener(final SBuildServer server) {

myServer = server;

server.addListener(new BuildServerAdapter(){
public void buildFinished(RunningBuild build) {
final File dir = ArtefactsInfo.getArtefactsDir(server,
build.getBuildId());
processArtifacts(dir, build);
}
});
}

private void processArtifacts(final File dir, final RunningBuild build) {
String project = build.getProjectName();
String buildtype = build.getBuildTypeName();
String buildnumber = build.getBuildNumber();
// Copy the contents of the directory to a more wget friendly location ...
// for example -- /project/buildtype/buildnumber/
}

}

The processArtifacts method can then be coded to copy the contents of the directory to a more wget friendly location ...

Hope this helps...

scoheb

0
Comment actions Permalink

Hello,

"Dave Leskovac" <no_reply@jetbrains.com> wrote in message
news:20080977.1164655438400.JavaMail.itn@is.intellij.net...

Hello,

>

I am trying to figure out how to retrieve all build artifacts from the
last successful build via wget. I never know what the file names will be
but I do know that the file types are always rpms. Both the TeamCity
server and the machine where I am tring to retrieve the files to are Linux
boxes. I am running into 2 problems:
1) I always have to login in the server.
Can I get the files as a guestuser? If so how?


Yes, you can. If you enabled guest user login on the "Server configuration"
page then you can append guest=1 parameter to your URL and server will not
ask you for login.

2) I don't know the whole file name because a build number is part of the
name.


Probably we should allow to download artifact using the file pattern. Right
now I do not see other possibilities except writing your own plugin.

--
Pavel Sher

>

Whatever I try doesn't get the artifacts only the login page.

>

This is what I have tried recently and it doesn't seem to work:
wget -r -l1 --no-host-directories --no-parent -A.rpm --user="<username>" --http-passwd="<password>"
"http://buildserver.com:8111/viewArtifacts.html/buildTypeId/bt19/buildId/lastSuccessful/"

>

Any suggestions?

>

Thanks,
-Dave



0
Comment actions Permalink

Hello Dave,

I've written 2 small shell scripts to check last successful build and
retrieve one artifact "crm.war" by HTTP for some internal tasks.
It uses guest account.
Maybe you find this useful.

                                    1. check-new-crm.sh ###################

DATA_FILE=last_deployed

LAST_BUILD=`wget --timeout=30 -q -O -
"http://buildserver/viewLog.html?tab=buildResultsDiv&buildTypeId=bt80&buildId=lastSuccessful&guest=1"
| grep "build #" | sed "s/.build #\(\).*/\1/"`

  1. echo $ if

    1. echo "Some error with TeamServer"
    1. echo ${LAST_DEPLOYED}
    ; then exit fi if ; then LAST_DEPLOYED=`cat last_deployed` else LAST_DEPLOYED="" fi if [ ! "$" = "$" ] ; then

#echo "Deploing...."
./deploy-new-crm-test.sh
echo $ > $
fi
#####################################

                                1. deploy-new-crm-test.sh #############

#!/bin/sh

wget
"http://buildserver/viewArtifacts.html/buildTypeId/bt80/buildId/lastSuccessful/crm.war?guest=1"

mv crm.war?guest=1 crm.war

/sbin/service crm-test stop
rm -rf ~crm-test/jakarta-tomcat-5.0.28/webapps/internal/*
mv crm.war ~crm-test/jakarta-tomcat-5.0.28/webapps/internal/

/sbin/service crm-test start

###############################################

--
Sergey Zhukov
Chief System Administrator
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

"Dave Leskovac" <no_reply@jetbrains.com> wrote in message
news:20080977.1164655438400.JavaMail.itn@is.intellij.net...

Hello,

>

I am trying to figure out how to retrieve all build artifacts from the
last successful build via wget. I never know what the file names will be
but I do know that the file types are always rpms. Both the TeamCity
server and the machine where I am tring to retrieve the files to are Linux
boxes. I am running into 2 problems:
1) I always have to login in the server.
Can I get the files as a guestuser? If so how?
2) I don't know the whole file name because a build number is part of the
name.

>

Whatever I try doesn't get the artifacts only the login page.

>

This is what I have tried recently and it doesn't seem to work:
wget -r -l1 --no-host-directories --no-parent -A.rpm --user="<username>" --http-passwd="<password>"
"http://buildserver.com:8111/viewArtifacts.html/buildTypeId/bt19/buildId/lastSuccessful/"

>

Any suggestions?

>

Thanks,
-Dave



0
Comment actions Permalink

Sergey,

I've written 2 small shell scripts to check last
successful build and
retrieve one artifact "crm.war" by HTTP for some
internal tasks.


I can use some of the information from your scripts to write a shell script that will do what I want. Thanks very much. This is extremely helpful.

-Dave

0

Please sign in to leave a comment.