summaryrefslogtreecommitdiff
path: root/Gitlab CI job artifacts.md
blob: 97b05d5e962f6b1d09b7cd56ae7900c33d8f55f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
[Job artifacts](https://docs.gitlab.com/ci/jobs/job_artifacts/)

---
# Creation
Expose via 
```
artifacts:
  path:
    - blaat.txt
```
 > path is relative to repository where job was created
 
 Wildcards can be used: `*` in the path.
 Expiry can be set, ie: `expire_in: 1 week`.
`artifacts: name` to explicitly name the artifact.
# Using
Artifacts are downloaded into the job's working directory by default. If one specifies either: `dependencies` or `needs` only artifacts of jobs of those are downloaded.
`dependencies` only specifies which artifacts to download whereas `needs` also defined the relationship between jobs.
To prevent downloading dependencies at all just set `dependencies: []`.

Example:
```
dependencies:
  - build-gobs
  - build-goba
```

They can also be downloaded over http. Using the job token is allowed.
```plaintext
https://gitlab.com/api/v4/projects/<project-id>/jobs/artifacts/main/download?job=build
```

```
build_submodule:
  stage: test
  script:
    - apt update && apt install -y unzip
    - curl --location --output artifacts.zip "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/main/download?job=test&job_token=$CI_JOB_TOKEN"
    - unzip artifacts.zip
```