packaging 0.122.2 → 0.122.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e48d6f7a03835d7aeb3ccf1b61d205d1ec9e883fdce5acda3a72f220048162f1
4
- data.tar.gz: 893408cf9b6c255c399495ce527fb154cfc2f01a3816d5e5da16dcc38394210c
3
+ metadata.gz: 4b511825262b71e1da19c228431f2b67346497ad2313d90d36ba700bb2e0b362
4
+ data.tar.gz: c315cb8afda9da529a8ef60df8433bbd0fc5d71a96d7572354432d235b3fa7bc
5
5
  SHA512:
6
- metadata.gz: 109885a133265aa119ea8d59e60a2210585e2c2bedb4a34427603e5e10856fa14d7f9201f042e6c810848c3c49be6a43c4774c8bcfee38e08b7732618dc99663
7
- data.tar.gz: 8482abff1b4813dccf831fdc2c2bcdc16643857f0286a2122030c7f63173fa77310395aa42933bdce8fa29ce3a4703e686c7ec612236947987951253977b7fb6
6
+ metadata.gz: 65a6f3befb3a28b20ce75b23217eaa598dcb610a82953f3e4c3917d7587a0f7aea85196db40a9694adc3acae62e7df8d3027c1bbba11d0cd29c66d66f259f779
7
+ data.tar.gz: 3deff11d62a38dc6fac322a234f5922285befbc88fbc4eb908f3d3de6800acf7b366506ea38de40e4dcc028a709ac973f056337b7787f5c737291ca52c3d569b
@@ -184,7 +184,7 @@ module Pkg::Util::Net
184
184
  target_host: nil,
185
185
  extra_flags: nil,
186
186
  dryrun: ENV['DRYRUN']
187
- }.merge(opts.merge(opts.delete_if { |_, value| value.nil? })) # rubocop:disable Style/CollectionCompact
187
+ }.merge(opts.merge(opts.delete_if { |_, value| value.nil? }))
188
188
 
189
189
  stdout, = Pkg::Util::Execution.capture3(rsync_cmd(source, options), true)
190
190
  stdout
@@ -216,15 +216,18 @@ module Pkg::Util::Net
216
216
  )
217
217
  end
218
218
 
219
- def s3sync_to(source, target_bucket, target_directory = "", flags = [])
219
+ def s3sync_to(source, target_bucket, target_directory = '', flags = [])
220
220
  s3cmd = Pkg::Util::Tool.check_tool('s3cmd')
221
+ s3cfg_path = File.join(ENV['HOME'], '.s3cfg')
221
222
 
222
- if Pkg::Util::File.file_exists?(File.join(ENV['HOME'], '.s3cfg'))
223
- stdout, = Pkg::Util::Execution.capture3("#{s3cmd} sync #{flags.join(' ')} '#{source}' s3://#{target_bucket}/#{target_directory}/")
224
- stdout
225
- else
226
- fail "#{File.join(ENV['HOME'], '.s3cfg')} does not exist. It is required to ship files using s3cmd."
223
+ unless File.exist?(s3cfg_path)
224
+ fail "#{s3cfg_path} does not exist. It is required to ship files using s3cmd."
227
225
  end
226
+
227
+ sync_command = "#{s3cmd} sync #{flags.join(' ')} '#{source}' " \
228
+ "s3://#{target_bucket}/#{target_directory}/"
229
+
230
+ Pkg::Util::Execution.capture3(sync_command, true)
228
231
  end
229
232
 
230
233
  # This is fairly absurd. We're implementing curl by shelling out. What do I
@@ -182,8 +182,8 @@ describe 'Pkg::Util::Net' do
182
182
 
183
183
  it 'should fail if ~/.s3cfg is not present' do
184
184
  expect(Pkg::Util::Tool).to receive(:check_tool).with("s3cmd").and_return(s3cmd)
185
- expect(Pkg::Util::File)
186
- .to receive(:file_exists?)
185
+ expect(File)
186
+ .to receive(:exist?)
187
187
  .with(File.join(ENV['HOME'], '.s3cfg'))
188
188
  .and_return(false)
189
189
  expect { Pkg::Util::Net.s3sync_to('foo', 'bar', 'boo') }
@@ -192,25 +192,27 @@ describe 'Pkg::Util::Net' do
192
192
 
193
193
  it "should s3 sync 'thing' to 's3://foo@bar/home/foo/' with no flags" do
194
194
  expect(Pkg::Util::Tool).to receive(:check_tool).with("s3cmd").and_return(s3cmd)
195
- expect(Pkg::Util::File)
196
- .to receive(:file_exists?)
195
+ expect(File)
196
+ .to receive(:exist?)
197
197
  .with(File.join(ENV['HOME'], '.s3cfg'))
198
198
  .and_return(true)
199
199
  expect(Pkg::Util::Execution)
200
200
  .to receive(:capture3)
201
- .with("#{s3cmd} sync 'thing' s3://foo@bar/home/foo/")
201
+ .with("#{s3cmd} sync 'thing' s3://foo@bar/home/foo/", anything)
202
202
  Pkg::Util::Net.s3sync_to("thing", "foo@bar", "home/foo")
203
203
  end
204
204
 
205
205
  it "should s3sync 'thing' to 's3://foo@bar/home/foo/' with --delete-removed and --acl-public" do
206
206
  expect(Pkg::Util::Tool).to receive(:check_tool).with("s3cmd").and_return(s3cmd)
207
- expect(Pkg::Util::File)
208
- .to receive(:file_exists?)
207
+ expect(File)
208
+ .to receive(:exist?)
209
209
  .with(File.join(ENV['HOME'], '.s3cfg'))
210
210
  .and_return(true)
211
211
  expect(Pkg::Util::Execution)
212
212
  .to receive(:capture3)
213
- .with("#{s3cmd} sync --delete-removed --acl-public 'thing' s3://foo@bar/home/foo/")
213
+ .with(
214
+ "#{s3cmd} sync --delete-removed --acl-public 'thing' s3://foo@bar/home/foo/", anything
215
+ )
214
216
  Pkg::Util::Net.s3sync_to("thing", "foo@bar", "home/foo", ["--delete-removed", "--acl-public"])
215
217
  end
216
218
  end
@@ -181,15 +181,28 @@ namespace :pl do
181
181
  end
182
182
 
183
183
  task :deploy_signed_repos_to_s3, [:target_bucket] => "pl:fetch" do |t, args|
184
- target_bucket = args.target_bucket or fail ":target_bucket is a required argument to #{t}"
184
+ fail ":target_bucket is a required argument to #{t}" unless args.target_bucket
185
+ target_bucket = args.target_bucket
185
186
 
186
- # Ship it to the target for consumption
187
- # First we ship the latest and clean up any repo-configs that are no longer valid with --delete-removed and --acl-public
188
- Pkg::Util::Net.s3sync_to("pkg/#{Pkg::Config.project}-latest/", target_bucket, "#{Pkg::Config.project}-latest", ["--acl-public", "--delete-removed", "--follow-symlinks"])
189
- # Then we ship the sha version with just --acl-public
190
- Pkg::Util::Net.s3sync_to("pkg/#{Pkg::Config.project}/", target_bucket, Pkg::Config.project, ["--acl-public", "--follow-symlinks"])
187
+ # Ship it to the target for consumption.
191
188
 
192
- puts "'#{Pkg::Config.ref}' of '#{Pkg::Config.project}' has been shipped via s3 to '#{target_bucket}'"
189
+ # First we ship the latest and clean up any repo-configs that
190
+ # are no longer valid with --delete-removed and --acl-public
191
+ source = "pkg/#{Pkg::Config.project}-latest/"
192
+ target_directory = "#{Pkg::Config.project}-latest"
193
+ puts("S3 sync from '#{Dir.pwd}/#{source}' to 's3://#{target_bucket}/#{target_directory}'")
194
+ Pkg::Util::Net.s3sync_to(source, target_bucket, target_directory,
195
+ ['--acl-public', '--delete-removed', '--follow-symlinks'])
196
+
197
+ # Then we ship the sha version with just --acl-public
198
+ source = "pkg/#{Pkg::Config.project}/"
199
+ target_directory = Pkg::Config.project
200
+ puts("S3 sync from '#{Dir.pwd}/#{source}' to 's3://#{target_bucket}/#{target_directory}'")
201
+ Pkg::Util::Net.s3sync_to(source, target_bucket, target_directory,
202
+ ['--acl-public', '--follow-symlinks'])
203
+
204
+ puts "'#{Pkg::Config.ref}' of '#{Pkg::Config.project}' has been uploaded to" \
205
+ "'s3://#{target_bucket}'"
193
206
  end
194
207
 
195
208
  task :generate_signed_repo_configs, [:target_prefix] => "pl:fetch" do |t, args|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.122.2
4
+ version: 0.122.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet By Perforce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-07 00:00:00.000000000 Z
11
+ date: 2024-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debug
@@ -327,28 +327,28 @@ signing_key:
327
327
  specification_version: 4
328
328
  summary: Puppet by Perforce packaging automation
329
329
  test_files:
330
- - spec/lib/packaging_spec.rb
331
- - spec/lib/packaging/retrieve_spec.rb
332
- - spec/lib/packaging/deb_spec.rb
333
- - spec/lib/packaging/util/os_spec.rb
330
+ - spec/lib/packaging/deb/repo_spec.rb
331
+ - spec/lib/packaging/paths_spec.rb
332
+ - spec/lib/packaging/repo_spec.rb
333
+ - spec/lib/packaging/tar_spec.rb
334
+ - spec/lib/packaging/sign_spec.rb
335
+ - spec/lib/packaging/config_spec.rb
334
336
  - spec/lib/packaging/util/ship_spec.rb
337
+ - spec/lib/packaging/util/net_spec.rb
335
338
  - spec/lib/packaging/util/git_spec.rb
339
+ - spec/lib/packaging/util/jenkins_spec.rb
336
340
  - spec/lib/packaging/util/execution_spec.rb
337
- - spec/lib/packaging/util/git_tag_spec.rb
338
341
  - spec/lib/packaging/util/gpg_spec.rb
339
- - spec/lib/packaging/util/net_spec.rb
342
+ - spec/lib/packaging/util/rake_utils_spec.rb
343
+ - spec/lib/packaging/util/os_spec.rb
340
344
  - spec/lib/packaging/util/version_spec.rb
341
345
  - spec/lib/packaging/util/file_spec.rb
342
346
  - spec/lib/packaging/util/misc_spec.rb
343
- - spec/lib/packaging/util/rake_utils_spec.rb
344
- - spec/lib/packaging/util/jenkins_spec.rb
345
- - spec/lib/packaging/repo_spec.rb
346
- - spec/lib/packaging/platforms_spec.rb
347
+ - spec/lib/packaging/util/git_tag_spec.rb
347
348
  - spec/lib/packaging/artifactory_spec.rb
348
- - spec/lib/packaging/tar_spec.rb
349
- - spec/lib/packaging/config_spec.rb
350
- - spec/lib/packaging/sign_spec.rb
351
- - spec/lib/packaging/deb/repo_spec.rb
352
- - spec/lib/packaging/paths_spec.rb
349
+ - spec/lib/packaging/platforms_spec.rb
353
350
  - spec/lib/packaging/rpm/repo_spec.rb
351
+ - spec/lib/packaging/retrieve_spec.rb
352
+ - spec/lib/packaging/deb_spec.rb
354
353
  - spec/lib/packaging/gem_spec.rb
354
+ - spec/lib/packaging_spec.rb