-
- Downloads
Fix the project auto devops API
If `project_auto_devops.enabled` is nil for a project, when setting any auto devops values via the API, we try to create a new row in the DB, instead of re-using the existing one. This leads to the project_id being set to nil, and the database `NOT NULL` constraint leading to a 500 response. This commit resolves the issue by correctly detecting the presence of a ProjectAutoDevops row and re-using it. Persistence is also moved away from explicit `update!` calls and into relying on `autosave: true` on the model.
Showing
- app/models/concerns/project_api_compatibility.rb 2 additions, 4 deletionsapp/models/concerns/project_api_compatibility.rb
- app/models/project.rb 1 addition, 1 deletionapp/models/project.rb
- app/models/project_auto_devops.rb 1 addition, 1 deletionapp/models/project_auto_devops.rb
- changelogs/unreleased/64731-fix-project-auto-devops-api.yml 5 additions, 0 deletionschangelogs/unreleased/64731-fix-project-auto-devops-api.yml
- spec/models/concerns/project_api_compatibility_spec.rb 36 additions, 15 deletionsspec/models/concerns/project_api_compatibility_spec.rb
Please register or sign in to comment