Describe your question in as much detail as possible:
I think I have some misunderstanding of “needs:” keyword in Gitlab CI.
Here is a part of my gitlab-ci.yml:
The goal is to build image with “latest” tag, then, if this stage succeeded and the latest commit is associated with git tag, to tag docker image accordingly. However, I’m getting a YAML error: “tagged_build: needs ‘latest_build’”
And I don’t understand why this happens, because “build_latest” succeeds and “build_tagged” gets cancelled immediately on push:
Most likely my error is explained at https://docs.gitlab.com/ee/ci/yaml/#requirements-and-limitations: " If needs: is set to point to a job that is not instantiated because of only/except rules or otherwise does not exist, the pipeline is not created and a YAML error is shown.", however, “build_latest” job does run and even finish successfully.
I’m running a self-hosted “free” Gitlab instance, version 13.5.3
I think I’ve got an idea. “build_tagged” job throws an error, because it needs “build_latest”, but “build_latest” doesn’t use the same trigger (tag) as “build_tagged”.
Is there any workaround how to run “build_tagged” only if “build_latest” succeed?
@snim2 Thank you for your reply. Unfortunately, I’m afraid I didn’t understand you. I already knew that on_success is the default value, but I’m not sure how explicitly adding it would help me resolve the problem.
Could you please explain a bit further if you don’t mind?