gitlab-org--gitlab-foss/lib/gitlab/ci/syntax_templates/Artifacts example.gitlab-ci...

53 lines
1.4 KiB
YAML

#
# You can use artifacts to pass data to jobs in later stages.
# For more information, see https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html
#
stages:
- build
- test
- deploy
build-job:
stage: build
script:
- echo "This job might build an important file, and pass it to later jobs."
- echo "This is the content of the important file" > important-file.txt
artifacts:
paths:
- important-file.txt
test-job-with-artifacts:
stage: test
script:
- echo "This job uses the artifact from the job in the earlier stage."
- cat important-file.txt
- echo "It creates another file, and adds it to the artifacts."
- echo "This is a second important file" > important-file2.txt
artifacts:
paths:
- important-file2.txt
test-job-with-no-artifacts:
stage: test
dependencies: [] # Use to skip downloading any artifacts
script:
- echo "This job does not get the artifacts from other jobs."
- cat important-file.txt || exit 0
deploy-job-with-all-artifacts:
stage: deploy
script:
- echo "By default, jobs download all available artifacts."
- cat important-file.txt
- cat important-file2.txt
deploy-job-with-1-artifact:
stage: deploy
dependencies:
- build-job # Download artifacts from only this job
script:
- echo "You can configure a job to download artifacts from only certain jobs."
- cat important-file.txt
- cat important-file2.txt || exit 0