Having some multiple jobs (not in parallel) and I'm trying to pass artifacts from the first job to the second one.
Here what it's look like:
deploy-build-docker 1/2:
stage: deploy
image: docker:stable
script:
- ...
artifacts:
paths:
- path
deploy-preprod 2/2:
stage: deploy
image: alpine
dependencies: [deploy-build-docker]
script:
- ....
CI can't find dependencies, and give me this error deploy-preprod 2/2 job: undefined dependency: deploy-build-docker
I also tried deploy, deploy-build-docker 1/2 but I still have the same issue.
So how can i do that? Should I must do the build in another stage?
Yes, you can only pass artifacts from previous stages.
By default, all artifacts from all previous stages are passed, but you can use the dependencies parameter to define a limited list of jobs (or no jobs) to fetch artifacts from.
To use this feature, define dependencies in context of the job and pass a list of all previous jobs from which the artifacts should be downloaded. You can only define jobs from stages that are executed before the current one. An error will be shown if you define jobs from the current stage or next ones.
https://docs.gitlab.com/ee/ci/yaml/#dependencies
Although they might add support for needs: in future to reference jobs in the current stage: https://gitlab.com/gitlab-org/gitlab/issues/30632
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With