fix: correct inverted condition for GITLAB_RELEASE_ASSETS_USE_PACKAGE_REGISTRY env var

What does this MR do and why?

Fixes an inverted error condition in both release create and release upload that caused the GITLAB_RELEASE_ASSETS_USE_PACKAGE_REGISTRY environment variable to be silently ignored.

strconv.ParseBool returns (value, nil) on success and (false, err) on failure. The condition err != nil meant usePackageRegistry was only ever set when parsing failed (i.e. the env var was empty or invalid), and never set when the user provided a valid value like "true" or "1".

Changed err != nilerr == nil in both commands.

A regression test was added to release create that confirms the bug (the test fails before the fix) and passes after.

MR acceptance checklist

  • This MR has a related issue: Closes #8292 (closed)
  • I have evaluated the MR acceptance checklist
  • Changes are tested

Merge request reports

Loading