Skip to content

Commit

Permalink
Use setup_acceptance_node.pp
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ekohl committed Jul 16, 2021
1 parent 9a3ecfa commit e6f1f29
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 58 deletions.
48 changes: 48 additions & 0 deletions spec/setup_acceptance_node.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# The omnibus installer use the following algorithm to know what to do.
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/runit/recipes/default.rb
# If this peace of code trigger docker case, the installer hang indefinitly.
file {'/.dockerenv':
ensure => absent,
}

package { 'curl':
ensure => present,
}

# https://gitlab.com/gitlab-org/omnibus-gitlab/issues/2229
# There is no /usr/share/zoneinfo in latest Docker image for ubuntu 16.04
# Gitlab installer fail without this file
if $facts['os']['release']['major'] in ['16.04', '18.04'] {
package { 'tzdata':
ensure => present,
}
}

# Setup Puppet Bolt
$bolt_config = @("BOLTPROJECT"/L)
modulepath: "/etc/puppetlabs/code/modules:/etc/puppetlabs/code/environments/production/modules"
analytics: false
| BOLTPROJECT

package { 'puppet-bolt':
ensure => installed,
}

file { [ '/root/.puppetlabs', '/root/.puppetlabs/bolt', '/root/.puppetlabs/etc', '/root/.puppetlabs/etc/bolt']:
ensure => directory,
}

# Needs to existing to not trigger a warning sign...
file { '/root/.puppetlabs/etc/bolt/analytics.yaml':
ensure => file,
}

file { '/root/.puppetlabs/bolt/bolt-project.yaml':
ensure => file,
content => $bolt_config,
}

file_line { '/etc/hosts-gitlab':
path => '/etc/hosts',
line => "${facts['gitlab_ip']} gitlab",
}
60 changes: 2 additions & 58 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,63 +1,7 @@
require 'voxpupuli/acceptance/spec_helper_acceptance'

ENV['BEAKER_FACTER_GITLAB_IP'] = File.read(File.expand_path('~/GITLAB_IP')).chomp

configure_beaker do |host|
install_module_from_forge_on(host, 'puppetlabs/docker', '>= 0')

# The omnibus installer use the following algorithm to know what to do.
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/runit/recipes/default.rb
# If this peace of code trigger docker case, the installer hang indefinitly.
pp = %(
file {'/.dockerenv':
ensure => absent,
}
package { ['curl']:
ensure => present,
}
)

apply_manifest_on(host, pp, catch_failures: true)

# https://gitlab.com/gitlab-org/omnibus-gitlab/issues/2229
# There is no /usr/share/zoneinfo in latest Docker image for ubuntu 16.04
# Gitlab installer fail without this file
tzdata = %(
package { ['tzdata']:
ensure => present,
}
)

apply_manifest_on(host, tzdata, catch_failures: true) if fact('os.release.major') =~ %r{(16.04|18.04)}

# Setup Puppet Bolt
gitlab_ip = File.read(File.expand_path('~/GITLAB_IP')).chomp
bolt = <<-MANIFEST
$bolt_config = @("BOLTPROJECT"/L)
modulepath: "/etc/puppetlabs/code/modules:/etc/puppetlabs/code/environments/production/modules"
analytics: false
| BOLTPROJECT
package { 'puppet-bolt':
ensure => installed,
}
file { [ '/root/.puppetlabs', '/root/.puppetlabs/bolt', '/root/.puppetlabs/etc', '/root/.puppetlabs/etc/bolt']:
ensure => directory,
}
# Needs to existing to not trigger a warning sign...
file { '/root/.puppetlabs/etc/bolt/analytics.yaml':
ensure => file,
}
file { '/root/.puppetlabs/bolt/bolt-project.yaml':
ensure => file,
content => $bolt_config,
}
file_line { '/etc/hosts-gitlab':
path => '/etc/hosts',
line => '#{gitlab_ip} gitlab',
}
MANIFEST
apply_manifest_on(host, bolt, catch_failures: true)
end

0 comments on commit e6f1f29

Please sign in to comment.