Class: Gitlab::QA::Scenario::Test::Omnibus::Update

Inherits:
Gitlab::QA::Scenario::Template show all
Defined in:
lib/gitlab/qa/scenario/test/omnibus/update.rb

Instance Method Summary collapse

Methods inherited from Gitlab::QA::Scenario::Template

perform

Instance Method Details

#perform(from_release, to_release = nil, *rspec_args) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/gitlab/qa/scenario/test/omnibus/update.rb', line 12

def perform(from_release, to_release = nil, *rspec_args)
  version = Component::Gitlab.perform do |gitlab|
    gitlab.release = from_release
    gitlab.act do
      pull
      package_version
    end
  end

  if version
    # Sub any plus symbols in version eg. "15.1.2+ce.0"
    version.tr!('+', '-')
    Runtime::Logger.info("Found previous version '#{version}'")

    current_release = QA::Release.new(to_release || from_release)

    type = current_release.ee? ? 'ee' : 'ce'

    existing_previous = Component::Gitlab.perform do |gitlab|
      gitlab.act do
        next "gitlab/gitlab-#{type}:#{version}" if exist?("gitlab/gitlab-#{type}", version)

        next "gitlab/gitlab-#{type}:#{version}-#{type}.0" if exist?("gitlab/gitlab-#{type}", "#{version}-#{type}.0")

        nil
      end
    end
  else
    Runtime::Logger.info("Could not find previous image version")
    existing_previous = nil
  end

  previous_release = if existing_previous
                       Runtime::Logger.info("Using previous image '#{existing_previous}'")
                       QA::Release.new(existing_previous)
                     else
                       Runtime::Logger.info("Using stable as previous image")
                       QA::Release.new(from_release).previous_stable
                     end

  Docker::Volumes.new.with_temporary_volumes do |volumes|
    Component::Gitlab.perform do |gitlab|
      gitlab.release = previous_release
      gitlab.volumes = volumes
      gitlab.network = 'test'
      gitlab.seed_admin_token = false
      gitlab.launch_and_teardown_instance
    end

    Scenario::Test::Instance::Image
      .perform(current_release, *rspec_args) do |scenario|
      scenario.volumes = volumes
    end
  end
end