Closed
Description
Before 1.0.0 I was updating attributes with the v4 API on both merge requests and hooks and able to save them correctly as the manager recognized I had modified them and was sending the updates to the API. But after 1.0.0 it appears the UpdateMixin (I assume, not familiar with this code) doesn't recognize changes any longer, which will cause the save()
calls to fail when Gitlab returns a 400 because it wasn't actually asked to change anything.
Here's what my code looked like before
if not has_valid_changelog:
self.log.info(f"Adding CHANGELOG label to {merge_req.web_url}")
if 'CHANGELOG' in merge_req.labels:
self.log.info(f"MR {merge_req.web_url} is already tagged with CHANGELOG label")
return
merge_req.labels.append('CHANGELOG')
merge_req.save()
And after
if not has_valid_changelog:
self.log.info(f"Adding CHANGELOG label to {merge_req.web_url}")
if 'CHANGELOG' in merge_req.labels:
self.log.info(f"MR {merge_req.web_url} is already tagged with CHANGELOG label")
return
merge_req.labels.append('CHANGELOG')
# Need to stringize, since this doesn't go through the usual route
setattr(merge_req, 'labels', ','.join(merge_req.labels))
merge_req.save()