Skip to content

v0.5.4

Compare
Choose a tag to compare
@YOU54F YOU54F released this 24 Feb 23:51

CircleCI Artifact Notes

CircleCI have recently changed the API for retrieving API's. A URL is generated for artefacts in the format

https://${CI_BUILD_NUM}-${CI_PROJECT_ID}-gh.circle-artifacts.com/0

You can get the CIRCLE_PROJECT_ID by checking https://circleci.com/docs/api/#artifacts-of-a-build

For example. the ID for this project is 177880476, you can see it in the following URL

https://circleci.com/api/v1.1/project/github/YOU54F/cypress-slack-reporter/1/artifacts

which will return

[ {
  "path" : "root/app/mochareports/.gitignore",
  "pretty_path" : "root/app/mochareports/.gitignore",
  "node_index" : 0,
  "url" : "https://1-177880476-gh.circle-artifacts.com/0/root/app/mochareports/.gitignore"
},
...
]

In order to correctly construct your artifact URL, you will need to manually retrieve this ID and set it as an env var titled CIRCLE_PROJECT_ID

EXPORT CIRCLE_PROJECT_ID=177880476

in windows

SET CIRCLE_PROJECT_ID=177880476

or in your CircleCI project's environment page.

I have raised a question on circleCI's support page to see if they can expose this as an env param

https://discuss.circleci.com/t/artifact-url-how-can-we-retrieve-the-project-id-programatically/34654