omnibus 9.0.22 → 9.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/omnibus/build_version.rb +12 -1
- data/lib/omnibus/build_version_dsl.rb +5 -2
- data/lib/omnibus/packagers/appx.rb +5 -0
- data/lib/omnibus/packagers/windows_base.rb +34 -28
- data/lib/omnibus/version.rb +1 -1
- data/spec/unit/build_version_dsl_spec.rb +4 -4
- data/spec/unit/build_version_spec.rb +8 -8
- data/spec/unit/packagers/appx_spec.rb +6 -27
- data/spec/unit/packagers/msi_spec.rb +7 -28
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60f5a801d094e92cffa5e8bebd7dc8d1fd1a7b427c6d476b7b33b629415641d4
|
4
|
+
data.tar.gz: c0d7fa53dbf57e5c84c356855547e69c9cf315fe53156aeddefd60c94bf88f5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5525e63803dbad441fec851faf2cbd00f4463bbde7e39477517f0f9801c9f821023d787103b6eea0e0339ad39b4b89dcc6a975401587b3fbb9cab2d7e6812f50
|
7
|
+
data.tar.gz: 44c9a32996dc5ecbe4a7a666148236f2eeaace9e4c37f86e8ddcc9549c8265b4251956a55131f10c3ec9b6c15b9ff959075b8048da9397af8a13ffd00c945b5c
|
@@ -87,13 +87,18 @@ module Omnibus
|
|
87
87
|
# and can be influenced by users.
|
88
88
|
def semver
|
89
89
|
build_tag = version_tag
|
90
|
+
log.debug(log_key) { "#{self.class}##{__method__} - build tag: #{build_tag}" }
|
90
91
|
|
91
92
|
# PRERELEASE VERSION
|
93
|
+
log.debug(log_key) { "#{self.class}##{__method__} - prerelease_version?: #{prerelease_version?}" }
|
94
|
+
|
92
95
|
if prerelease_version?
|
93
96
|
# ensure all dashes are dots per precedence rules (#12) in Semver
|
94
97
|
# 2.0.0-rc.1
|
98
|
+
log.debug(log_key) { "#{self.class}##{__method__} - prerelease_tag: #{prerelease_tag}" }
|
95
99
|
prerelease = prerelease_tag.tr("-", ".")
|
96
100
|
build_tag << "-" << prerelease
|
101
|
+
log.debug(log_key) { "#{self.class}##{__method__} - build_tag after prerelease: #{build_tag}" }
|
97
102
|
end
|
98
103
|
|
99
104
|
# BUILD VERSION
|
@@ -106,6 +111,7 @@ module Omnibus
|
|
106
111
|
#
|
107
112
|
# format: YYYYMMDDHHMMSS example: 20130131123345
|
108
113
|
if Config.append_timestamp
|
114
|
+
log.debug(log_key) { "#{self.class}##{__method__} - build_start_time: #{build_start_time}" }
|
109
115
|
build_version_items << build_start_time
|
110
116
|
end
|
111
117
|
|
@@ -114,13 +120,18 @@ module Omnibus
|
|
114
120
|
#
|
115
121
|
# format: git.COMMITS_SINCE_TAG.GIT_SHA example: git.207.694b062
|
116
122
|
unless commits_since_tag == 0
|
123
|
+
log.debug(log_key) { "#{self.class}##{__method__} - commits_since_tag: #{commits_since_tag}" }
|
124
|
+
log.debug(log_key) { "#{self.class}##{__method__} - git_sha_tag: #{git_sha_tag}" }
|
117
125
|
build_version_items << ["git", commits_since_tag, git_sha_tag].join(".")
|
118
126
|
end
|
119
127
|
|
120
128
|
unless build_version_items.empty?
|
121
|
-
|
129
|
+
log.debug(log_key) { "#{self.class}##{__method__} - build_version_items: #{build_version_items}" }
|
130
|
+
build_tag << "-" << build_version_items.join(".")
|
122
131
|
end
|
123
132
|
|
133
|
+
log.debug(log_key) { "#{self.class}##{__method__} - final build_tag returned: #{build_tag}" }
|
134
|
+
|
124
135
|
build_tag
|
125
136
|
end
|
126
137
|
|
@@ -117,8 +117,11 @@ module Omnibus
|
|
117
117
|
# @param [String] version
|
118
118
|
# @return [String]
|
119
119
|
def maybe_append_timestamp(version)
|
120
|
+
log.debug(log_key) { "#{self.class}##{__method__} - Config.append_timestamp: #{Config.append_timestamp}" }
|
121
|
+
log.debug(log_key) { "#{self.class}##{__method__} - version: #{version}" }
|
122
|
+
log.debug(log_key) { "#{self.class}##{__method__} - has_timestamp?(version): #{has_timestamp?(version)}" }
|
120
123
|
if Config.append_timestamp && !has_timestamp?(version)
|
121
|
-
[version, Omnibus::BuildVersion.build_start_time].join("
|
124
|
+
[version, Omnibus::BuildVersion.build_start_time].join("-")
|
122
125
|
else
|
123
126
|
version
|
124
127
|
end
|
@@ -132,7 +135,7 @@ module Omnibus
|
|
132
135
|
# @param [String] version
|
133
136
|
# @return [Boolean]
|
134
137
|
def has_timestamp?(version)
|
135
|
-
_ver, build_info = version.split("
|
138
|
+
_ver, build_info = version.split("-")
|
136
139
|
return false if build_info.nil?
|
137
140
|
|
138
141
|
build_info.split(".").any? do |part|
|
@@ -52,6 +52,11 @@ module Omnibus
|
|
52
52
|
|
53
53
|
# @see Base#package_name
|
54
54
|
def package_name
|
55
|
+
log.debug(log_key) { "#{self.class}##{__method__} - package_name: #{project.package_name}" }
|
56
|
+
log.debug(log_key) { "#{self.class}##{__method__} - build_version: #{project.build_version}" }
|
57
|
+
log.debug(log_key) { "#{self.class}##{__method__} - build_iteration: #{project.build_iteration}" }
|
58
|
+
log.debug(log_key) { "#{self.class}##{__method__} - Config.windows_arch: #{Config.windows_arch}" }
|
59
|
+
|
55
60
|
"#{project.package_name}-#{project.build_version}-#{project.build_iteration}-#{Config.windows_arch}.appx"
|
56
61
|
end
|
57
62
|
|
@@ -16,9 +16,6 @@
|
|
16
16
|
|
17
17
|
module Omnibus
|
18
18
|
class Packager::WindowsBase < Packager::Base
|
19
|
-
DEFAULT_TIMESTAMP_SERVERS = ["http://timestamp.digicert.com",
|
20
|
-
"http://timestamp.verisign.com/scripts/timestamp.dll"].freeze
|
21
|
-
|
22
19
|
#
|
23
20
|
# Set the signing certificate name
|
24
21
|
#
|
@@ -59,9 +56,18 @@ module Omnibus
|
|
59
56
|
raise InvalidValue.new(:params, "be a Hash")
|
60
57
|
end
|
61
58
|
|
62
|
-
valid_keys = %i{store
|
59
|
+
valid_keys = %i{store machine_store algorithm keypair_alias}
|
63
60
|
invalid_keys = params.keys - valid_keys
|
64
61
|
unless invalid_keys.empty?
|
62
|
+
|
63
|
+
# log a deprecated warning if timestamp_server is used
|
64
|
+
if invalid_keys.include?(:timestamp_servers)
|
65
|
+
log.deprecated(log_key) do
|
66
|
+
"The signing_identity is updated to use smctl.exe. which does not require timestamp_servers" \
|
67
|
+
"Please remove timestamp_servers from your signing_identity"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
65
71
|
raise InvalidValue.new(:params, "contain keys from [#{valid_keys.join(", ")}]. "\
|
66
72
|
"Found invalid keys [#{invalid_keys.join(", ")}]")
|
67
73
|
end
|
@@ -77,9 +83,8 @@ module Omnibus
|
|
77
83
|
|
78
84
|
@signing_identity[:store] = params[:store] || "My"
|
79
85
|
@signing_identity[:algorithm] = params[:algorithm] || "SHA256"
|
80
|
-
servers = params[:timestamp_servers] || DEFAULT_TIMESTAMP_SERVERS
|
81
|
-
@signing_identity[:timestamp_servers] = [servers].flatten
|
82
86
|
@signing_identity[:machine_store] = params[:machine_store] || false
|
87
|
+
@signing_identity[:keypair_alias] = params[:keypair_alias]
|
83
88
|
end
|
84
89
|
|
85
90
|
@signing_identity
|
@@ -102,41 +107,41 @@ module Omnibus
|
|
102
107
|
signing_identity[:timestamp_servers]
|
103
108
|
end
|
104
109
|
|
110
|
+
def keypair_alias
|
111
|
+
signing_identity[:keypair_alias]
|
112
|
+
end
|
113
|
+
|
105
114
|
def machine_store?
|
106
115
|
signing_identity[:machine_store]
|
107
116
|
end
|
108
117
|
|
109
|
-
#
|
110
|
-
# Iterates through available timestamp servers and tries to sign
|
111
|
-
# the file with with each server, stopping after the first to succeed.
|
112
|
-
# If none succeed, an exception is raised.
|
113
|
-
#
|
118
|
+
# signs the package with the given certificate
|
114
119
|
def sign_package(package_file)
|
115
|
-
|
116
|
-
timestamp_servers.each do |ts|
|
117
|
-
success = try_sign(package_file, ts)
|
118
|
-
break if success
|
119
|
-
end
|
120
|
-
raise FailedToSignWindowsPackage.new unless success
|
120
|
+
raise FailedToSignWindowsPackage.new unless is_signed?(package_file)
|
121
121
|
end
|
122
122
|
|
123
|
-
def
|
123
|
+
def is_signed?(package_file)
|
124
124
|
cmd = [].tap do |arr|
|
125
|
-
arr << "
|
126
|
-
arr << "sign
|
127
|
-
arr << "
|
128
|
-
arr << "
|
129
|
-
arr << "/sm" if machine_store?
|
130
|
-
arr << "/s #{cert_store_name}"
|
131
|
-
arr << "/sha1 #{thumbprint}"
|
132
|
-
arr << "/d #{project.package_name}"
|
133
|
-
arr << "\"#{package_file}\""
|
125
|
+
arr << "smctl.exe"
|
126
|
+
arr << "sign"
|
127
|
+
arr << "--fingerprint #{thumbprint}"
|
128
|
+
arr << "--input #{package_file}"
|
134
129
|
end.join(" ")
|
130
|
+
|
135
131
|
status = shellout(cmd)
|
132
|
+
|
133
|
+
log.debug(log_key) { "#{self.class}##{__method__} - package_file: #{package_file}" }
|
134
|
+
log.debug(log_key) { "#{self.class}##{__method__} - cmd: #{cmd}" }
|
135
|
+
log.debug(log_key) { "#{self.class}##{__method__} - status: #{status}" }
|
136
|
+
log.debug(log_key) { "#{self.class}##{__method__} - status.exitstatus: #{status.exitstatus}" }
|
137
|
+
log.debug(log_key) { "#{self.class}##{__method__} - status.stdout: #{status.stdout}" }
|
138
|
+
log.debug(log_key) { "#{self.class}##{__method__} - status.stderr: #{status.stderr}" }
|
139
|
+
|
140
|
+
# log the error if the signing failed
|
136
141
|
if status.exitstatus != 0
|
137
142
|
log.warn(log_key) do
|
138
143
|
<<-EOH.strip
|
139
|
-
Failed to
|
144
|
+
Failed to verify signature of #{package_file}
|
140
145
|
|
141
146
|
STDOUT
|
142
147
|
------
|
@@ -148,6 +153,7 @@ module Omnibus
|
|
148
153
|
EOH
|
149
154
|
end
|
150
155
|
end
|
156
|
+
|
151
157
|
status.exitstatus == 0
|
152
158
|
end
|
153
159
|
|
data/lib/omnibus/version.rb
CHANGED
@@ -34,19 +34,19 @@ module Omnibus
|
|
34
34
|
before { Config.append_timestamp(true) }
|
35
35
|
|
36
36
|
it "appends a timestamp to a static (String) version" do
|
37
|
-
expect(subject_with_version.build_version).to eq("1.0.0
|
37
|
+
expect(subject_with_version.build_version).to eq("1.0.0-#{today_string}")
|
38
38
|
end
|
39
39
|
|
40
40
|
it "doesn't append timestamp to something that already looks like it has a timestamp" do
|
41
|
-
semver = "1.0.0
|
42
|
-
expect(described_class.new(semver).build_version).to eq("1.0.0
|
41
|
+
semver = "1.0.0-#{today_string}.git.222.694b062"
|
42
|
+
expect(described_class.new(semver).build_version).to eq("1.0.0-#{today_string}.git.222.694b062")
|
43
43
|
end
|
44
44
|
|
45
45
|
it "appends a timestamp to a DSL-built version" do
|
46
46
|
allow(BuildVersion).to receive(:new).and_return(BuildVersion.new)
|
47
47
|
allow(BuildVersion).to receive(:new).with("/etc/zoo").and_return(zoo_version)
|
48
48
|
subject_with_description.resolve(zoo_software)
|
49
|
-
expect(subject_with_description.build_version).to eq("5.5.5
|
49
|
+
expect(subject_with_description.build_version).to eq("5.5.5-#{today_string}")
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -109,12 +109,12 @@ module Omnibus
|
|
109
109
|
end
|
110
110
|
|
111
111
|
it "generates a version matching format 'MAJOR.MINOR.PATCH-PRERELEASE+TIMESTAMP.git.COMMITS_SINCE.GIT_SHA'" do
|
112
|
-
expect(build_version.semver).to match(/11.0.0-alpha1
|
112
|
+
expect(build_version.semver).to match(/11.0.0-alpha1\-#{today_string}[0-9]+.git.207.694b062/)
|
113
113
|
end
|
114
114
|
|
115
115
|
it "uses ENV['BUILD_TIMESTAMP'] to generate timestamp if set" do
|
116
116
|
stub_env("BUILD_TIMESTAMP", "2012-12-25_16-41-40")
|
117
|
-
expect(build_version.semver).to eq("11.0.0-alpha1
|
117
|
+
expect(build_version.semver).to eq("11.0.0-alpha1-20121225164140.git.207.694b062")
|
118
118
|
end
|
119
119
|
|
120
120
|
it "fails on invalid ENV['BUILD_TIMESTAMP'] values" do
|
@@ -124,7 +124,7 @@ module Omnibus
|
|
124
124
|
|
125
125
|
it "uses ENV['BUILD_ID'] to generate timestamp if set and BUILD_TIMESTAMP is not set" do
|
126
126
|
stub_env("BUILD_ID", "2012-12-25_16-41-40")
|
127
|
-
expect(build_version.semver).to eq("11.0.0-alpha1
|
127
|
+
expect(build_version.semver).to eq("11.0.0-alpha1-20121225164140.git.207.694b062")
|
128
128
|
end
|
129
129
|
|
130
130
|
it "fails on invalid ENV['BUILD_ID'] values" do
|
@@ -136,7 +136,7 @@ module Omnibus
|
|
136
136
|
let(:git_describe) { "11.0.0-alpha-3-207-g694b062" }
|
137
137
|
|
138
138
|
it "converts all dashes to dots" do
|
139
|
-
expect(build_version.semver).to match(/11.0.0-alpha.3
|
139
|
+
expect(build_version.semver).to match(/11.0.0-alpha.3\-#{today_string}[0-9]+.git.207.694b062/)
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
@@ -144,7 +144,7 @@ module Omnibus
|
|
144
144
|
let(:git_describe) { "11.0.0-alpha2" }
|
145
145
|
|
146
146
|
it "appends a timestamp with no git info" do
|
147
|
-
expect(build_version.semver).to match(/11.0.0-alpha2
|
147
|
+
expect(build_version.semver).to match(/11.0.0-alpha2\-#{today_string}[0-9]+/)
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
@@ -152,20 +152,20 @@ module Omnibus
|
|
152
152
|
let(:git_describe) { "11.0.0-alpha-3-207-g694b062" }
|
153
153
|
context "by default" do
|
154
154
|
it "appends a timestamp" do
|
155
|
-
expect(build_version.semver).to match(/11.0.0-alpha.3
|
155
|
+
expect(build_version.semver).to match(/11.0.0-alpha.3\-#{today_string}[0-9]+.git.207.694b062/)
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
159
|
context "when Config.append_timestamp is true" do
|
160
160
|
it "appends a timestamp" do
|
161
|
-
expect(build_version.semver).to match(/11.0.0-alpha.3
|
161
|
+
expect(build_version.semver).to match(/11.0.0-alpha.3\-#{today_string}[0-9]+.git.207.694b062/)
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
165
165
|
context "when Config.append_timestamp is false" do
|
166
166
|
before { Config.append_timestamp(false) }
|
167
167
|
it "does not append a timestamp" do
|
168
|
-
expect(build_version.semver).to match(/11.0.0-alpha.3
|
168
|
+
expect(build_version.semver).to match(/11.0.0-alpha.3\-git.207.694b062/)
|
169
169
|
end
|
170
170
|
end
|
171
171
|
end
|
@@ -129,39 +129,18 @@ module Omnibus
|
|
129
129
|
allow(subject).to receive(:shellout!)
|
130
130
|
end
|
131
131
|
|
132
|
-
describe "#
|
133
|
-
it "defaults to
|
132
|
+
describe "#keypair_alias" do
|
133
|
+
it "defaults to 'Chef Software, Inc.'" do
|
134
134
|
subject.signing_identity("foo")
|
135
|
-
expect(subject).to receive(:
|
136
|
-
expect(subject).to receive(:try_sign).with(appx, "http://timestamp.verisign.com/scripts/timestamp.dll").and_return(true)
|
135
|
+
expect(subject).to receive(:is_signed?).with(appx).and_return(true)
|
137
136
|
subject.sign_package(appx)
|
138
137
|
end
|
139
138
|
|
140
|
-
it "uses the
|
141
|
-
subject.signing_identity("foo",
|
142
|
-
expect(subject).to receive(:
|
139
|
+
it "uses the keypair alias if provided through the #keypair_alias dsl" do
|
140
|
+
subject.signing_identity("foo", keypair_alias: "bar")
|
141
|
+
expect(subject).to receive(:is_signed?).with(appx).and_return(true)
|
143
142
|
subject.sign_package(appx)
|
144
143
|
end
|
145
|
-
|
146
|
-
it "tries all timestamp server if provided through the #timestamp_server dsl" do
|
147
|
-
subject.signing_identity("foo", timestamp_servers: ["http://fooserver", "http://barserver"])
|
148
|
-
expect(subject).to receive(:try_sign).with(appx, "http://fooserver").and_return(false)
|
149
|
-
expect(subject).to receive(:try_sign).with(appx, "http://barserver").and_return(true)
|
150
|
-
subject.sign_package(appx)
|
151
|
-
end
|
152
|
-
|
153
|
-
it "tries all timestamp server if provided through the #timestamp_servers dsl and stops at the first available" do
|
154
|
-
subject.signing_identity("foo", timestamp_servers: ["http://fooserver", "http://barserver"])
|
155
|
-
expect(subject).to receive(:try_sign).with(appx, "http://fooserver").and_return(true)
|
156
|
-
expect(subject).not_to receive(:try_sign).with(appx, "http://barserver")
|
157
|
-
subject.sign_package(appx)
|
158
|
-
end
|
159
|
-
|
160
|
-
it "raises an exception if there are no available timestamp servers" do
|
161
|
-
subject.signing_identity("foo", timestamp_servers: "http://fooserver")
|
162
|
-
expect(subject).to receive(:try_sign).with(appx, "http://fooserver").and_return(false)
|
163
|
-
expect { subject.sign_package(appx) }.to raise_error(FailedToSignWindowsPackage)
|
164
|
-
end
|
165
144
|
end
|
166
145
|
end
|
167
146
|
end
|
@@ -554,37 +554,16 @@ module Omnibus
|
|
554
554
|
allow(subject).to receive(:shellout!)
|
555
555
|
end
|
556
556
|
|
557
|
-
describe "#
|
558
|
-
it "
|
559
|
-
subject.signing_identity("foo")
|
560
|
-
expect(subject).to receive(:
|
561
|
-
expect(subject).to receive(:try_sign).with(msi, "http://timestamp.verisign.com/scripts/timestamp.dll").and_return(true)
|
557
|
+
describe "#keypair_alias" do
|
558
|
+
it "uses the keypair alias if provided through the #keypair_alias dsl" do
|
559
|
+
subject.signing_identity("foo", keypair_alias: "bar")
|
560
|
+
expect(subject).to receive(:is_signed?).with(msi).and_return(true)
|
562
561
|
subject.sign_package(msi)
|
563
562
|
end
|
564
563
|
|
565
|
-
it "
|
566
|
-
subject.signing_identity("foo",
|
567
|
-
expect(subject).to receive(:
|
568
|
-
subject.sign_package(msi)
|
569
|
-
end
|
570
|
-
|
571
|
-
it "tries all timestamp server if provided through the #timestamp_server dsl" do
|
572
|
-
subject.signing_identity("foo", timestamp_servers: ["http://fooserver", "http://barserver"])
|
573
|
-
expect(subject).to receive(:try_sign).with(msi, "http://fooserver").and_return(false)
|
574
|
-
expect(subject).to receive(:try_sign).with(msi, "http://barserver").and_return(true)
|
575
|
-
subject.sign_package(msi)
|
576
|
-
end
|
577
|
-
|
578
|
-
it "tries all timestamp server if provided through the #timestamp_servers dsl and stops at the first available" do
|
579
|
-
subject.signing_identity("foo", timestamp_servers: ["http://fooserver", "http://barserver"])
|
580
|
-
expect(subject).to receive(:try_sign).with(msi, "http://fooserver").and_return(true)
|
581
|
-
expect(subject).not_to receive(:try_sign).with(msi, "http://barserver")
|
582
|
-
subject.sign_package(msi)
|
583
|
-
end
|
584
|
-
|
585
|
-
it "raises an exception if there are no available timestamp servers" do
|
586
|
-
subject.signing_identity("foo", timestamp_servers: "http://fooserver")
|
587
|
-
expect(subject).to receive(:try_sign).with(msi, "http://fooserver").and_return(false)
|
564
|
+
it "raises an exception if the signing fails" do
|
565
|
+
subject.signing_identity("foo", keypair_alias: "bar")
|
566
|
+
expect(subject).to receive(:is_signed?).with(msi).and_return(false)
|
588
567
|
expect { subject.sign_package(msi) }.to raise_error(FailedToSignWindowsPackage)
|
589
568
|
end
|
590
569
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omnibus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.0.
|
4
|
+
version: 9.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|