Allow jobs to know URIs of artifacts they create

When a build creates an artifact, it would often be useful if it can easily announce it for people to view or download, especially since there is no persistent URL we can give people that will always fetch the artifact from the latest successful build of a project.

I think a good way to do this would be if CircleCI set an environment variable to the beginning of the artifact URI, e.g. ARTIFACT_URI_BASE=“https://36-74386167-gh.circle-artifacts.com/0/”. We could then concatenate in our code and come up with a URI like https://36-74386167-gh.circle-artifacts.com/0/home/docker/project/build/phpunit/coverage-html/index.html which we could use in notifications, logs, etc.

1 Like

Could you get this data from the CircleCI API? I wonder if it would be available in the past builds info endpoint?

Yes, you can get it with the API as described at https://circleci.com/docs/api/#artifacts . But it’s making a call to the API is relatively complicated and requires a token. Reading an environment variable would be much simpler.

I expect the API approach could be done in one (long) curl command, but fair enough.

Could you use the API now to do what you want, and then raise the feature suggestion on circleci.com/ideas to simplify it in the future?