resource_group api cannot find resource with dots in it

Summary

When using resource_group containing one or more dots (.) API call return 404 Not found

Initialy found when I tried to use ip address for resource_group.

Another interesting thing is that for one dot in resource name it returns message

{"message":"404 Not found"}

but for more dots it returns error

{"error":"404 Not Found"}

Steps to reproduce

Create job with

resource_group s.imple

in script section call

curl -s --header "PRIVATE-TOKEN: $GITLAB_API" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/resource_groups/s.imple

it returns

{"message":"404 Not found"}

Example Project

Sample project with pipelines:

https://gitlab.com/jiri.holanek/resource_group_test

Failing pipelines: https://gitlab.com/jiri.holanek/resource_group_test/-/jobs/2081525453

What is the current bug behavior?

Instead of returning json with resource it return 404 not found

What is the expected correct behavior?

{"id":798176,"key":"s.imple","process_mode":"unordered","created_at":"2022-02-11T07:04:02.174Z","updated_at":"2022-02-11T07:04:02.174Z"}

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

The constraints on the key parameter for the ResourceGroups API needs to be updated to reflect the allowed resource group characters

For example, Release API has the following constraint to allow a dot:

    RELEASE_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS
      .merge(tag_name: API::NO_SLASH_URL_PART_REGEX)
Edited by Shinya Maeda