Class: Gitlab::QA::Component::Jira
- Inherits:
-
Object
- Object
- Gitlab::QA::Component::Jira
- Includes:
- Scenario::Actable
- Defined in:
- lib/gitlab/qa/component/jira.rb
Constant Summary collapse
- JIRA_IMAGE =
'registry.gitlab.com/gitlab-org/gitlab-qa/jira-gitlab'.freeze
- JIRA_IMAGE_TAG =
'8.8-project-and-issue'.freeze
Instance Attribute Summary collapse
-
#docker ⇒ Object
readonly
Returns the value of attribute docker.
-
#environment ⇒ Object
Returns the value of attribute environment.
- #name ⇒ Object
-
#network ⇒ Object
Returns the value of attribute network.
Instance Method Summary collapse
- #hostname ⇒ Object
-
#initialize ⇒ Jira
constructor
A new instance of Jira.
- #instance ⇒ Object
- #prepare ⇒ Object
- #restart ⇒ Object
- #set_jira_hostname ⇒ Object
- #start ⇒ Object
- #teardown ⇒ Object
Methods included from Scenario::Actable
Constructor Details
Instance Attribute Details
#docker ⇒ Object (readonly)
Returns the value of attribute docker.
10 11 12 |
# File 'lib/gitlab/qa/component/jira.rb', line 10 def docker @docker end |
#environment ⇒ Object
Returns the value of attribute environment.
11 12 13 |
# File 'lib/gitlab/qa/component/jira.rb', line 11 def environment @environment end |
#name ⇒ Object
19 20 21 |
# File 'lib/gitlab/qa/component/jira.rb', line 19 def name @name ||= "jira" end |
#network ⇒ Object
Returns the value of attribute network.
11 12 13 |
# File 'lib/gitlab/qa/component/jira.rb', line 11 def network @network end |
Instance Method Details
#hostname ⇒ Object
23 24 25 |
# File 'lib/gitlab/qa/component/jira.rb', line 23 def hostname "#{name}.#{network}" end |
#instance ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/gitlab/qa/component/jira.rb', line 27 def instance raise 'Please provide a block!' unless block_given? prepare start yield self ensure teardown end |
#prepare ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/gitlab/qa/component/jira.rb', line 38 def prepare @docker.pull(JIRA_IMAGE, JIRA_IMAGE_TAG) return if @docker.network_exists?(network) @docker.network_create(network) end |
#restart ⇒ Object
56 57 58 |
# File 'lib/gitlab/qa/component/jira.rb', line 56 def restart @docker.restart(name) end |
#set_jira_hostname ⇒ Object
67 68 69 |
# File 'lib/gitlab/qa/component/jira.rb', line 67 def set_jira_hostname ::Gitlab::QA::Runtime::Env.jira_hostname = hostname end |
#start ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/gitlab/qa/component/jira.rb', line 46 def start docker.run(JIRA_IMAGE, JIRA_IMAGE_TAG) do |command| command << '-d ' command << "--name #{name}" command << "--net #{network}" command << "--hostname #{hostname}" command << "--publish 8080:8080" end end |
#teardown ⇒ Object
60 61 62 63 64 65 |
# File 'lib/gitlab/qa/component/jira.rb', line 60 def teardown raise 'Invalid instance name!' unless name @docker.stop(name) @docker.remove(name) end |