If anyone stumbles across this, here's a nice breakdown about how artifacts work I figured when I was trying to do something simillar.
stages:
- build
- test
build hello:
stage: build
image: alpine:latest
script:
- echo "Hello $PWD" > hello.txt
artifacts:
paths:
- ./hello.txt
expire_in: 1 hour
build goodbye:
stage: build
image: alpine:latest
script:
- echo "Goodbye $PWD" > Goodbye.txt
artifacts:
paths:
- ./Goodbye.txt
expire_in: 1 hour
test goodbye:
stage: test
image: alpine:latest
script:
- test "`cat Goodbye.txt`" == "Goodbye $PWD"
dependencies:
- build goodbye
test hello:
stage: test
image: alpine:latest
script:
- test "`cat hello.txt`" == "Hello $PWD"
dependencies:
- build hello
test both:
stage: test
image: alpine:latest
script:
- test "`cat hello.txt`" == "Hello $PWD"
- test "`cat Goodbye.txt`" == "Goodbye $PWD"
test fail_hello:
stage: test
image: alpine:latest
script:
- test "`cat Goodbye.txt`" == "Goodbye $PWD"
dependencies:
- build hello
test fail_goodbye:
stage: test
image: alpine:latest
script:
- test "`cat hello.txt`" == "Hello $PWD"
dependencies:
- build goodbye
The test fail_ jobs will fail.
Other jobs will succeed.
Basically you can specify an artifact path to keep for a certain ammount of time, which you can use later. (even download it from the web GUI)
The way it works is you specify artifacts:
arrays in the jobs where you create them.
Then in the jobs where you want to use them, if you do not specify the dependencies:
array, you'll have all the previously created artifacts available.
If you want to have access only to artifacts from certain jobs, you can specify dependencies:
array, which will hold names to those jobs.