Class: Gitlab::QA::Support::GitlabUpgradePath

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/qa/support/gitlab_upgrade_path.rb

Instance Method Summary collapse

Constructor Details

#initialize(current_version, semver_component, edition) ⇒ GitlabUpgradePath

Get upgrade path between N - 1 and current version not including current release

Parameters:

  • current_version (String)
  • semver_component (String)

    version number component for previous version detection - major|minor|patch

  • edition (String)

    GitLab edition - ee or ce



15
16
17
18
19
20
21
# File 'lib/gitlab/qa/support/gitlab_upgrade_path.rb', line 15

def initialize(current_version, semver_component, edition)
  @version_info = GitlabVersionInfo.new(current_version, edition)
  @current_version = Gem::Version.new(current_version)
  @semver_component = semver_component
  @edition = edition
  @logger = Runtime::Logger.logger
end

Instance Method Details

#fetchArray<QA::Release>

Get upgrade path between releases

Return array with only previous version for updates from previous minor, patch versions

Returns:



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/gitlab/qa/support/gitlab_upgrade_path.rb', line 28

def fetch
  return [release(latest_patch(previous_version))] unless major_upgrade?

  # get versions between previous major and current version in gitlab upgrade path
  path = full_upgrade_path.each_with_object([]) do |ver, arr|
    next if ver <= previous_version || ver >= current_version

    arr << ver
  end

  [previous_version, *path].map do |ver|
    release(version_info.latest_patch(ver))
  end
end