omnibus 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/.yardopts +0 -1
- data/CHANGELOG.md +19 -0
- data/README.md +6 -0
- data/lib/omnibus.rb +3 -6
- data/lib/omnibus/artifact.rb +151 -0
- data/lib/omnibus/cli/application.rb +4 -0
- data/lib/omnibus/cli/base.rb +6 -2
- data/lib/omnibus/cli/release.rb +49 -0
- data/lib/omnibus/config.rb +29 -0
- data/lib/omnibus/exceptions.rb +59 -0
- data/lib/omnibus/health_check.rb +17 -1
- data/lib/omnibus/library.rb +9 -17
- data/lib/omnibus/package_release.rb +163 -0
- data/lib/omnibus/project.rb +162 -66
- data/lib/omnibus/reports.rb +5 -5
- data/lib/omnibus/software.rb +6 -6
- data/lib/omnibus/version.rb +1 -1
- data/omnibus.gemspec +1 -1
- data/spec/artifact_spec.rb +106 -0
- data/spec/package_release_spec.rb +197 -0
- metadata +13 -6
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmE1YTFhZDlhZTEyOGJlMzFiNTc2YzY0OWU2NTYxODVlOGVkNWZkMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWVkZDk0ZTg4OTNiODU4OWQwYzU5ZDRkMmMxMzM1ODM5OGZiYWRjZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MWEyOWQyZDNkMWNjZDNmNmExODE5OWNhNDRiZDVkOTQyYzg4NjZhZWNkZDVl
|
10
|
+
MGY2OWMxMWFlNzljMWJkZDY2ODExYjIwZjEwN2NmODM1ZDkxZjJjN2FhMDQx
|
11
|
+
ZjliZDA0MWQzYzExNmY4ZmI0MmE4NjA4ZGZmZDU4ZmE5MzA3OTE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MWQ4Yjg1Mjc3ZTMxNDBjNjk1MGRiZWZlNDk5NWUxOGU0OTQ4Y2NkNTQ2OTVj
|
14
|
+
MjIxZmNhMjY0ZTFhNGVlYzIxOTYwNmNjZTY4MjczODhkYmUyMWFmZGYwOTI1
|
15
|
+
ZGY2ZGExN2ZlODRlNWE2YzBlMjUxYjY1NmZmOWY1YTU0MjNiNmU=
|
data/.yardopts
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
## 1.0.4 (May 23, 2013)
|
2
|
+
|
3
|
+
FEATURES:
|
4
|
+
|
5
|
+
* Add `release package` command which releases a single package with associated
|
6
|
+
metadata file to a single S3 bucket.
|
7
|
+
* Arch Linux health check whitelist support
|
8
|
+
|
9
|
+
IMPROVEMENTS:
|
10
|
+
|
11
|
+
* Add libstdc++ to Mac whitelist libs - this allows the health check pass when
|
12
|
+
depending on C++ libs.
|
13
|
+
* Change scope of `Omnibus::Library` instance from global to project.
|
14
|
+
|
15
|
+
BUG FIXES:
|
16
|
+
|
17
|
+
* [CHEF-4214] - projects in multi-project omnibus repositories share dependency scope
|
18
|
+
|
19
|
+
|
1
20
|
## 1.0.3 (May 2, 2013)
|
2
21
|
|
3
22
|
FEATURES:
|
data/README.md
CHANGED
@@ -6,6 +6,12 @@
|
|
6
6
|
Easily create full-stack installers for your project across a variety
|
7
7
|
of platforms.
|
8
8
|
|
9
|
+
Seth Chisamore and Christopher Maier of Opscode gave an introductory
|
10
|
+
talk on Omnibus at ChefConf 2013, entitled **Eat the Whole Bowl:
|
11
|
+
Building a Full-Stack Installer with Omnibus**
|
12
|
+
([video](http://www.youtube.com/watch?v=q8iJAntXCNY),
|
13
|
+
[slides](https://speakerdeck.com/schisamo/eat-the-whole-bowl-building-a-full-stack-installer-with-omnibus)).
|
14
|
+
|
9
15
|
## Prerequisites
|
10
16
|
|
11
17
|
Omnibus is designed to run with a minimal set of prerequisites. You'll
|
data/lib/omnibus.rb
CHANGED
@@ -188,13 +188,10 @@ module Omnibus
|
|
188
188
|
raise ArgumentError, "Overrides argument must be a hash! You passed #{overrides.inspect}."
|
189
189
|
end
|
190
190
|
|
191
|
-
|
192
|
-
|
193
|
-
# projects?
|
194
|
-
software_files.each do |f|
|
195
|
-
Omnibus.projects.each do |p|
|
191
|
+
Omnibus.projects.each do |p|
|
192
|
+
software_files.each do |f|
|
196
193
|
s = Omnibus::Software.load(f, p, overrides)
|
197
|
-
|
194
|
+
p.library.component_added(s) if p.dependency?(s.name)
|
198
195
|
end
|
199
196
|
end
|
200
197
|
end
|
@@ -0,0 +1,151 @@
|
|
1
|
+
module Omnibus
|
2
|
+
class Artifact
|
3
|
+
|
4
|
+
attr_reader :path
|
5
|
+
attr_reader :platforms
|
6
|
+
attr_reader :config
|
7
|
+
|
8
|
+
# @param path [String] relative or absolute path to a package file.
|
9
|
+
# @param platforms [Array<Array<String, String, String>>] an Array of
|
10
|
+
# distro, distro version, architecture tuples. By convention, the first
|
11
|
+
# platform is the platform on which the artifact was built.
|
12
|
+
# @param config [#Hash<Symbol, Object>] configuration for the release.
|
13
|
+
# Artifact only uses `:build_version => String`.
|
14
|
+
def initialize(path, platforms, config)
|
15
|
+
@path = path
|
16
|
+
@platforms = platforms
|
17
|
+
@config = config
|
18
|
+
end
|
19
|
+
|
20
|
+
# Adds this artifact to the `release_manifest`, which is mutated. Intended
|
21
|
+
# to be used in a visitor-pattern fashion over a collection of Artifacts to
|
22
|
+
# generate a final release manifest.
|
23
|
+
#
|
24
|
+
# @param release_manifest [Hash{ String => Hash }] a version 1 style release
|
25
|
+
# manifest Hash (see example)
|
26
|
+
#
|
27
|
+
# @example Add the package to release_manifest:
|
28
|
+
# add_to_release_manifest!( {} )
|
29
|
+
# "el" => {
|
30
|
+
# "5" => { "x86_64" => { "11.4.0-1" => "/el/5/x86_64/demoproject-11.4.0-1.el5.x86_64.rpm" } }
|
31
|
+
# }
|
32
|
+
# @return [Hash{String=>Hash}] the updated release manifest.
|
33
|
+
def add_to_release_manifest!(release_manifest)
|
34
|
+
platforms.each do |distro, version, arch|
|
35
|
+
release_manifest[distro] ||= {}
|
36
|
+
release_manifest[distro][version] ||= {}
|
37
|
+
release_manifest[distro][version][arch] = { build_version => relpath }
|
38
|
+
# TODO: when adding checksums, the desired format is like this:
|
39
|
+
# build_support_json[platform][platform_version][machine_architecture][options[:version]]["relpath"] = build_location
|
40
|
+
end
|
41
|
+
release_manifest
|
42
|
+
end
|
43
|
+
|
44
|
+
# Adds this artifact to the `release_manifest`, which is mutated. Intended
|
45
|
+
# to be used in a visitor-pattern fashion over a collection of Artifacts to
|
46
|
+
# generate a final release manifest.
|
47
|
+
#
|
48
|
+
# @param release_manifest [Hash{ String => Hash }] a version 2 style release
|
49
|
+
# manifest Hash (see example)
|
50
|
+
#
|
51
|
+
# @example Add the package to release_manifest:
|
52
|
+
# add_to_release_manifest!( {} )
|
53
|
+
# "el" => {
|
54
|
+
# "5" => {
|
55
|
+
# "x86_64" => {
|
56
|
+
# "11.4.0-1" => {
|
57
|
+
# "relpath" => "/el/5/x86_64/demoproject-11.4.0-1.el5.x86_64.rpm",
|
58
|
+
# "md5" => "123f00d...",
|
59
|
+
# "sha256" => 456beef..."
|
60
|
+
# }
|
61
|
+
# }
|
62
|
+
# }
|
63
|
+
# }
|
64
|
+
# @return [Hash{String=>Hash}] the updated release manifest.
|
65
|
+
def add_to_v2_release_manifest!(release_manifest)
|
66
|
+
platforms.each do |distro, version, arch|
|
67
|
+
pkg_info = {
|
68
|
+
"relpath" => relpath,
|
69
|
+
"md5" => md5,
|
70
|
+
"sha256" => sha256
|
71
|
+
}
|
72
|
+
|
73
|
+
release_manifest[distro] ||= {}
|
74
|
+
release_manifest[distro][version] ||= {}
|
75
|
+
release_manifest[distro][version][arch] = { build_version => pkg_info }
|
76
|
+
end
|
77
|
+
release_manifest
|
78
|
+
end
|
79
|
+
|
80
|
+
# Metadata about the artifact as a flat Hash.
|
81
|
+
#
|
82
|
+
# @example For a RHEL/CentOS 6, 64-bit package of project version 11.4.0-1
|
83
|
+
# flat_metadata
|
84
|
+
# { "platform" => "el",
|
85
|
+
# "platform_version" => "6",
|
86
|
+
# "arch" => "x86_64",
|
87
|
+
# "version" => "11.4.0-1",
|
88
|
+
# "md5" => "d41d8cd98f00b204e9800998ecf8427e",
|
89
|
+
# "sha256" => "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }
|
90
|
+
#
|
91
|
+
# @return [Hash{String=>String}] the artifact metadata
|
92
|
+
def flat_metadata
|
93
|
+
distro, version, arch = build_platform
|
94
|
+
{
|
95
|
+
"platform" => distro,
|
96
|
+
"platform_version" => version,
|
97
|
+
"arch" => arch,
|
98
|
+
"version" => build_version,
|
99
|
+
"basename" => File.basename(path),
|
100
|
+
"md5" => md5,
|
101
|
+
"sha256" => sha256
|
102
|
+
}
|
103
|
+
end
|
104
|
+
|
105
|
+
# Platform on which the artifact was built. By convention, this is the
|
106
|
+
# first in the list of platforms passed to {#initialize}.
|
107
|
+
# @return [Array<String, String, String>] an Array of distro, distro
|
108
|
+
# version, architecture.
|
109
|
+
def build_platform
|
110
|
+
platforms.first
|
111
|
+
end
|
112
|
+
|
113
|
+
# @return [String] build version of the project.
|
114
|
+
def build_version
|
115
|
+
config[:version]
|
116
|
+
end
|
117
|
+
|
118
|
+
# @return [String] relative path at which the artifact should be located
|
119
|
+
# when uploaded to artifact repo.
|
120
|
+
# @example Chef 11.4.0-1 on 64 bit RHEL 6:
|
121
|
+
# relpath
|
122
|
+
# "/el/6/x86_64/chef-11.4.0-1.el5.x86_64.rpm"
|
123
|
+
def relpath
|
124
|
+
# upload build to build platform directory
|
125
|
+
"/#{build_platform.join('/')}/#{path.split('/').last}"
|
126
|
+
end
|
127
|
+
|
128
|
+
# @return [String] hex encoded MD5 of the package
|
129
|
+
def md5
|
130
|
+
@md5 ||= digest(Digest::MD5)
|
131
|
+
end
|
132
|
+
|
133
|
+
# @return [String] hex encoded SHA2-256 of the package
|
134
|
+
def sha256
|
135
|
+
@sha256 ||= digest(Digest::SHA256)
|
136
|
+
end
|
137
|
+
|
138
|
+
private
|
139
|
+
|
140
|
+
def digest(digest_class)
|
141
|
+
digest = digest_class.new
|
142
|
+
File.open(path) do |io|
|
143
|
+
while chunk = io.read(1024 * 8)
|
144
|
+
digest.update(chunk)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
digest.hexdigest
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
@@ -19,6 +19,7 @@ require 'omnibus'
|
|
19
19
|
require 'omnibus/cli/base'
|
20
20
|
require 'omnibus/cli/build'
|
21
21
|
require 'omnibus/cli/cache'
|
22
|
+
require 'omnibus/cli/release'
|
22
23
|
|
23
24
|
module Omnibus
|
24
25
|
module CLI
|
@@ -109,6 +110,9 @@ module Omnibus
|
|
109
110
|
desc "cache [COMMAND]", "Perform cache management tasks"
|
110
111
|
subcommand "cache", Omnibus::CLI::Cache
|
111
112
|
|
113
|
+
desc "release [COMMAND]", "Perform release tasks"
|
114
|
+
subcommand "release", Omnibus::CLI::Release
|
115
|
+
|
112
116
|
###########################################################################
|
113
117
|
# Class Methods
|
114
118
|
###########################################################################
|
data/lib/omnibus/cli/base.rb
CHANGED
@@ -37,12 +37,16 @@ module Omnibus
|
|
37
37
|
current_command = config[:current_command] ? config[:current_command].name : config[:current_task].name
|
38
38
|
return if current_command == "help"
|
39
39
|
|
40
|
-
if
|
41
|
-
if
|
40
|
+
if config = @options[:config]
|
41
|
+
if config && File.exist?(@options[:config])
|
42
42
|
say("Using Omnibus configuration file #{config}", :green)
|
43
43
|
Omnibus.load_configuration(config)
|
44
|
+
elsif config
|
45
|
+
say("No configuration file `#{config}', using defaults", :yellow)
|
44
46
|
end
|
47
|
+
end
|
45
48
|
|
49
|
+
if path = @options[:path]
|
46
50
|
# TODO: merge in all relevant CLI options here, as they should
|
47
51
|
# override anything from a configuration file.
|
48
52
|
Omnibus::Config.project_root(path)
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2013 Opscode, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'omnibus/cli/base'
|
19
|
+
require 'omnibus/cli/application'
|
20
|
+
require 'omnibus/package_release'
|
21
|
+
require 'json'
|
22
|
+
|
23
|
+
module Omnibus
|
24
|
+
module CLI
|
25
|
+
|
26
|
+
|
27
|
+
class Release < Base
|
28
|
+
|
29
|
+
namespace :release
|
30
|
+
|
31
|
+
def initialize(args, options, config)
|
32
|
+
super(args, options, config)
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "package PATH", "Upload a single package to S3"
|
36
|
+
option :public, :type => :boolean, :default => false, :desc => "Make S3 object publicly readable"
|
37
|
+
def package(path)
|
38
|
+
access_policy = options[:public] ? :public_read : :private
|
39
|
+
|
40
|
+
uploader = PackageRelease.new(path, :access => access_policy) do |uploaded_item|
|
41
|
+
say("Uploaded #{uploaded_item}", :green)
|
42
|
+
end
|
43
|
+
uploader.release
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
data/lib/omnibus/config.rb
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
|
18
18
|
require 'mixlib/config'
|
19
19
|
require 'omnibus/exceptions'
|
20
|
+
require 'json'
|
20
21
|
|
21
22
|
module Omnibus
|
22
23
|
|
@@ -145,6 +146,34 @@ module Omnibus
|
|
145
146
|
|
146
147
|
# @!endgroup
|
147
148
|
|
149
|
+
# @!group S3 Release Parameters
|
150
|
+
|
151
|
+
# @!attribute [rw] release_s3_bucket
|
152
|
+
# The name of the S3 bucket you want to release artifacts to.
|
153
|
+
#
|
154
|
+
# Defaults to `nil`. Must be set to use `release package` command.
|
155
|
+
#
|
156
|
+
# @return [String, nil]
|
157
|
+
release_s3_bucket nil
|
158
|
+
|
159
|
+
# @!attribute [rw] release_s3_access_key
|
160
|
+
# The S3 access key to use for S3 artifact release.
|
161
|
+
#
|
162
|
+
# Defaults to `nil`. Must be set to use `release package` command.
|
163
|
+
#
|
164
|
+
# @return [String, nil]
|
165
|
+
release_s3_access_key nil
|
166
|
+
|
167
|
+
# @!attribute [rw] release_s3_secret_key
|
168
|
+
# The S3 secret key to use for S3 artifact release
|
169
|
+
#
|
170
|
+
# Defaults to `nil`. Must be set to use `release package` command.
|
171
|
+
#
|
172
|
+
# @return [String, nil]
|
173
|
+
release_s3_secret_key nil
|
174
|
+
|
175
|
+
# @!endgroup
|
176
|
+
|
148
177
|
# @!group Miscellaneous Configuration Parameters
|
149
178
|
|
150
179
|
# @!attribute [rw] override_file
|
data/lib/omnibus/exceptions.rb
CHANGED
@@ -32,6 +32,65 @@ module Omnibus
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
class NoPackageFile < RuntimeError
|
36
|
+
def initialize(package_path)
|
37
|
+
@package_path = package_path
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_s
|
41
|
+
"""
|
42
|
+
Cannot locate or access the package at the given path:
|
43
|
+
|
44
|
+
#{@package_path}
|
45
|
+
"""
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class NoPackageMetadataFile < RuntimeError
|
50
|
+
def initialize(package_metadata_path)
|
51
|
+
@package_metadata_path = package_metadata_path
|
52
|
+
end
|
53
|
+
|
54
|
+
def to_s
|
55
|
+
"""
|
56
|
+
Cannot locate or access the package metadata file at the given path:
|
57
|
+
|
58
|
+
#{@package_metadata_path}
|
59
|
+
"""
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class InvalidS3ReleaseConfiguration < RuntimeError
|
64
|
+
def initialize(s3_bucket, s3_access_key, s3_secret_key)
|
65
|
+
@s3_bucket, @s3_access_key, @s3_secret_key = s3_bucket, s3_access_key, s3_secret_key
|
66
|
+
end
|
67
|
+
|
68
|
+
def to_s
|
69
|
+
"""
|
70
|
+
One or more required S3 configuration values is missing.
|
71
|
+
|
72
|
+
Your effective configuration was the following:
|
73
|
+
|
74
|
+
release_s3_bucket => #{@s3_bucket.inspect}
|
75
|
+
release_s3_access_key => #{@s3_access_key.inspect}
|
76
|
+
release_s3_secret_key => #{@s3_secret_key.inspect}
|
77
|
+
|
78
|
+
To release a package to S3, add the following values to your
|
79
|
+
config file:
|
80
|
+
|
81
|
+
release_s3_bucket ENV['S3_BUCKET_NAME']
|
82
|
+
release_s3_access_key ENV['S3_ACCESS_KEY']
|
83
|
+
release_s3_secret_key ENV['S3_SECRET_KEY']
|
84
|
+
|
85
|
+
Note that you are not required to use environment variables as
|
86
|
+
illustrated (and the ones listed have no special significance in
|
87
|
+
Omnibus), but it is encouraged to prevent spread of sensitive
|
88
|
+
information and inadvertent check-in of same to version control
|
89
|
+
systems.
|
90
|
+
|
91
|
+
"""
|
92
|
+
end
|
93
|
+
end
|
35
94
|
# Raise this error if a needed Project configuration value has not
|
36
95
|
# been set.
|
37
96
|
class MissingProjectConfiguration < RuntimeError
|
data/lib/omnibus/health_check.rb
CHANGED
@@ -36,6 +36,19 @@ module Omnibus
|
|
36
36
|
/linux-gate\.so/
|
37
37
|
]
|
38
38
|
|
39
|
+
ARCH_WHITELIST_LIBS = [
|
40
|
+
/libc\.so/,
|
41
|
+
/libcrypt\.so/,
|
42
|
+
/libdb-5\.3\.so/,
|
43
|
+
/libdl\.so/,
|
44
|
+
/libffi\.so/,
|
45
|
+
/libgdbm\.so/,
|
46
|
+
/libm\.so/,
|
47
|
+
/libpthread\.so/,
|
48
|
+
/librt\.so/,
|
49
|
+
/libutil\.so/
|
50
|
+
]
|
51
|
+
|
39
52
|
SOLARIS_WHITELIST_LIBS = [
|
40
53
|
/libaio\.so/,
|
41
54
|
/libavl\.so/,
|
@@ -96,7 +109,8 @@ module Omnibus
|
|
96
109
|
/libutil\.dylib/,
|
97
110
|
/libffi\.dylib/,
|
98
111
|
/libncurses\.5\.4\.dylib/,
|
99
|
-
/libiconv
|
112
|
+
/libiconv/,
|
113
|
+
/libstdc\+\+\.6\.dylib/
|
100
114
|
]
|
101
115
|
|
102
116
|
FREEBSD_WHITELIST_LIBS = [
|
@@ -202,6 +216,8 @@ module Omnibus
|
|
202
216
|
safe = nil
|
203
217
|
|
204
218
|
whitelist_libs = case OHAI.platform
|
219
|
+
when 'arch'
|
220
|
+
ARCH_WHITELIST_LIBS
|
205
221
|
when 'mac_os_x'
|
206
222
|
MAC_WHITELIST_LIBS
|
207
223
|
when 'solaris2'
|