omnibus 5.4.0 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -3
- data/CHANGELOG.md +21 -0
- data/Gemfile +8 -5
- data/README.md +3 -1
- data/Rakefile +20 -13
- data/appveyor.yml +4 -3
- data/bin/omnibus +3 -3
- data/features/commands/manifest.feature +19 -5
- data/features/step_definitions/generator_steps.rb +5 -6
- data/features/support/env.rb +4 -4
- data/lib/omnibus/build_version.rb +14 -14
- data/lib/omnibus/build_version_dsl.rb +3 -3
- data/lib/omnibus/builder.rb +50 -61
- data/lib/omnibus/changelog.rb +2 -2
- data/lib/omnibus/changelog_printer.rb +4 -4
- data/lib/omnibus/cleaner.rb +4 -4
- data/lib/omnibus/cli/base.rb +15 -15
- data/lib/omnibus/cli/cache.rb +13 -13
- data/lib/omnibus/cli/changelog.rb +8 -9
- data/lib/omnibus/cli/publish.rb +12 -13
- data/lib/omnibus/cli.rb +26 -27
- data/lib/omnibus/compressor.rb +6 -6
- data/lib/omnibus/compressors/base.rb +7 -2
- data/lib/omnibus/compressors/dmg.rb +12 -12
- data/lib/omnibus/compressors/null.rb +1 -1
- data/lib/omnibus/compressors/tgz.rb +8 -8
- data/lib/omnibus/config.rb +37 -26
- data/lib/omnibus/core_extensions/open_uri.rb +3 -3
- data/lib/omnibus/core_extensions.rb +1 -1
- data/lib/omnibus/digestable.rb +5 -4
- data/lib/omnibus/download_helpers.rb +7 -6
- data/lib/omnibus/exceptions.rb +29 -13
- data/lib/omnibus/fetcher.rb +0 -1
- data/lib/omnibus/fetchers/git_fetcher.rb +7 -7
- data/lib/omnibus/fetchers/net_fetcher.rb +19 -19
- data/lib/omnibus/fetchers/path_fetcher.rb +1 -1
- data/lib/omnibus/file_syncer.rb +3 -3
- data/lib/omnibus/generator.rb +60 -47
- data/lib/omnibus/git_cache.rb +33 -22
- data/lib/omnibus/git_repository.rb +5 -5
- data/lib/omnibus/health_check.rb +122 -119
- data/lib/omnibus/instrumentation.rb +1 -1
- data/lib/omnibus/licensing.rb +348 -60
- data/lib/omnibus/logger.rb +12 -9
- data/lib/omnibus/logging.rb +1 -1
- data/lib/omnibus/manifest.rb +4 -4
- data/lib/omnibus/manifest_diff.rb +6 -7
- data/lib/omnibus/manifest_entry.rb +1 -1
- data/lib/omnibus/metadata.rb +36 -36
- data/lib/omnibus/ohai.rb +6 -7
- data/lib/omnibus/package.rb +1 -1
- data/lib/omnibus/packager.rb +37 -28
- data/lib/omnibus/packagers/appx.rb +86 -0
- data/lib/omnibus/packagers/base.rb +21 -18
- data/lib/omnibus/packagers/bff.rb +22 -24
- data/lib/omnibus/packagers/deb.rb +20 -20
- data/lib/omnibus/packagers/ips.rb +18 -17
- data/lib/omnibus/packagers/makeself.rb +7 -7
- data/lib/omnibus/packagers/msi.rb +38 -193
- data/lib/omnibus/packagers/pkg.rb +16 -16
- data/lib/omnibus/packagers/rpm.rb +53 -54
- data/lib/omnibus/packagers/solaris.rb +14 -14
- data/lib/omnibus/packagers/windows_base.rb +192 -0
- data/lib/omnibus/project.rb +45 -43
- data/lib/omnibus/publisher.rb +3 -3
- data/lib/omnibus/publishers/artifactory_publisher.rb +39 -39
- data/lib/omnibus/publishers/s3_publisher.rb +7 -7
- data/lib/omnibus/reports.rb +10 -10
- data/lib/omnibus/s3_cache.rb +7 -7
- data/lib/omnibus/s3_helpers.rb +8 -7
- data/lib/omnibus/semantic_version.rb +1 -1
- data/lib/omnibus/software.rb +131 -81
- data/lib/omnibus/sugarable.rb +10 -10
- data/lib/omnibus/templating.rb +5 -5
- data/lib/omnibus/thread_pool.rb +1 -1
- data/lib/omnibus/util.rb +5 -5
- data/lib/omnibus/version.rb +1 -1
- data/lib/omnibus.rb +65 -65
- data/omnibus.gemspec +34 -32
- data/resources/appx/AppxManifest.xml.erb +18 -0
- data/resources/appx/assets/clear.png +0 -0
- data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-bundler-audit-0.5.0-COPYING.txt +674 -0
- data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-inifile-3.0.0-README.md +215 -0
- data/spec/fixtures/licensing/license_scout/snoopy/snoopy-dependency-licenses.json +24 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-inifile-3.0.0-README.md +215 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mime-types-3.1-Licence.rdoc +25 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mini_portile2-2.1.0-LICENSE.txt +20 -0
- data/spec/fixtures/licensing/license_scout/zlib/zlib-dependency-licenses.json +32 -0
- data/spec/functional/builder_spec.rb +149 -150
- data/spec/functional/fetchers/git_fetcher_spec.rb +69 -71
- data/spec/functional/fetchers/net_fetcher_spec.rb +79 -79
- data/spec/functional/fetchers/path_fetcher_spec.rb +19 -20
- data/spec/functional/file_syncer_spec.rb +74 -74
- data/spec/functional/licensing_spec.rb +344 -35
- data/spec/functional/templating_spec.rb +17 -17
- data/spec/spec_helper.rb +20 -20
- data/spec/support/examples.rb +21 -15
- data/spec/support/file_helpers.rb +1 -1
- data/spec/support/git_helpers.rb +37 -37
- data/spec/support/matchers.rb +3 -3
- data/spec/support/ohai_helpers.rb +4 -4
- data/spec/support/path_helpers.rb +2 -2
- data/spec/support/shell_helpers.rb +2 -2
- data/spec/unit/build_version_dsl_spec.rb +5 -5
- data/spec/unit/build_version_spec.rb +63 -63
- data/spec/unit/builder_spec.rb +86 -70
- data/spec/unit/changelog_spec.rb +4 -4
- data/spec/unit/changelogprinter_spec.rb +130 -0
- data/spec/unit/cleanroom_spec.rb +11 -11
- data/spec/unit/compressor_spec.rb +16 -16
- data/spec/unit/compressors/base_spec.rb +6 -6
- data/spec/unit/compressors/dmg_spec.rb +76 -76
- data/spec/unit/compressors/null_spec.rb +4 -4
- data/spec/unit/compressors/tgz_spec.rb +20 -20
- data/spec/unit/config_spec.rb +44 -43
- data/spec/unit/digestable_spec.rb +13 -13
- data/spec/unit/fetcher_spec.rb +11 -12
- data/spec/unit/fetchers/git_fetcher_spec.rb +31 -31
- data/spec/unit/fetchers/net_fetcher_spec.rb +172 -173
- data/spec/unit/fetchers/path_fetcher_spec.rb +18 -18
- data/spec/unit/generator_spec.rb +38 -38
- data/spec/unit/git_cache_spec.rb +56 -54
- data/spec/unit/git_repository_spec.rb +2 -2
- data/spec/unit/health_check_spec.rb +40 -40
- data/spec/unit/library_spec.rb +35 -35
- data/spec/unit/manifest_diff_spec.rb +10 -11
- data/spec/unit/manifest_spec.rb +17 -17
- data/spec/unit/metadata_spec.rb +152 -152
- data/spec/unit/ohai_spec.rb +5 -5
- data/spec/unit/omnibus_spec.rb +31 -31
- data/spec/unit/package_spec.rb +20 -20
- data/spec/unit/packager_spec.rb +48 -42
- data/spec/unit/packagers/appx_spec.rb +165 -0
- data/spec/unit/packagers/base_spec.rb +34 -34
- data/spec/unit/packagers/bff_spec.rb +60 -60
- data/spec/unit/packagers/deb_spec.rb +71 -71
- data/spec/unit/packagers/ips_spec.rb +45 -45
- data/spec/unit/packagers/makeself_spec.rb +22 -22
- data/spec/unit/packagers/msi_spec.rb +141 -147
- data/spec/unit/packagers/pkg_spec.rb +59 -60
- data/spec/unit/packagers/rpm_spec.rb +125 -126
- data/spec/unit/packagers/solaris_spec.rb +52 -52
- data/spec/unit/project_spec.rb +137 -135
- data/spec/unit/publisher_spec.rb +70 -70
- data/spec/unit/publishers/artifactory_publisher_spec.rb +85 -85
- data/spec/unit/publishers/s3_publisher_spec.rb +36 -36
- data/spec/unit/s3_cacher_spec.rb +34 -34
- data/spec/unit/s3_helpers_spec.rb +6 -6
- data/spec/unit/semantic_version_spec.rb +2 -2
- data/spec/unit/software_spec.rb +346 -384
- data/spec/unit/sugarable_spec.rb +10 -10
- data/spec/unit/util_spec.rb +60 -60
- metadata +54 -6
- data/.rubocop.yml +0 -48
data/spec/unit/publisher_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module Omnibus
|
4
4
|
# Used in the tests
|
@@ -7,26 +7,26 @@ module Omnibus
|
|
7
7
|
describe Publisher do
|
8
8
|
it { should be_a_kind_of(Logging) }
|
9
9
|
|
10
|
-
describe
|
10
|
+
describe ".publish" do
|
11
11
|
let(:publisher) { double(described_class) }
|
12
12
|
|
13
13
|
before { allow(described_class).to receive(:new).and_return(publisher) }
|
14
14
|
|
15
|
-
it
|
15
|
+
it "creates a new instance of the class" do
|
16
16
|
expect(described_class).to receive(:new).once
|
17
17
|
expect(publisher).to receive(:publish).once
|
18
|
-
described_class.publish(
|
18
|
+
described_class.publish("/path/to/*.deb")
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
let(:pattern) {
|
22
|
+
let(:pattern) { "/path/to/files/*.deb" }
|
23
23
|
let(:options) { { some_option: true } }
|
24
24
|
|
25
25
|
subject { described_class.new(pattern, options) }
|
26
26
|
|
27
27
|
describe '#packages' do
|
28
|
-
let(:a) {
|
29
|
-
let(:b) {
|
28
|
+
let(:a) { "/path/to/files/a.deb" }
|
29
|
+
let(:b) { "/path/to/files/b.deb" }
|
30
30
|
let(:glob) { [a, b] }
|
31
31
|
|
32
32
|
before do
|
@@ -35,104 +35,104 @@ module Omnibus
|
|
35
35
|
.and_return(glob)
|
36
36
|
end
|
37
37
|
|
38
|
-
it
|
38
|
+
it "returns an array" do
|
39
39
|
expect(subject.packages).to be_an(Array)
|
40
40
|
end
|
41
41
|
|
42
|
-
it
|
42
|
+
it "returns an array of Package objects" do
|
43
43
|
expect(subject.packages.first).to be_a(Package)
|
44
44
|
end
|
45
45
|
|
46
|
-
context
|
46
|
+
context "a platform mappings matrix is provided" do
|
47
47
|
let(:options) do
|
48
48
|
{
|
49
49
|
platform_mappings: {
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
"ubuntu-12.04" => [
|
51
|
+
"ubuntu-12.04",
|
52
|
+
"ubuntu-14.04",
|
53
53
|
],
|
54
54
|
},
|
55
55
|
}
|
56
56
|
end
|
57
57
|
|
58
58
|
let(:package) do
|
59
|
-
Package.new(
|
59
|
+
Package.new("/path/to/files/chef.deb")
|
60
60
|
end
|
61
61
|
|
62
62
|
let(:metadata) do
|
63
63
|
Metadata.new(package,
|
64
|
-
name:
|
65
|
-
friendly_name:
|
66
|
-
homepage:
|
67
|
-
version:
|
64
|
+
name: "chef",
|
65
|
+
friendly_name: "Chef",
|
66
|
+
homepage: "https://www.getchef.com",
|
67
|
+
version: "11.0.6",
|
68
68
|
iteration: 1,
|
69
|
-
basename:
|
70
|
-
license:
|
71
|
-
platform:
|
72
|
-
platform_version:
|
73
|
-
arch:
|
74
|
-
sha1:
|
75
|
-
md5:
|
69
|
+
basename: "chef.deb",
|
70
|
+
license: "Apache-2.0",
|
71
|
+
platform: "ubuntu",
|
72
|
+
platform_version: "12.04",
|
73
|
+
arch: "x86_64",
|
74
|
+
sha1: "SHA1",
|
75
|
+
md5: "ABCDEF123456",
|
76
76
|
version_manifest: {
|
77
77
|
manifest_format: 1,
|
78
|
-
build_version:
|
79
|
-
build_git_revision:
|
78
|
+
build_version: "11.0.6",
|
79
|
+
build_git_revision: "2e763ac957b308ba95cef256c2491a5a55a163cc",
|
80
80
|
software: {
|
81
81
|
zlib: {
|
82
82
|
locked_source: {
|
83
|
-
md5:
|
84
|
-
url:
|
83
|
+
md5: "44d667c142d7cda120332623eab69f40",
|
84
|
+
url: "http://iweb.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz",
|
85
85
|
},
|
86
|
-
locked_version:
|
87
|
-
source_type:
|
88
|
-
described_version:
|
89
|
-
license:
|
86
|
+
locked_version: "1.2.8",
|
87
|
+
source_type: "url",
|
88
|
+
described_version: "1.2.8",
|
89
|
+
license: "Zlib",
|
90
90
|
},
|
91
91
|
openssl: {
|
92
92
|
locked_source: {
|
93
|
-
md5:
|
94
|
-
extract:
|
95
|
-
url:
|
93
|
+
md5: "562986f6937aabc7c11a6d376d8a0d26",
|
94
|
+
extract: "lax_tar",
|
95
|
+
url: "http://iweb.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz",
|
96
96
|
},
|
97
|
-
locked_version:
|
98
|
-
source_type:
|
99
|
-
described_version:
|
100
|
-
license:
|
97
|
+
locked_version: "1.0.1s",
|
98
|
+
source_type: "url",
|
99
|
+
described_version: "1.0.1s",
|
100
|
+
license: "OpenSSL",
|
101
101
|
},
|
102
102
|
ruby: {
|
103
103
|
locked_source: {
|
104
|
-
md5:
|
105
|
-
url:
|
104
|
+
md5: "091b62f0a9796a3c55de2a228a0e6ef3",
|
105
|
+
url: "https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.8.tar.gz",
|
106
106
|
},
|
107
|
-
locked_version:
|
108
|
-
source_type:
|
109
|
-
described_version:
|
110
|
-
license:
|
107
|
+
locked_version: "2.1.8",
|
108
|
+
source_type: "url",
|
109
|
+
described_version: "2.1.8",
|
110
|
+
license: "BSD-2-Clause",
|
111
111
|
},
|
112
112
|
ohai: {
|
113
113
|
locked_source: {
|
114
|
-
git:
|
114
|
+
git: "https://github.com/opscode/ohai.git",
|
115
115
|
},
|
116
|
-
locked_version:
|
117
|
-
source_type:
|
118
|
-
described_version:
|
119
|
-
license:
|
116
|
+
locked_version: "fec0959aa5da5ce7ba0e07740dbc08546a8f53f0",
|
117
|
+
source_type: "git",
|
118
|
+
described_version: "master",
|
119
|
+
license: "Apache-2.0",
|
120
120
|
},
|
121
121
|
chef: {
|
122
122
|
locked_source: {
|
123
|
-
path:
|
123
|
+
path: "/home/jenkins/workspace/chef-build/architecture/x86_64/platform/ubuntu-10.04/project/chef/role/builder/omnibus/files/../..",
|
124
124
|
options: {
|
125
125
|
exclude: [
|
126
|
-
|
126
|
+
"omnibus/vendor",
|
127
127
|
],
|
128
128
|
},
|
129
129
|
},
|
130
|
-
locked_version:
|
131
|
-
source_type:
|
132
|
-
described_version:
|
133
|
-
license:
|
130
|
+
locked_version: "local_source",
|
131
|
+
source_type: "path",
|
132
|
+
described_version: "local_source",
|
133
|
+
license: "Apache-2.0",
|
134
134
|
},
|
135
|
-
}
|
135
|
+
},
|
136
136
|
}
|
137
137
|
)
|
138
138
|
end
|
@@ -142,51 +142,51 @@ module Omnibus
|
|
142
142
|
allow(FileSyncer).to receive_message_chain(:glob, :map).and_return([package])
|
143
143
|
end
|
144
144
|
|
145
|
-
it
|
145
|
+
it "creates a package for each publish platform" do
|
146
146
|
expect(subject.packages.size).to eq(2)
|
147
147
|
expect(
|
148
148
|
subject.packages.map do |p|
|
149
149
|
p.metadata[:platform_version]
|
150
150
|
end
|
151
|
-
).to include(
|
151
|
+
).to include("12.04", "14.04")
|
152
152
|
end
|
153
153
|
|
154
|
-
context
|
154
|
+
context "the build platform does not exist" do
|
155
155
|
let(:options) do
|
156
156
|
{
|
157
157
|
platform_mappings: {
|
158
|
-
|
159
|
-
|
160
|
-
|
158
|
+
"ubuntu-10.04" => [
|
159
|
+
"ubuntu-12.04",
|
160
|
+
"ubuntu-14.04",
|
161
161
|
],
|
162
162
|
},
|
163
163
|
}
|
164
164
|
end
|
165
165
|
|
166
|
-
it
|
166
|
+
it "prints a warning" do
|
167
167
|
output = capture_logging { subject.packages }
|
168
|
-
expect(output).to include(
|
168
|
+
expect(output).to include("Could not locate a package for build platform ubuntu-10.04. Publishing will be skipped for: ubuntu-12.04, ubuntu-14.04")
|
169
169
|
end
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
173
|
-
context
|
173
|
+
context "there are no packages to publish" do
|
174
174
|
before do
|
175
175
|
allow(FileSyncer).to receive(:glob)
|
176
176
|
.with(pattern)
|
177
177
|
.and_return([])
|
178
178
|
end
|
179
179
|
|
180
|
-
it
|
180
|
+
it "prints a warning" do
|
181
181
|
output = capture_logging { subject.packages }
|
182
|
-
expect(output).to include(
|
182
|
+
expect(output).to include("No packages found, skipping publish")
|
183
183
|
end
|
184
184
|
end
|
185
185
|
|
186
186
|
end
|
187
187
|
|
188
188
|
describe '#publish' do
|
189
|
-
it
|
189
|
+
it "is an abstract method" do
|
190
190
|
expect { subject.publish }.to raise_error(NotImplementedError)
|
191
191
|
end
|
192
192
|
end
|
@@ -1,103 +1,103 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module Omnibus
|
4
4
|
describe ArtifactoryPublisher do
|
5
|
-
let(:path) {
|
6
|
-
let(:repository) {
|
5
|
+
let(:path) { "/path/to/files/*.deb" }
|
6
|
+
let(:repository) { "REPO" }
|
7
7
|
|
8
8
|
let(:package) do
|
9
9
|
double(Package,
|
10
|
-
path:
|
11
|
-
name:
|
12
|
-
content:
|
13
|
-
validate!: true
|
10
|
+
path: "/path/to/files/chef.deb",
|
11
|
+
name: "chef.deb",
|
12
|
+
content: "BINARY",
|
13
|
+
validate!: true
|
14
14
|
)
|
15
15
|
end
|
16
16
|
|
17
17
|
let(:metadata) do
|
18
18
|
Metadata.new(package,
|
19
|
-
name:
|
20
|
-
friendly_name:
|
21
|
-
homepage:
|
22
|
-
version:
|
19
|
+
name: "chef",
|
20
|
+
friendly_name: "Chef",
|
21
|
+
homepage: "https://www.getchef.com",
|
22
|
+
version: "11.0.6",
|
23
23
|
iteration: 1,
|
24
|
-
license:
|
25
|
-
basename:
|
26
|
-
platform:
|
27
|
-
platform_version:
|
28
|
-
arch:
|
29
|
-
sha1:
|
30
|
-
sha256:
|
31
|
-
sha512:
|
32
|
-
md5:
|
24
|
+
license: "Apache-2.0",
|
25
|
+
basename: "chef.deb",
|
26
|
+
platform: "ubuntu",
|
27
|
+
platform_version: "14.04",
|
28
|
+
arch: "x86_64",
|
29
|
+
sha1: "SHA1",
|
30
|
+
sha256: "SHA256",
|
31
|
+
sha512: "SHA512",
|
32
|
+
md5: "ABCDEF123456",
|
33
33
|
version_manifest: {
|
34
34
|
manifest_format: 1,
|
35
|
-
build_version:
|
36
|
-
build_git_revision:
|
35
|
+
build_version: "11.0.6",
|
36
|
+
build_git_revision: "2e763ac957b308ba95cef256c2491a5a55a163cc",
|
37
37
|
software: {
|
38
38
|
zlib: {
|
39
39
|
locked_source: {
|
40
|
-
md5:
|
41
|
-
url:
|
40
|
+
md5: "44d667c142d7cda120332623eab69f40",
|
41
|
+
url: "http://iweb.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz",
|
42
42
|
},
|
43
|
-
locked_version:
|
44
|
-
source_type:
|
45
|
-
described_version:
|
46
|
-
license:
|
43
|
+
locked_version: "1.2.8",
|
44
|
+
source_type: "url",
|
45
|
+
described_version: "1.2.8",
|
46
|
+
license: "Zlib",
|
47
47
|
},
|
48
48
|
openssl: {
|
49
49
|
locked_source: {
|
50
|
-
md5:
|
51
|
-
extract:
|
52
|
-
url:
|
50
|
+
md5: "562986f6937aabc7c11a6d376d8a0d26",
|
51
|
+
extract: "lax_tar",
|
52
|
+
url: "http://iweb.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz",
|
53
53
|
},
|
54
|
-
locked_version:
|
55
|
-
source_type:
|
56
|
-
described_version:
|
57
|
-
license:
|
54
|
+
locked_version: "1.0.1s",
|
55
|
+
source_type: "url",
|
56
|
+
described_version: "1.0.1s",
|
57
|
+
license: "OpenSSL",
|
58
58
|
},
|
59
59
|
ruby: {
|
60
60
|
locked_source: {
|
61
|
-
md5:
|
62
|
-
url:
|
61
|
+
md5: "091b62f0a9796a3c55de2a228a0e6ef3",
|
62
|
+
url: "https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.8.tar.gz",
|
63
63
|
},
|
64
|
-
locked_version:
|
65
|
-
source_type:
|
66
|
-
described_version:
|
67
|
-
license:
|
64
|
+
locked_version: "2.1.8",
|
65
|
+
source_type: "url",
|
66
|
+
described_version: "2.1.8",
|
67
|
+
license: "BSD-2-Clause",
|
68
68
|
},
|
69
69
|
ohai: {
|
70
70
|
locked_source: {
|
71
|
-
git:
|
71
|
+
git: "https://github.com/opscode/ohai.git",
|
72
72
|
},
|
73
|
-
locked_version:
|
74
|
-
source_type:
|
75
|
-
described_version:
|
76
|
-
license:
|
73
|
+
locked_version: "fec0959aa5da5ce7ba0e07740dbc08546a8f53f0",
|
74
|
+
source_type: "git",
|
75
|
+
described_version: "master",
|
76
|
+
license: "Apache-2.0",
|
77
77
|
},
|
78
78
|
chef: {
|
79
79
|
locked_source: {
|
80
|
-
path:
|
80
|
+
path: "/home/jenkins/workspace/chef-build/architecture/x86_64/platform/ubuntu-10.04/project/chef/role/builder/omnibus/files/../..",
|
81
81
|
options: {
|
82
82
|
exclude: [
|
83
|
-
|
83
|
+
"omnibus/vendor",
|
84
84
|
],
|
85
85
|
},
|
86
86
|
},
|
87
|
-
locked_version:
|
88
|
-
source_type:
|
89
|
-
described_version:
|
90
|
-
license:
|
87
|
+
locked_version: "local_source",
|
88
|
+
source_type: "path",
|
89
|
+
described_version: "local_source",
|
90
|
+
license: "Apache-2.0",
|
91
91
|
},
|
92
|
-
}
|
92
|
+
},
|
93
93
|
}
|
94
94
|
)
|
95
95
|
end
|
96
96
|
|
97
97
|
let(:packages) { [package] }
|
98
|
-
let(:client) { double(
|
99
|
-
let(:artifact) { double(
|
100
|
-
let(:build) { double(
|
98
|
+
let(:client) { double("Artifactory::Client") }
|
99
|
+
let(:artifact) { double("Artifactory::Resource::Artifact", upload: nil) }
|
100
|
+
let(:build) { double("Artifactory::Resource::Build") }
|
101
101
|
|
102
102
|
let(:package_properties) do
|
103
103
|
{
|
@@ -116,7 +116,7 @@ module Omnibus
|
|
116
116
|
end
|
117
117
|
let(:metadata_json_properites) do
|
118
118
|
# we don't attache checksum properties to the *.metadata.json
|
119
|
-
package_properties.delete_if { |k,v| k =~ /md5|sha/ }
|
119
|
+
package_properties.delete_if { |k, v| k =~ /md5|sha/ }
|
120
120
|
end
|
121
121
|
let(:build_values) do
|
122
122
|
{
|
@@ -125,7 +125,7 @@ module Omnibus
|
|
125
125
|
}
|
126
126
|
end
|
127
127
|
|
128
|
-
let(:options) { {repository: repository} }
|
128
|
+
let(:options) { { repository: repository } }
|
129
129
|
|
130
130
|
before do
|
131
131
|
allow(subject).to receive(:client).and_return(client)
|
@@ -140,20 +140,20 @@ module Omnibus
|
|
140
140
|
describe '#publish' do
|
141
141
|
before do
|
142
142
|
allow(subject).to receive(:packages).and_return(packages)
|
143
|
-
Config.artifactory_base_path(
|
143
|
+
Config.artifactory_base_path("com/getchef")
|
144
144
|
Config.publish_retries(1)
|
145
145
|
end
|
146
146
|
|
147
|
-
it
|
147
|
+
it "validates the package" do
|
148
148
|
expect(package).to receive(:validate!).once
|
149
149
|
subject.publish
|
150
150
|
end
|
151
151
|
|
152
|
-
it
|
152
|
+
it "uploads the package" do
|
153
153
|
expect(artifact).to receive(:upload).with(
|
154
154
|
repository,
|
155
|
-
|
156
|
-
hash_including(package_properties)
|
155
|
+
"com/getchef/chef/11.0.6/ubuntu/14.04/chef.deb",
|
156
|
+
hash_including(package_properties)
|
157
157
|
).once
|
158
158
|
|
159
159
|
subject.publish
|
@@ -162,28 +162,28 @@ module Omnibus
|
|
162
162
|
it "uploads the package's associated *.metadata.json" do
|
163
163
|
expect(artifact).to receive(:upload).with(
|
164
164
|
repository,
|
165
|
-
|
166
|
-
hash_including(metadata_json_properites)
|
165
|
+
"com/getchef/chef/11.0.6/ubuntu/14.04/chef.deb.metadata.json",
|
166
|
+
hash_including(metadata_json_properites)
|
167
167
|
).once
|
168
168
|
|
169
169
|
subject.publish
|
170
170
|
end
|
171
171
|
|
172
|
-
it
|
172
|
+
it "it creates a build record for all packages" do
|
173
173
|
expect(build).to receive(:save).once
|
174
174
|
subject.publish
|
175
175
|
end
|
176
176
|
|
177
|
-
context
|
177
|
+
context "when no packages exist" do
|
178
178
|
let(:packages) { [] }
|
179
179
|
|
180
|
-
it
|
180
|
+
it "does nothing" do
|
181
181
|
expect(artifact).to_not receive(:upload)
|
182
182
|
expect(build).to_not receive(:save)
|
183
183
|
end
|
184
184
|
end
|
185
185
|
|
186
|
-
context
|
186
|
+
context "when upload fails" do
|
187
187
|
before do
|
188
188
|
Config.publish_retries(3)
|
189
189
|
|
@@ -192,39 +192,39 @@ module Omnibus
|
|
192
192
|
@times = 0
|
193
193
|
allow(artifact).to receive(:upload) do
|
194
194
|
@times += 1;
|
195
|
-
raise Artifactory::Error::HTTPError.new(
|
195
|
+
raise Artifactory::Error::HTTPError.new("status" => "409", "message" => "CONFLICT") unless @times > 1
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
|
-
it
|
199
|
+
it "retries the upload " do
|
200
200
|
output = capture_logging { subject.publish }
|
201
|
-
expect(output).to include(
|
201
|
+
expect(output).to include("Retrying failed publish")
|
202
202
|
end
|
203
203
|
|
204
204
|
end
|
205
205
|
|
206
|
-
context
|
207
|
-
it
|
206
|
+
context "when a block is given" do
|
207
|
+
it "yields the package to the block" do
|
208
208
|
block = ->(package) { package.do_something! }
|
209
209
|
expect(package).to receive(:do_something!).once
|
210
210
|
subject.publish(&block)
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
214
|
-
context
|
214
|
+
context "when the :build_record option is false" do
|
215
215
|
subject { described_class.new(path, repository: repository, build_record: false) }
|
216
216
|
|
217
|
-
it
|
217
|
+
it "does not create a build record at the end of publishing" do
|
218
218
|
expect(build).to_not receive(:save)
|
219
219
|
subject.publish
|
220
220
|
end
|
221
221
|
end
|
222
222
|
|
223
|
-
context
|
223
|
+
context "additional properties are provided" do
|
224
224
|
let(:delivery_props) do
|
225
225
|
{
|
226
|
-
|
227
|
-
|
226
|
+
"delivery.change" => "4dbf38de-3e82-439f-8090-c5f3e11aeba6",
|
227
|
+
"delivery.sha" => "ec1cb62616350176fc6fd9b1dc4ad3153caa0791",
|
228
228
|
}
|
229
229
|
end
|
230
230
|
let(:options) do
|
@@ -234,11 +234,11 @@ module Omnibus
|
|
234
234
|
}
|
235
235
|
end
|
236
236
|
|
237
|
-
it
|
237
|
+
it "uploads the package with the provided properties" do
|
238
238
|
expect(artifact).to receive(:upload).with(
|
239
239
|
repository,
|
240
|
-
|
241
|
-
hash_including(package_properties.merge(delivery_props))
|
240
|
+
"com/getchef/chef/11.0.6/ubuntu/14.04/chef.deb",
|
241
|
+
hash_including(package_properties.merge(delivery_props))
|
242
242
|
).once
|
243
243
|
|
244
244
|
subject.publish
|
@@ -247,11 +247,11 @@ module Omnibus
|
|
247
247
|
end
|
248
248
|
|
249
249
|
describe '#metadata_properties_for' do
|
250
|
-
it
|
250
|
+
it "returns the transformed package metadata values" do
|
251
251
|
expect(subject.send(:metadata_properties_for, package)).to include(package_properties.merge(build_values))
|
252
252
|
end
|
253
253
|
|
254
|
-
context
|
254
|
+
context ":build_record is false" do
|
255
255
|
let(:options) do
|
256
256
|
{
|
257
257
|
build_record: false,
|
@@ -259,7 +259,7 @@ module Omnibus
|
|
259
259
|
}
|
260
260
|
end
|
261
261
|
|
262
|
-
it
|
262
|
+
it "does not include `build.*` values" do
|
263
263
|
expect(subject.send(:metadata_properties_for, package)).to include(package_properties)
|
264
264
|
expect(subject.send(:metadata_properties_for, package)).to_not include(build_values)
|
265
265
|
end
|