Skip to content

Commit e6f1f29

Browse files
committed
Use setup_acceptance_node.pp
This uses features from voxpupuli-acceptance to reduce spec_helper_acceptance's size. Another benefit is that editors recognize the .pp extension and you get syntax highlighting.
1 parent 9a3ecfa commit e6f1f29

File tree

2 files changed

+50
-58
lines changed

2 files changed

+50
-58
lines changed

spec/setup_acceptance_node.pp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# The omnibus installer use the following algorithm to know what to do.
2+
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/runit/recipes/default.rb
3+
# If this peace of code trigger docker case, the installer hang indefinitly.
4+
file {'/.dockerenv':
5+
ensure => absent,
6+
}
7+
8+
package { 'curl':
9+
ensure => present,
10+
}
11+
12+
# https://gitlab.com/gitlab-org/omnibus-gitlab/issues/2229
13+
# There is no /usr/share/zoneinfo in latest Docker image for ubuntu 16.04
14+
# Gitlab installer fail without this file
15+
if $facts['os']['release']['major'] in ['16.04', '18.04'] {
16+
package { 'tzdata':
17+
ensure => present,
18+
}
19+
}
20+
21+
# Setup Puppet Bolt
22+
$bolt_config = @("BOLTPROJECT"/L)
23+
modulepath: "/etc/puppetlabs/code/modules:/etc/puppetlabs/code/environments/production/modules"
24+
analytics: false
25+
| BOLTPROJECT
26+
27+
package { 'puppet-bolt':
28+
ensure => installed,
29+
}
30+
31+
file { [ '/root/.puppetlabs', '/root/.puppetlabs/bolt', '/root/.puppetlabs/etc', '/root/.puppetlabs/etc/bolt']:
32+
ensure => directory,
33+
}
34+
35+
# Needs to existing to not trigger a warning sign...
36+
file { '/root/.puppetlabs/etc/bolt/analytics.yaml':
37+
ensure => file,
38+
}
39+
40+
file { '/root/.puppetlabs/bolt/bolt-project.yaml':
41+
ensure => file,
42+
content => $bolt_config,
43+
}
44+
45+
file_line { '/etc/hosts-gitlab':
46+
path => '/etc/hosts',
47+
line => "${facts['gitlab_ip']} gitlab",
48+
}

spec/spec_helper_acceptance.rb

Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,7 @@
11
require 'voxpupuli/acceptance/spec_helper_acceptance'
22

3+
ENV['BEAKER_FACTER_GITLAB_IP'] = File.read(File.expand_path('~/GITLAB_IP')).chomp
4+
35
configure_beaker do |host|
46
install_module_from_forge_on(host, 'puppetlabs/docker', '>= 0')
5-
6-
# The omnibus installer use the following algorithm to know what to do.
7-
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/runit/recipes/default.rb
8-
# If this peace of code trigger docker case, the installer hang indefinitly.
9-
pp = %(
10-
file {'/.dockerenv':
11-
ensure => absent,
12-
}
13-
package { ['curl']:
14-
ensure => present,
15-
}
16-
)
17-
18-
apply_manifest_on(host, pp, catch_failures: true)
19-
20-
# https://gitlab.com/gitlab-org/omnibus-gitlab/issues/2229
21-
# There is no /usr/share/zoneinfo in latest Docker image for ubuntu 16.04
22-
# Gitlab installer fail without this file
23-
tzdata = %(
24-
package { ['tzdata']:
25-
ensure => present,
26-
}
27-
)
28-
29-
apply_manifest_on(host, tzdata, catch_failures: true) if fact('os.release.major') =~ %r{(16.04|18.04)}
30-
31-
# Setup Puppet Bolt
32-
gitlab_ip = File.read(File.expand_path('~/GITLAB_IP')).chomp
33-
bolt = <<-MANIFEST
34-
$bolt_config = @("BOLTPROJECT"/L)
35-
modulepath: "/etc/puppetlabs/code/modules:/etc/puppetlabs/code/environments/production/modules"
36-
analytics: false
37-
| BOLTPROJECT
38-
39-
package { 'puppet-bolt':
40-
ensure => installed,
41-
}
42-
43-
file { [ '/root/.puppetlabs', '/root/.puppetlabs/bolt', '/root/.puppetlabs/etc', '/root/.puppetlabs/etc/bolt']:
44-
ensure => directory,
45-
}
46-
47-
# Needs to existing to not trigger a warning sign...
48-
file { '/root/.puppetlabs/etc/bolt/analytics.yaml':
49-
ensure => file,
50-
}
51-
52-
file { '/root/.puppetlabs/bolt/bolt-project.yaml':
53-
ensure => file,
54-
content => $bolt_config,
55-
}
56-
57-
file_line { '/etc/hosts-gitlab':
58-
path => '/etc/hosts',
59-
line => '#{gitlab_ip} gitlab',
60-
}
61-
MANIFEST
62-
apply_manifest_on(host, bolt, catch_failures: true)
637
end

0 commit comments

Comments
 (0)