Johnsel
1
Hello, I don’t seem to be able to download a build artifact using wget - using chrome works fine.
output is as follows:
wget -O -J -L 'https://circleci.com/api/v1/project/industrial-tech-group/helix-wifi/latest/artifacts/0/$CIRCLE_ARTIFACTS/bin/helix-wifi.tar.gz?circle-token=REDACTED'
--2016-09-08 05:49:34-- https://circleci.com/api/v1/project/industrial-tech-group/helix-wifi/latest/artifacts/0/$CIRCLE_ARTIFACTS/bin/helix-wifi.tar.gz?circle-token=REDACTED
Resolving circleci.com... 52.205.228.211, 52.206.65.249, 52.206.72.199, ...
Connecting to circleci.com|52.205.228.211|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://8-67556989-gh.circle-artifacts.com/0//tmp/circle-artifacts.UNH6gXE/bin/helix-wifi.tar.gz [following]
--2016-09-08 05:49:34-- https://8-67556989-gh.circle-artifacts.com/0//tmp/circle-artifacts.UNH6gXE/bin/helix-wifi.tar.gz
Resolving 8-67556989-gh.circle-artifacts.com... 54.82.226.108, 52.73.233.25, 52.22.196.126, ...
Connecting to 8-67556989-gh.circle-artifacts.com|54.82.226.108|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://circleci.com/auth/artifacts/fetch-nonce?redirect-to=https%3A%2F%2F8-67556989-gh.circle-artifacts.com%2F0%2F%2Ftmp%2Fcircle-artifacts.UNH6gXE%2Fbin%2Fhelix-wifi.tar.gz&scope=gh%2Findustrial-tech-group%2Fhelix-wifi%2F8 [following]
--2016-09-08 05:49:35-- https://circleci.com/auth/artifacts/fetch-nonce?redirect-to=https%3A%2F%2F8-67556989-gh.circle-artifacts.com%2F0%2F%2Ftmp%2Fcircle-artifacts.UNH6gXE%2Fbin%2Fhelix-wifi.tar.gz&scope=gh%2Findustrial-tech-group%2Fhelix-wifi%2F8
Connecting to circleci.com|52.205.228.211|:443... connected.
HTTP request sent, awaiting response... 400 Bad Request
2016-09-08 05:49:36 ERROR 400: Bad Request.
1 Like
seanm
2
I have also run into this.
Please return the 302 with the same circle-token on it as the user sent in to fix this. Here is a dump from curl to demonstrate the current behavior.
> GET /api/v1/project/ElementAnalytics/workbench-frontend/latest/artifacts/0/$CIRCLE_ARTIFACTS/dist.tar.gz?circle-token=[SNIP] HTTP/1.1
> Host: circleci.com
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 302 Found
< Access-Control-Allow-Origin: *
< Content-Type: text/plain; charset=utf-8
< Date: Mon, 17 Oct 2016 15:02:21 GMT
< Location: https://159-67823348-gh.circle-artifacts.com/0/tmp/circle-artifacts.YCe2YqI/dist.tar.gz
< Server: nginx
< Set-Cookie: ring-session=[snip];Path=/;HttpOnly;Expires=Tue, 17 Oct 2017 10:29:30 +0000;Max-Age=31536000;Secure
< Set-Cookie: ab_test_user_seed=0.09608844638273939;Expires=Tue, 17 Oct 2017 15:02:21 +0000;Path=/;Secure
< Strict-Transport-Security: max-age=15724800
< X-Circleci-Identity: i-89ea899f
< X-Circleci-Request-Id: 0e3b564f-3d8d-49ea-b262-8de5c1aa381c
< X-Circleci-Scopes: :write-settings
< X-Circleci-Scopes: :view-builds
< X-Circleci-Scopes: :read-settings
< X-Circleci-Scopes: :trigger-builds
< X-Circleci-Scopes: :all
< X-Circleci-Scopes: :status
< X-Circleci-Scopes: :none
< X-Frame-Options: DENY
< X-Route: /artifacts/:container-index/*
< X-Route: :container-index
< X-Route: \d+
< X-Route: :build_num
< X-Route: \d+
< Content-Length: 3
< Connection: keep-alive
<
Same here: I tried with curl
using both --location-trusted -u $TOKEN:
and -L $URL\?circle-token\=$TOKEN
Also tried adding cookie tracking with -c
, still does not help. The last redirect looks like:
< HTTP/1.1 302 Found
< Location: https://circleci.com/auth/artifacts/fetch-nonce?redirect-to=https%3A%2F%2F3-78872695-gh.circle-artifacts.com%2F0%2Ftmp%2Fcircle-artifacts.lCfGoVv%2FmyFile.txt&scope=gh%2FMyOrg%2FmyProject%2F3
< Set-Cookie: ring-session=asdfasdfasdf%3D;Path=/;HttpOnly;Expires=Wed, 14 Feb 2018 04:33:29 +0000;Max-Age=31536000;Secure
which, when followed (sending the cookie) results in the HTTP/1.1 400 Bad Request
.
tom
4
To download individual artifacts via the API you need to get the artifact URL. This is documented here: https://circleci.com/docs/api/v1-reference/#build-artifacts
Also note that the value of circle-token
should be set to a valid API token that you create from your account page: https://circleci.com/account/api
A shortcut for downloading all artifacts for a build is described here: Download all artifacts for a build on CircleCI