Skip to content

Fix unwanted removal of newlines when Omnibus upgrade stop is updated

Reuben Pereira requested to merge rp/do-not-strip-newlines-onmnibus-version into master

What does this MR do and why?

Describe in detail what your merge request does and why.

Content

Re-apply !3091 (merged) with fixes after we had to revert it (!3195 (merged)) due to a bug.

Original change description

Fix unwanted removal of newlines when Omnibus upgrade stop is updated

Do not strip newlines on Omnibus files, since rubocop enforces these.

Commit that trimmed newlines before: omnibus-gitlab@aeb11122

Rubocop failure: https://gitlab.com/gitlab-org/omnibus-gitlab/-/jobs/6808530624

Changelog: fixed

Bug fix description

  • Strip whitespace when initializing version strings

This MR corrects OmnibusGitlabRelease#read_version to return a Version object instead of a string. Calling .strip on a Version object returns a string, which is not what we want.

We do want to remove whitespace when creating Version objects though.

Whitespace in Version objects can cause equality comparisons to fail. For example Version.new("17.0.2\n") == Version.new("17.0.2") is false.

This MR strips whitespace from the string passed to Version.new.

Author Check-list

  • Has documentation been updated?
Edited by Reuben Pereira

Merge request reports