scientific-python / circleci-artifacts-redirector-action

GitHub Action to add a GitHub status link to a CircleCI artifact.
MIT License
14 stars 8 forks source link

Artifact not found #19

Closed jschueller closed 2 years ago

jschueller commented 2 years ago

we've been using this extension for a while now and recently the link stopped working, for example in https://github.com/openturns/openturns/pull/1995 the link provided is https://9096-40717169-gh.circle-artifacts.com/0/html/index.html which results in an "Artifact not found" page if I follow the artifact link from the circleci job I see that it ends at: https://output.circle-artifacts.com/output/job/7d1e22b0-669f-42f8-a1c1-442ab387aa06/artifacts/0/html/index.html should something be updated here, or is circleci wrong ?

the link job should be pretty standard: https://github.com/openturns/openturns/blob/master/.github/workflows/circleci.yml

larsoner commented 2 years ago

@jschueller would you be up for fixing the link? There is a description here that matches yours:

https://github.com/larsoner/circleci-artifacts-redirector/issues/8

I can get to it later this week if you can't

jschueller commented 2 years ago

I'm no good in javascript, but I can see it should be around here: https://github.com/larsoner/circleci-artifacts-redirector-action/blob/master/dist/index.js#L26200

jschueller commented 2 years ago

maybe this could be useful: https://discuss.circleci.com/t/artifact-urls-now-private/43282

lesteve commented 2 years ago

I looked a bit at this and my feeling is that the URL was easy to construct from the build number before but this is not the case anymore.

It seems like using the CircleCI REST API is the only way to get the artifacts URL. This is something that works to get all the artifacts with their URLs for scikit-learn and build number 185345:

curl https://circleci.com/api/v1.1/project/gh/scikit-learn/scikit-learn/185345/artifacts

Playing a bit with the CircleCI API:

jschueller commented 2 years ago

it works too with API v2: curl https://circleci.com/api/v2/project/gh/scikit-learn/scikit-learn/185345/artifacts

larsoner commented 2 years ago

Great, so now we "just" need to update the JS to fetch and extract the URL. Any volunteer? If not, I can try to look today.

lesteve commented 2 years ago

it works too with API v2: curl https://circleci.com/api/v2/project/gh/scikit-learn/scikit-learn/185345/artifacts

Indeed :thinking:, I think I was using github rather than gh, which works with some API endpoints but not others apparently :shrug:

kumavis commented 2 years ago

@larsoner seems you can do this as well https://output.circle-artifacts.com/output/job/${process.env.CIRCLE_WORKFLOW_JOB_ID}/artifacts/0

jschueller commented 2 years ago

thanks a lot!

lesteve commented 2 years ago

Thanks!