Skip to content

Commit

Permalink
Merge pull request #223 from sbadia/bump-and-clean
Browse files Browse the repository at this point in the history
Bump gitlab version and clean acceptance tests
  • Loading branch information
sbadia committed Jul 11, 2015
2 parents 73c8b5e + a6b7425 commit 5988b11
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 95 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org"

group :development, :unit_tests do
gem 'puppetlabs_spec_helper', :require => false
gem 'rspec-puppet', '2.0.1', :require => false
gem 'rspec-puppet', :require => false
gem 'puppet-blacksmith', :require => false
gem 'puppet-lint-param-docs', :require => false
gem 'puppet-lint-absolute_classname-check', :require => false
Expand All @@ -24,6 +24,7 @@ end

group :system_tests do
gem 'beaker-rspec', :require => false
gem 'beaker-puppet_install_helper', :require => false
end

if facterversion = ENV['FACTER_GEM_VERSION']
Expand Down
94 changes: 27 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,70 +46,7 @@ See [gitlab example](https://github.com/sbadia/vagrant-gitlab/blob/master/exampl

# Parameters

* `ensure`: Ensure gitlab/gitlab-shell repo are present, latest. absent is not yet supported (default: present)
* `git_user`: Name of the gitlab (default: git)
* `git_group`: Name of the group for the gitlab user (default: $git_user)
* `git_home`: Home directory for gitlab repository (default: /home/git)
* `git_email`: Email address for gitlab user (default: [email protected])
* `git_comment`: Gitlab user comment (default: GitLab)
* `gitlab_manage_user`: Whether to manage the user account for gitlab (default: true)
* `gitlab_manage_home`: Whether to manage the home directory for gitlab (default: true)
* `gitlab_sources`: Gitlab sources (default: git://github.com/gitlabhq/gitlabhq.git)
* `gitlab_branch`: Gitlab branch (default: 6-9-stable)
* `gitlabshell_sources`: Gitlab-shell sources (default: git://github.com/gitlabhq/gitlab-shell.git)
* `gitlabshell_branch`: Gitlab-shell branch (default: v1.9.4)
* `gitlab_http_port`: Port that NGINX listens on for HTTP traffic (default: 80)
* `gitlab_ssl_port`: Port that NGINX listens on for HTTPS traffic (default: 443)
* `gitlab_http_timeout`: HTTP timeout in seconds (unicorn/nginx) (default: 60)
* `gitlab_redishost`: Redis host used for Sidekiq (default: localhost)
* `gitlab_redisport`: Redis host used for Sidekiq (default: 6379)
* `gitlab_dbtype`: Gitlab database type (default: mysql)
* `gitlab_dbname`: Gitlab database name (default: gitlab\_db)
* `gitlab_dbuser`: Gitlab database user (default: gitlab\_user)
* `gitlab_dbpwd`: Gitlab database password (default: changeme)
* `gitlab_dbhost`: Gitlab database host (default: localhost)
* `gitlab_dbport`: Gitlab database port (default: 3306)
* `gitlab_domain`: Gitlab domain (default $fqdn)
* `gitlab_repodir`: Gitlab repository directory (default: $git\_home)
* `gitlab_backup`: Whether to enable automatic backups (default: false)
* `gitlab_backup_path`: Path where Gitlab's backup rake task puts its files (default: tmp/backups)
* `gitlab_backup_keep_time`: Retention time of Gitlab's backups (in seconds) (default: 0 == forever)
* `gitlab_backup_time`: Time (hour) when the Gitlab backup task is run from cron (default: fqdn\_rand(5)+1)
* `gitlab_backup_postscript`: Path to one or more shell scripts to be executed after the backup (default: false)
* `gitlab_relative_url_root`: Run GitLab in a non-root path (default: false, dont't forget the first slash)
* `gitlab_ssl`: Enable SSL for GitLab (default: false)
* `gitlab_ssl_cert`: SSL Certificate location (default: /etc/ssl/certs/ssl-cert-snakeoil.pem)
* `gitlab_ssl_key`: SSL Key location (default: /etc/ssl/private/ssl-cert-snakeoil.key)
* `gitlab_ssl_self_signed`: Set true if your SSL Cert is self signed (default: false)
* `gitlab_projects`: GitLab default number of projects for new users (default: 10)
* `gitlab_username_change`: Manage username changing in GitLab (default: true)
* `gitlab_unicorn_port`: Port that unicorn listens on 172.0.0.1 for HTTP traffic (default: 8080)
* `gitlab_unicorn_worker`: Number of unicorn workers (default: 2)
* `gitlab_bundler_flags`: Flags to be passed to bundler when installing gems (default: --deployment)
* `gitlab_bundler_jobs`: The number of jobs to use while installing gems. Should match number of CPUs on machine (default: 1)
* `gitlab_ensure_postfix`: Whether or not this module should ensure the postfix
package is installed (used to manage conflicts with other modules) (default:
true)
* `gitlab_manage_rbenv`: Whether this module should use rbenv to install a suitable version of Ruby for the Gitlab user (default: true)
* `gitlab_ruby_version`: Ruby version to install with rbenv for the Gitlab user (default: 2.1.2)
* `exec_path`: PATH of execution (default: ${git\_home}/.rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)
* `ldap_enabled`: Enable LDAP backend for gitlab web (see bellow) (default: false)
* `ldap_host`: FQDN of LDAP server (default: ldap.domain.com)
* `ldap_base`: LDAP base dn (default: dc=domain,dc=com)
* `ldap_uid`: Uid for LDAP auth (default: uid)
* `ldap_user_filter`: RFC 4515 style filter for the user (default: '')
* `ldap_port`: LDAP port (default: 636)
* `ldap_method`: Method to use (default: ssl)
* `ldap_bind_dn`: User for LDAP bind auth (default: nil)
* `ldap_bind_password`: Password for LDN bind auth (default: nil)
* `git_package_name`: Package name for git (default: git-core)
* `git_proxy`: Proxy for GIT access (default: undef)
* `ssh_port`: Port accepting SSH connections (default: 22)
* `google_analytics_id`: Google Analytics tracking ID (default: nil)
* `company_logo_url`: Url to the company logo to be displayed at the bottom of the sign_in page (default: '')
* `company_link`: Link to the company displayed under the logo of the company (default: '')
* `company_name`: Name of the company displayed under the logo of the company (default: '')
* `use_exim` : Apply a fix for compatibility with exim as explained at [gitlabhq/gitlabhq#4866](https://github.com/gitlabhq/gitlabhq/issues/486) (default: false)
See [manifest/init.pp](https://github.com/sbadia/puppet-gitlab/blob/master/manifests/init.pp) and [manifests/params.pp](https://github.com/sbadia/puppet-gitlab/blob/master/manifests/params.pp)

# Usage

Expand Down Expand Up @@ -154,7 +91,33 @@ class { 'gitlab::ci::runner':
ci_server_url => 'https://ci.example.com',
registration_token => 'replaceme',
}
```
## A Complete example

```puppet
include redis
include nginx
include mysql::server
include git
include logrotate
mysql::db {'gitlab': user => 'user', password => 'password' }
class {'gitlab':
git_user => 'git',
git_home => '/home/git',
git_email => '[email protected]',
git_comment => 'GitLab',
gitlab_sources => 'https://github.com/gitlabhq/gitlabhq.git',
gitlab_domain => 'gitlab.localdomain.local',
gitlab_http_timeout => '300',
gitlab_dbtype => 'mysql',
gitlab_backup => true,
gitlab_dbname => 'gitlab',
gitlab_dbuser => 'user',
gitlab_dbpwd => 'password',
ldap_enabled => false,
}
```

# Limitations
Expand Down Expand Up @@ -187,9 +150,6 @@ bundle exec rspec spec/acceptance
# or use BEAKER_destroy=no to keep the resulting vm
BEAKER_destroy=no bundle exec rspec spec/acceptance
```

And test on http://10.255.127.206/

## Development environment with vagrant

See [vagrant-gitlab](https://github.com/sbadia/vagrant-gitlab).
2 changes: 1 addition & 1 deletion manifests/ci.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#
# [*gitlab_ruby_version*]
# Ruby version to install with rbenv for Gitlab user
# default: 2.1.2
# default: 2.1.6
#
# [*gitlab_manage_nginx*]
# Whether or not this module should install a templated Nginx
Expand Down
2 changes: 1 addition & 1 deletion manifests/ci/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
$gitlabci_bundler_flags = '--deployment'
$gitlabci_bundler_jobs = 1
$exec_path = "${ci_home}/.rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
$gitlab_ruby_version = '2.1.2'
$gitlab_ruby_version = '2.1.6'

} # Class:: gitlab::ci::params
4 changes: 2 additions & 2 deletions manifests/ci/runner.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#
# [*ruby_version*]
# Ruby version to install with rbenv for Gitlab user
# default: 2.1.2
# default: 2.1.6
#
# [*exec_path*]
# The default PATH passed to all exec ressources (this path include rbenv shims)
Expand All @@ -46,7 +46,7 @@
$ensure = 'present',
$branch = '5-0-stable',
$exec_path = '/home/gitlab_ci_runner/.rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
$ruby_version = '2.1.2',
$ruby_version = '2.1.6',
$source = 'https://gitlab.com/gitlab-org/gitlab-ci-runner.git',
$user = 'gitlab_ci_runner',
$user_home = '/home/gitlab_ci_runner',
Expand Down
6 changes: 3 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@
#
# [*gitlab_branch*]
# Gitlab branch
# default: 6-9-stable
# default: 7-12-stable
#
# [*gitlabshell_sources*]
# Gitlab-shell sources
# default: git://github.com/gitlabhq/gitlab-shell.git
#
# [*gitlabshell_branch*]
# Gitlab-shell branch
# default: v1.9.4
# default: v2.6.3
#
# [*gitlabshell_log_folder*]
# Gitlab-shell log folder
Expand Down Expand Up @@ -294,7 +294,7 @@
#
# [*gitlab_ruby_version*]
# Ruby version to install with rbenv for the Gitlab user
# default: 2.1.2
# default: 2.1.6
#
# [*gitlab_secret_file*]
# File that contains the secret key for verifying access for gitlab-shell.
Expand Down
6 changes: 3 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
$git_timeout = 10
$gitlab_webhook_timeout = 10
$gitlab_sources = 'git://github.com/gitlabhq/gitlabhq.git'
$gitlab_branch = '6-9-stable'
$gitlab_branch = '7-12-stable'
$gitlabshell_sources = 'git://github.com/gitlabhq/gitlab-shell.git'
$gitlabshell_branch = 'v1.9.4'
$gitlabshell_branch = 'v2.6.3'
$gitlabshell_log_folder = undef
$gitlab_log_folder = undef
$gitlab_manage_nginx = true
Expand Down Expand Up @@ -74,7 +74,7 @@
$gitlab_ensure_postfix = true
$gitlab_ensure_curl = true
$gitlab_manage_rbenv = true
$gitlab_ruby_version = '2.1.2'
$gitlab_ruby_version = '2.1.6'
$gitlab_auth_file = "${git_home}/.ssh/authorized_keys"
$gitlab_secret_file = undef
$exec_path = "${git_home}/.rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Expand Down
13 changes: 7 additions & 6 deletions spec/acceptance/nodesets/default.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
HOSTS:
debian-73-x64:
ubuntu-server-1404-x64:
roles:
- master
platform: debian-7-amd64
box : debian-73-x64-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-nocm.box
hypervisor : vagrant
platform: ubuntu-14.04-amd64
box: puppetlabs/ubuntu-14.04-64-nocm
box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm
hypervisor: vagrant
CONFIG:
type: foss
log_level: debug
type: git
2 changes: 1 addition & 1 deletion spec/classes/ci/gitlab_ci_runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
it { is_expected.to contain_rbenv__compile('gitlab-ci-runner/ruby').with(
:user => 'gitlab_ci_runner',
:home => '/home/gitlab_ci_runner',
:ruby => '2.1.2',
:ruby => '2.1.6',
:global => true,
:notify => 'Exec[install gitlab-ci-runner]'
)}
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/ci/gitlab_setup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
it { is_expected.to contain_rbenv__compile('gitlabci/ruby').with(
:user => 'gitlab_ci',
:home => '/home/gitlab_ci',
:ruby => '2.1.2',
:ruby => '2.1.6',
:global => true,
:notify => 'Exec[install gitlab-ci]'
)}
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/gitlab_package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
:user => 'git',
:provider => 'git',
:source => 'git://github.com/gitlabhq/gitlabhq.git',
:revision => '6-9-stable'
:revision => '7-12-stable'
)}
it { is_expected.to contain_vcsrepo('/home/git/gitlab-shell').with(
:ensure => 'present',
:user => 'git',
:provider => 'git',
:source => 'git://github.com/gitlabhq/gitlab-shell.git',
:revision => 'v1.9.4'
:revision => 'v2.6.3'
)}
end
context 'with specifics params' do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/gitlab_setup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
it { is_expected.to contain_rbenv__compile('gitlab/ruby').with(
:user => 'git',
:home => '/home/git',
:ruby => '2.1.2',
:ruby => '2.1.6',
:global => true,
:notify => ['Exec[install gitlab-shell]', 'Exec[install gitlab]']
)}
Expand Down
16 changes: 10 additions & 6 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
require 'beaker-rspec'
require 'beaker/puppet_install_helper'

hosts.each do |host|
install_puppet
on host, "mkdir -p #{host['distmoduledir']}"
end
run_puppet_install_helper

RSpec.configure do |c|
# Project root
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
modname = JSON.parse(open('metadata.json').read)['name'].split('-')[1]

# Readable test descriptions
c.formatter = :documentation

# Configure all nodes in nodeset
c.before :suite do

# Install module
puppet_module_install(:source => proj_root, :module_name => 'gitlab')
#
puppet_module_install(:source => proj_root, :module_name => modname)
hosts.each do |host|
on host, puppet('module','install','alup/rbenv'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','fsalum/redis'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','jfryman/nginx'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','evenup/logrotate'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','puppetlabs-git'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','puppetlabs-vcsrepo'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','puppetlabs-mysql', '--version', '2.2'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','puppetlabs-mysql'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }

# List modules installed to help with debugging
on host, puppet('module','list'), { :acceptable_exit_codes => [0] }
end
end
end

0 comments on commit 5988b11

Please sign in to comment.