Skip to content

Fully deprecate `public_builds` in projects API

Manuel Grabowski requested to merge mg-consistent-projects-api-20240125 into master

What does this MR do and why?

When we changed from public_builds to public_jobs in gitlab-foss!9463 (merged) we missed the PUT and POST endpoints (as per this comment). Internally we still refer to it as public_builds (see here for example – I actually couldn't find where in the models the attribute itself is defined…) and due to the breaking changes policy for the API we will still need to support public_builds as an API parameter. Using the translate_params_for_compatibility() method to support both is a convenient way to achieve consistency in the API without a large refactor.

Fixes #329725 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

I used the following API requests to verify the behavior:

# Create new projects
curl -s --request POST --header "PRIVATE-TOKEN: $GITLAB_TOKEN" "http://gdk.test:3000/api/v4/projects" --form "name=test_false" --form "public_jobs=false"
curl -s --request POST --header "PRIVATE-TOKEN: $GITLAB_TOKEN" "http://gdk.test:3000/api/v4/projects" --form "name=test_true" --form "public_jobs=true"

# Update an existing project
curl -s --request PUT --header "PRIVATE-TOKEN: $GITLAB_TOKEN" "http://gdk.test:3000/api/v4/projects/7" --form "public_jobs=true"
curl -s --request PUT --header "PRIVATE-TOKEN: $GITLAB_TOKEN" "http://gdk.test:3000/api/v4/projects/7" --form "public_jobs=false"

# Repeating the same commands with `public_builds` instead of `public_jobs` still works the same in this branch, whereas on the default branch it will _only_ work with `public_builds` and using `public_jobs` would give an error

Merge request reports