Skip to content

Ignore case in project/group paths when refreshing agent CI access

Tiger Watson requested to merge ignore-case-in-agent-ci-access-lookup into master

What does this MR do and why?

Ignores case when refreshing project/group CI access authorisations. Previously, half of the process was case-insensitive (Routable.where_full_path_in uses LOWER()), which caused an error to be raised when we tried to parse a configuration entry that had incorrect capitalisation.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

  1. Create a test project, my-project
  2. Create a file to be used as a sample config file, example.yaml:
ci_access:
   projects:
    - id: UPPERCASE/PATH/TO/YOUR/PROJECT # the path should match, but have the wrong case.
      access_as:
        ci_job: {}
  1. From the Rails console:
  • create an agent - agent = Clusters::Agents.create!(project: <any project ID>, name: 'test-agent')
  • configure the agent with the config file above: - Clusters::Agents::RefreshAuthorizationService.new(agent, config: File.read('example.yaml')).execute
  1. NotNullViolation should not be raised

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

#383325 (closed)

Edited by Tiger Watson

Merge request reports