Fix pipeline creation in Ci::CreateWebIdeTerminalService so that it fabricates job_definitions

Problem

Ci::CreateWebIdeTerminalService creates and processes a CI pipeline without utilizing the pipeline creation chain (CreatePipelineService). This means it misses out on the step Gitlab::Ci::Pipeline::Chain::Create, which calls JobDefinitionBuilder to create the job definitions.

Without job definitions, it relies on config_options/config_variables in ci_builds_metadata to be written. For this reason, applying the FF stop_writing_builds_metadata to options=/yaml_variables= breaks tests related to this web ide terminal service. Specifically:

These tests are currently stubbed with the FF false for now, but they need to be removed eventually.

References

Proposal

Update the pipeline creation workflow in Ci::CreateWebIdeTerminalService to call JobDefinitionBuilder at some point before processing the pipeline. Apply any other changes needed to preserve its behaviour when FF stop_writing_builds_metadata is enabled.

Update relevant tests in spec/requests/api/ci/runner/jobs_request_post_spec.rb and spec/services/ci/create_web_ide_terminal_service_spec.rb to ensure the behaviour works when stop_writing_builds_metadata is both enabled and disabled.

Update / Resolution

It turns out that create_web_ide_terminal_service.rb and related code is a legacy feature and will be removed eventually. We can simply leave the FF stubs to pass the relevant tests for now.

Ref (Slack discussion):

@ealcantara: @fabio @Chad Woolley I confirm that we can delete this controller. This feature is not present in the Web IDE anymore.

Edited by 🤖 GitLab Bot 🤖