Using TC REST API to get artifacts by pattern

Hi,

I was wondering if there's a way of using the TC REST API to download artifacts using a patter match. Something like:

MyArchive.zip!/MyFile.???

I know I can retrive an artifact using something like this:

http://myserver:8080/app/rest/builds/id:123/artifacts/content/MyArchive.zip

Would there be anything similar to:

http://myserver:8080/app/rest/builds/id:123/artifacts/content/MyArchive.zip!/MyFile.???

Thanks,
Gabe.

6 comments
Comment actions Permalink

Hi Gabriel,

Do you want the pattern to be resolved to several files? If so, the only viable way to get several files seems to be within an archive.
There is an experimental way to get several artifacts in an archive in TeamCity 9.0, but it's use is very limited for now and it does not support getting multiple files from within an archive.

0
Comment actions Permalink

<comment was deleted>

0
Comment actions Permalink

Hi Yegor,

You said:

"the only viable way to get seveal files seems to be within an archive"

But later you also said:

"does not support getting multiple files from within an archive"

So I was a little confused by your answer.

What I would like to do is resolve multiple files from an archived artifact. I saw TC 9 has a resource in the REST API  that ends with 'archive' (or something like that) to compress multiple files into a single download. Is that something I could use? If so, how could I specify the pattern to select the artifacts I want?

Thanks,
Gabe.

0
Comment actions Permalink

Gabriel,

The request /app/rest/builds/XXX/artifacts/archived/<path within build artifacts>?locator=... is the experimentl ability added in 9.0 to get several files archived.
However, my note was that <path within build artifacts> cannot span across the archive boundary at this time ("!" in it is not dyuly supported).
Moreover, "locator" syntax will change in the future versions of TeamCity (that can be 9.0.x or 9.x releases).

At this time I'd not recommend using the approach and would write a script to get  entire archive and extract the files required.

0
Comment actions Permalink

I've got it now Yegor.

Your advice sounds like the better approach until the archived REST API supports extracting archives.

Thanks a lot.

Gabe.

0
Comment actions Permalink

I have a problem which seems similar:

Our build process produces completely packaged single file artifacts. I'm able to put a single artifact which is intended for public download in a specific artifact folder e.g. /artifacts/content/public/ but there is no way to know the exact name of the artifact at build time.

I would like to publish a simple download link for this artifact but so far im not able to access it without knowing its exact name. All I managed to do so far is publish it wrapped into an additional archive with  /artifacts/archived/public/ and potentially a locator argument. This complicates handling on the receiver side.

Is there a way to access this artifact "as is"?

The best option for us would be to support a locator for artifacts smiliar to e.g. <build_locator>. But this is not implemented so far. Is there another simple option which I am missing without hosting the artifacts ourselves? Im looking for something like an option to just return the first file in the folder or not wrap the target folder into an archive if it contains just one file.

Thank you,

Yuliy

0

Please sign in to leave a comment.