Referencing Latest Build Artifacts

shipped
artifacts

#6

This would be really nice :slight_smile:


#7

Hehe, I was about to post the same feature request but then found this post luckily :grin:

I was also looking at the API and playing around with it, but in the end it didn’t help as it requires a programmatic approach to get that info, not just a link.

So +1 for:

  • ability to reference the :latest build on a specific branch via URL
  • ability to have predictable artifact URLs (i.e. without the random string inbetween)

#8

I put this up as a “redirector service” to serve stable URLs for latest build and artifacts:
https://circleci-tkn.rhcloud.com/

Basically:

  • GET /api/v1/project/<user>/<project>/tree/<branch>/latest
  • GET /api/v1/project/<user>/<project>/tree/<branch>/latest/tests
  • GET /api/v1/project/<user>/<project>/tree/<branch>/latest/artifacts
  • GET /api/v1/project/<user>/<project>/tree/<branch>/latest/artifacts/<artifact>

Everything else GET /api/v1/* will be redirected as-is, i.e. you can use it as a drop-in replacement (unless you are using POST or DELETE)

Sure you can also host it yourself, source code is here:


#9

+1 It seem to me completely obvious that this would be a nice feature to have (without having to use the API). Use case: Badge in a README file that links to an html coverage report that is an artifact of the latest build.


#10

Be sure to click on the heart on the main feature request to show your “official support” for this feature.


#11

We are excited to announce that we have shipped support to retrieve your latest build artifacts. You can read more about it in our docs.


#12

Maybe I am missing something, but I still don’t see a way to link directly to the latest version of a build artifact. What I see in the docs is a way to list the artifacts of the latest build, which would then require grabbing the URL of the particular artifact I’m looking for from the url attribute of the json response. But those artifact URLs still have a build identifier in them, so e.g. there’s still not a stable link to the latest coverage report’s index.html file.


#13

I don’t see it either. The feature request as described in the OP is still not present.

Because this is so clunky I have to re-educate my test people all the time.

  1. Click http://blah/tree/master
  2. Click on the topmost very tiny build #
  3. Click on the tiny “Artifacts” tab swimming around in the middle of the page somewhere
  4. Finally go find the actual thing you wanted at the beginning over on the left somewhere

Far cry from a “download” link which is really all they should need.


#14

It’s certainly not convenient, and should probably be treated as a private implementation detail, but looking at the links in that post you can construct a link that will 302 redirect you to the actual artifact location as follows:

File.join(*[
  ENV["CIRCLE_BUILD_URL"], 
  ENV['CIRCLE_NODE_INDEX'],
  "artifacts",
  ENV["CIRCLE_ARTIFACTS"],
  "path/to/artifact.html",
])

#15

Hi All,

I found this project. Thought it is useful for this dicussion thread.
https://github.com/nbio/cart

Get an artifact from the latest green build of your current project’s master

$ cart path/to/artifact

#16

I am also very interested in this feature.

It would be great if this post could be marked unsolved so as to not cause confusion.


#17

Yeah this is not fixed. I build docs artifacts and would like to point to the latest docs in my README but this is not currently possible. The solution posted is only for API clients, whereas the OP (and I) would like a public URL that redirects/masks to the latest build.


#18

Same here, it’d be really nice to be able to link to latest docs and such generated during a build.


#19

Right, what’s wonderful about this idea is that it potentially allows us to not have to add a dependency to the API client in order to fetch the latest package. This is similar to a convention that many open source packages use, which is creating a latest.tar.gz along with a version_number.tar.gz, so you can auto-fetch that one.


#20

The reluctance to implement this is really baffling. It seems like it would be simple to implement, virtually no maintenance, and really useful for many people.


#21

Bump. I really want to link to latest nightly run artifacts from the projects readme.


#22

+1. I would also like to see this feature for my projects. I generate badges and test coverage reports as artifacts. It would be great if I could have links that always pointed to the latest ones.

I did find a url like this:

https://circleci.com/api/v1/project/Tethik/badger/latest/artifacts/0/badges/build.svg

From here

But it gives me 500 every time. And has for the past ~6 months.


#23

Using the following URL from the documentation works, but I also get 500 errors when I try this on my own repositories.

https://circleci.com/api/v1.1/project/github/circleci/mongofinil/latest/artifacts/0/$CIRCLE_ARTIFACTS/hello.txt

It would be great if we could get some input from a CircleCI employee here.


#24

Hey @Tethik and @Moose

This should be working. I wrote a wrapper around the API and this particular method worked for me on the first try.

Can you share the specific URL that you are using that is causing a 500 error?


#25