Merge branch 'parse-build-iteration' into 'master'
Derive the build_iteration from 'git describe' This change introduces a new scheme for omnibus-gitlab release tags. See merge request !352
This commit is contained in:
commit
b81165d934
1
Gemfile
1
Gemfile
|
@ -6,3 +6,4 @@ gem 'ohai'
|
|||
gem 'package_cloud'
|
||||
gem 'thor', '0.18.1' # This specific version is required by package_cloud
|
||||
gem 'json'
|
||||
gem 'rspec'
|
||||
|
|
15
Gemfile.lock
15
Gemfile.lock
|
@ -24,6 +24,7 @@ GEM
|
|||
chef-sugar (2.5.0)
|
||||
cleanroom (1.0.0)
|
||||
colorize (0.6.0)
|
||||
diff-lcs (1.2.5)
|
||||
ffi (1.9.8)
|
||||
ffi-yajl (1.4.0)
|
||||
ffi (~> 1.5)
|
||||
|
@ -57,6 +58,19 @@ GEM
|
|||
thor (= 0.18.1)
|
||||
rest-client (1.6.7)
|
||||
mime-types (>= 1.16)
|
||||
rspec (3.2.0)
|
||||
rspec-core (~> 3.2.0)
|
||||
rspec-expectations (~> 3.2.0)
|
||||
rspec-mocks (~> 3.2.0)
|
||||
rspec-core (3.2.3)
|
||||
rspec-support (~> 3.2.0)
|
||||
rspec-expectations (3.2.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.2.0)
|
||||
rspec-mocks (3.2.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.2.0)
|
||||
rspec-support (3.2.2)
|
||||
systemu (2.6.5)
|
||||
thor (0.18.1)
|
||||
uber-s3 (0.2.4)
|
||||
|
@ -72,4 +86,5 @@ DEPENDENCIES
|
|||
omnibus!
|
||||
omnibus-software!
|
||||
package_cloud
|
||||
rspec
|
||||
thor (= 0.18.1)
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
## limitations under the License.
|
||||
##
|
||||
#
|
||||
|
||||
require "#{Omnibus::Config.project_root}/lib/gitlab/build_iteration"
|
||||
|
||||
ee = system("#{Omnibus::Config.project_root}/support/is_gitlab_ee.sh")
|
||||
|
||||
if ee
|
||||
|
@ -40,7 +43,7 @@ conflict "gitlab"
|
|||
|
||||
install_dir "/opt/gitlab"
|
||||
build_version Omnibus::BuildVersion.new.semver
|
||||
build_iteration 1
|
||||
build_iteration Gitlab::BuildIteration.new.build_iteration
|
||||
|
||||
override :ruby, version: '2.1.6', source: { md5: "6e5564364be085c45576787b48eeb75f" }
|
||||
override :rubygems, version: '2.2.5', source: { md5: "7701b5bc348d8da41a511ac012a092a8" }
|
||||
|
|
|
@ -26,11 +26,21 @@ git pull https://gitlab.com/gitlab-org/omnibus-gitlab.git 6-6-stable # existing
|
|||
git commit -m 'Pin GitLab to v6.6.0' config/software/gitlab-rails.rb
|
||||
```
|
||||
|
||||
- Create an annotated tag on omnibus-gitlab corresponding to the GitLab tag.
|
||||
GitLab tag `v6.6.0` becomes omnibus-gitlab tag `6.6.0.omnibus`.
|
||||
Create an annotated tag on omnibus-gitlab corresponding to the GitLab tag. The
|
||||
omnibus tag looks like: `MAJOR.MINOR.PATCH+OTHER.OMNIBUS_RELEASE`, where
|
||||
`MAJOR.MINOR.PATCH` is the GitLab version, `OTHER` can be something like `ce`,
|
||||
`ee` or `rc1` (or `rc1.ee`), and `OMNIBUS_RELEASE` is a number (starting at 0).
|
||||
|
||||
> Do NOT use `-` in the omnibus-gitlab tag anywhere.
|
||||
|
||||
Example tags, with 'upstream tag => omnibus tag sequence':
|
||||
|
||||
- `v7.10.4` => `7.10.4+ce.0`, `7.10.4+ce.1`, ...
|
||||
- `v7.10.4-ee` => `7.10.4+ee.0`, `7.10.4+ee.1`, ...
|
||||
- `v7.11.0.rc1-ee` => `7.11.0+rc1.ee.0`, `7.11.0+rc1.ee.1`, ...
|
||||
|
||||
```shell
|
||||
git tag -a 6.6.0.omnibus -m 'Pin GitLab to v6.6.0'
|
||||
git tag -a 6.6.0+ce.0 -m 'Pin GitLab to v6.6.0'
|
||||
```
|
||||
|
||||
- Push the branch and the tag to the main repository and dev.gitlab.org.
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# This module has tests in spec/gitlab/build_iteration_spec.rb
|
||||
|
||||
module Gitlab
|
||||
class BuildIteration
|
||||
def initialize(git_describe=nil)
|
||||
@git_describe = git_describe || `git describe`
|
||||
end
|
||||
|
||||
def build_iteration
|
||||
match = /[^+]*\+(..*)$/.match(@git_describe)
|
||||
if match
|
||||
match[1]
|
||||
else
|
||||
'0'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,31 @@
|
|||
require_relative '../../lib/gitlab/build_iteration.rb'
|
||||
|
||||
describe Gitlab::BuildIteration do
|
||||
describe :build_iteration do
|
||||
subject { Gitlab::BuildIteration.new(git_describe) }
|
||||
|
||||
context 'with an invalid git_describe' do
|
||||
let(:git_describe) { '1.2.3-foo.3' }
|
||||
|
||||
it 'returns 0' do
|
||||
expect(subject.build_iteration).to eq('0')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a proper git_describe' do
|
||||
let(:git_describe) { '1.2.3+foo.4' }
|
||||
|
||||
it 'returns foo.4' do
|
||||
expect(subject.build_iteration).to eq('foo.4')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with multiple plus signs' do
|
||||
let(:git_describe) { '1.2.3+foo.4+bar' }
|
||||
|
||||
it 'returns everything after the first plus' do
|
||||
expect(subject.build_iteration).to eq('foo.4+bar')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue