Skip to content

Commit dff6e2e

Browse files
committed
GitLab now requires git 2.7.4, which isn't in some distro repositories
Build from source on platforms known to be too old, except for RHEL 7 where we can use the End Point repository. Strangely we were depending on the git cookbook already but we weren't using it.
1 parent f60784e commit dff6e2e

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

attributes/default.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@
112112
)
113113
end
114114

115+
# How to install git? RHEL 7 can use End Point.
116+
default['gitlab']['git_recipe'] = value_for_platform(
117+
%w( redhat centos scientific oracle ) => { '< 7' => 'source' },
118+
'amazon' => { '>= 0' => 'source' },
119+
'fedora' => { '< 24' => 'source' },
120+
'debian' => { '< 9' => 'source' },
121+
'ubuntu' => { '< 16.04' => 'source' },
122+
'default' => 'package'
123+
)
124+
115125
default['gitlab']['trust_local_sshkeys'] = 'yes'
116126

117127
default['gitlab']['https'] = false

recipes/default.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
include_recipe 'yum-epel'
2626
end
2727

28+
# Install new enough git version
29+
include_recipe 'gitlab::git'
30+
2831
# Setup the database connection
2932
case node['gitlab']['database']['type']
3033
when 'mysql'

recipes/git.rb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#
2+
# Cookbook Name:: gitlab
3+
# Recipe:: git
4+
#
5+
# Copyright 2016, Yakara Ltd
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
#
19+
20+
git_recipe = node['gitlab']['git_recipe']
21+
22+
yum_repository 'endpoint-git' do
23+
description 'git from End Point repository'
24+
includepkgs 'git git-core* perl-Git'
25+
el = node['platform_version'].to_i
26+
baseurl "https://packages.endpoint.com/rhel/#{el}/os/$basearch/"
27+
gpgkey "https://packages.endpoint.com/endpoint-rpmsign-#{el}.pub"
28+
only_if { git_recipe == 'package' && platform_family?('rhel') }
29+
end
30+
31+
include_recipe "git::#{git_recipe}"

0 commit comments

Comments
 (0)