Add validation for file path in custom yaml mode

Why are we doing this work

Using gitlab file api

Add validation for a file path, when file path is provided, it is required to check if file exist in repository before adding it to a policy

The following discussion from !137151 (merged) should be addressed:

  • @mcavoj started a discussion: (+2 comments)

    question(non-blocking): would it be possible / is it planned in the future to extend this validation and check if the file really exists and that it's accessible for us to use in the CI config?

Relevant links

  1. File api

Non-functional requirements

  • Documentation:
  • Feature flag:
  • Performance:
  • Testing:

Implementation plan

  1. Add file async file path validation in code_block_action.vue
  2. Use file api for this
  3. Add tests

Verification steps

  1. Go to Project/Group -> Secure -> Policies -> New execution policy.
  2. Add new action Execute a YAML code block
  3. Select Linked existing CI file option
  4. Input file path both for existing and non-existing file