Build configuration creates multiple artifacts; need to download just one of them based on file pattern match

Pretty desperate here - I'm embarrassed to even tell you the number of hours I have spent on this problem. I have a build configuration which creates three artifacts. I'd like to download just one of these artifacts based on some pattern that exists in the filename. This is what I've tried so far:

http://<server>:<port>/guestAuth/app/rest/builds?locator=buildType:(id:MyBuildConfigID),status:SUCCESS,count:1&fields=build(id,artifact(file(name),$locator(recursive:true,pattern:*.tar.gz)),content)

http://<server>:<port>/guestAuth/downloadArtifacts.html?buildTypeId=MyBuildConfigID&buildId=lastSuccessful&artifactName?locator=pattern:*.zip 

http://<server>:<port>/guestAuth/app/rest/builds?locator=buildType:(id:MyBuildConfigID),status:SUCCESS,count:1&fields=build(id,artifacts(file(name),$locator(recursive:true,pattern:*.tar.gz)))

Is this even possible?

 

 

 

 

 

0
2 comments

Hi Laura,

If you check the REST API documentation (https://confluence.jetbrains.com/display/TCD18/REST+API#RESTAPI-BuildArtifacts), the request is a bit simpler:
<server_url>/app/rest/builds/<build_locator>/artifacts/content/<pattern>

I've tried passing id:xxx to the build locator and "*.jar" to the <pattern> and it attempts to download (although the pattern has to match exactly one result, not more)

Could you try that?

0
Avatar
Permanently deleted user

Denis,

Thank you so much for your help. Using the following URL(identifying info modified):

http://buildserver:port/guestAuth/app/rest/builds/buildType:(id:myBuildId),status:SUCCESS,count:1/artifacts/content/*.tar.gz

I get the contents of the archive downloaded as file with name  '_.tar.gz'; 

I wanted to download the archive by the archive name. 

For example, in the xml  displayed with URL http://buildserver:port/guestAuth/app/rest/builds/buildType:(id:myBuildId),status:SUCCESS,count:1/artifacts

I'd like to download the artifact "File1.tar.gz" as "File1.tar.gz".

*****************************************************************************

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<files count="3">
<file name="File1.tar.gz" size="60093702" modificationTime="20180802T130954-0500" href="/app/rest/builds/id:1450/artifacts/metadata/File1.tar.gz">
<content href="/app/rest/builds/id:1450/artifacts/content/File1.tar.gz"/>
</file>
<file name="File2.zip" size="12741125" modificationTime="20180802T130955-0500" href="File2.zip">
<content href="/app/rest/builds/id:1450/artifacts/content/File2.zip"/>
</file>
<file name="File3.zip" size="4454497" modificationTime="20180802T130954-0500" href="/app/rest/builds/id:1450/artifacts/metadata/File3.zip">
<content href="/app/rest/builds/id:1450/artifacts/content/File3.zip"/>
</file>
</files>
 
Thanks again for your help.
0

Please sign in to leave a comment.