Backend: Fetch spec from CI Config

Summary

As a part of Add support for spec:inputs in GitLab CI pipelines (&16321 - closed); create a service to fetch the main CI config spec.

Today, Gitlab::Ci::ProjectConfig returns the information on the main CI configuration. However, this information can't be used directly to fetch spec from it because it returns in the include format.

In the POC MR, we had to use this "hacky" method to fetch;

config = ::Gitlab::Ci::ProjectConfig.new(project: project, sha: sha)
context = ::Gitlab::Ci::Config::External::Context.new(project: project, user: current_user, sha: sha)
yaml_content = ::Gitlab::Ci::Config::Yaml.load!(config.content)
locations = yaml_content[:include]
files = ::Gitlab::Ci::Config::External::Mapper::Matcher.new(context).process(locations)

file = files.first

file.validate_location!
file.preload_context if file.valid?
file.validate_context! if file.valid?
file.preload_content if file.valid?
file.validate_content! if file.valid?

Gitlab::Ci::Config::Yaml::Loader.new(file.content).load_uninterpolated_yaml.spec