When ref is ambiguous, `CreatePipelineService` raises an error
Description
This commit changed Project#protected_for? method's behavior to raise an exception when the ref is ambiguous (Ambiguous == exists in both branch and tag).
With this change, Ci::CreatePipelineService#execute was basically exception-free execution though, it started raising an exception because Gitlab::Ci::Pipeline::Chain::Build chain runs before Gitlab::Ci::Pipeline::Chain::Validate::Repository chain. In Build chain, it executes protected_for?, thus it will never reach return error('Ref is ambiguous') in Validation chain.
In fact, this exception can be observed on Sentry, for instance
- https://sentry.gitlab.net/gitlab/gitlabcom/issues/606650/?query=AmbiguousRefError
- https://sentry.gitlab.net/gitlab/gitlabcom/issues/606794/?query=AmbiguousRefError
- https://sentry.gitlab.net/gitlab/gitlabcom/issues/606794/?query=AmbiguousRefError
Solution
TBD