Skip to content

Commit 9e63c66

Browse files
authored
Document that build artifact URLs are encoded (circleci#2279)
* clean up steps * combine replacement notes into final step * there is one more than one command * move final note into explanation * fix comment and delete note * add newline and note about encoding * make zak's corrections - pipe *to* `grep`, not *through` `grep` - specify use of `wget` - clarify `xargs` flag - clarify command usage remove confusing "non-issue" statement * write out digit * move note up to follow image about uploads * move note after feature description
1 parent 53a80c3 commit 9e63c66

File tree

1 file changed

+42
-15
lines changed

1 file changed

+42
-15
lines changed

jekyll/_cci2/artifacts.md

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,20 @@ deployment tarballs, CircleCI can automatically save and link them for you.
2727

2828
![artifacts tab screeshot]( {{ site.baseurl }}/assets/img/docs/artifacts.png)
2929

30-
Find links to the artifacts at the top of the {% comment %} TODO: Job {% endcomment %}build page. Artifacts are stored on Amazon S3. There is a 3GB `curl` file size limit.
31-
32-
Artifacts are designed to be useful around the time of the build. It is best practice not to rely on artifacts as a software distribution mechanism with long term future guarantees.
30+
Find links to the artifacts at the top of the {% comment %} TODO: Job {% endcomment %}Build page.
31+
Artifacts are stored on Amazon S3.
32+
There is a 3GB `curl` file size limit.
33+
Artifacts are designed
34+
to be useful around the time of the build.
35+
It is best practice
36+
not to rely on artifacts as a software distribution mechanism with long term future guarantees.
37+
38+
**Note:**
39+
Uploaded artifact filenames are encoded
40+
using the [Java URLEncoder](https://docs.oracle.com/javase/7/docs/api/java/net/URLEncoder.html).
41+
Keep this in mind
42+
if you are expecting
43+
to find artifacts at a given path within the application.
3344

3445
## Uploading Artifacts
3546

@@ -124,28 +135,44 @@ When CircleCI runs a build, a link to the core dump file appears under the Artif
124135

125136
## Downloading All Artifacts for a {% comment %} TODO: Job {% endcomment %}Build on CircleCI
126137

127-
Use the following procedure to download your artifacts with `curl`.
138+
To download your artifacts with `curl`,
139+
follow these steps.
128140

129-
1. Create an API token in the application by going to [User Settings > Personal API Tokens](https://circleci.com/account/api).
141+
1. On the [Personal API Tokens](https://circleci.com/account/api) settings page,
142+
click **Create New Token**.
130143

131-
2. Click Create New Token, add a name in the dialog box and click Add API Token. Name tokens to help you remember where they are used.
144+
2. In the **Token name** field,
145+
add a name for this token
146+
to remind you how and where it is used.
132147

133-
3. Copy the token string that appears in the table.
148+
3. To create the API token,
149+
click the **Add API Token** button.
134150

135-
4. CD to a directory where you would like the artifacts files to be downloaded and run the following command, copying in the token from Step 3:
151+
4. Copy the token that appears in the field.
136152

137-
```
153+
5. In a Terminal window,
154+
`cd` to a directory
155+
where you want the artifact files.
156+
157+
6. Run the commands below,
158+
replacing all variables starting with a `:` with real values for your project.
159+
`:your_token` should be replaced with the token you copied earlier.
160+
`:vcs-type` is dependent on your version control system (either `github` or `bitbucket`).
161+
162+
```bash
138163
export CIRCLE_TOKEN=':your_token'
139164
140165
curl https://circleci.com/api/v1.1/project/:vcs-type/:username/:project/:build_num/artifacts?circle-token=$CIRCLE_TOKEN | grep -o 'https://[^"]*' > artifacts.txt
141166
142167
<artifacts.txt xargs -P4 -I % wget %?circle-token=$CIRCLE_TOKEN
143168
```
144169

145-
Note 1: Replace all the variables above that start with a *:* (colon) with real values for your project (don't include the colon).
146-
147-
Note 2: `:vcs-type` will be `github` or `bitbucket`.
148-
149-
Note 3: In the example, the `xargs` command runs four processes to download files in parallel. Adjust this value to your needs.
170+
The `curl` command fetches all artifact details for a {% comment %} TODO: Job {% endcomment %} build
171+
and pipes it to `grep` to extract the URLs.
172+
The results are saved to the `artifacts.txt` file.
173+
Finally, `xargs` reads the file
174+
and downloads each artifact to the current directory.
150175

151-
Explanation: The line beginning with `curl` fetches all the artifacts details for a {% comment %} TODO: Job {% endcomment %}build and pipes it through the `grep` command to extract just the URLs. The results are saved to the `artifacts.txt` file. Then, `xargs` reads the file and downloads each artifact to the current directory.
176+
In this example, `xargs` runs four processes
177+
to download files in parallel via `wget`.
178+
Adjust the value given to `-P` to fit your needs.

0 commit comments

Comments
 (0)