circleci / circleci-docs

Documentation for CircleCI.
https://circleci.com/docs/
Other
785 stars 1.3k forks source link

Suggestion: add a one-liner for downloading all artefacts from a workflow #8537

Open Pyrrha opened 8 months ago

Pyrrha commented 8 months ago

Hello,

After my contribution in #8502, I encountered the use case of downloading artefacts from multiple jobs (e.g. a pipeline release which produces several artefacts, that we want to retrieve). My workaround was:

curl --silent --request GET --url https://circleci.com/api/v2/workflow/:workflow_id/job --header "Circle-Token: $CIRCLE_TOKEN" \
  | jq '.items[].job_number' \
  | xargs -I {} curl --silent --request GET --url 'https://circleci.com/api/v2/project/:vcs/:org/:project/{}/artifacts' --header "Circle-Token: $CIRCLE_TOKEN" \
  | grep -o -E 'https://([^"]*)' \
  | wget --verbose --header "Circle-Token: $CIRCLE_TOKEN" --no-verbose --input-file -

Is it a common use case I can document into a new PR? Also, it's using API v2. I also can submit a fix for #8502 using v2 too.

Thanks.

rosieyohannan commented 8 months ago

Thanks so much for this @Pyrrha! Let me check and get back to you :-D

Pyrrha commented 8 months ago

Hello,

@rosieyohannan any news about the coherence of this script with CircleCI usage?

Thanks.

rosieyohannan commented 7 months ago

Hello! @Pyrrha! We would like to add this solution to the docs. You are welcome to submit a PR and we can take it from there, or alternatively we can add this work to our backlog internally. Thanks!