packaging 0.99.47 → 0.99.48
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/packaging/artifactory.rb +31 -31
- data/lib/packaging/paths.rb +4 -3
- data/tasks/ship.rake +5 -7
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9b1ac8c003ac90a5214eed7c8ba0452b2d264b093a1e33918951821e77abc1c
|
4
|
+
data.tar.gz: dffd6a141ca0c206e56a3a5f9d92f3d5fd43db33df13955485afb5598d020575
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad5e4b3b0f541647b482692c8bca84ab17772a9875c569793f9dd2ec0aeeac6912ec7cc93ac49d417defc3a8c4e863d0975e91aa9b968d33cfdacadcdeada80c
|
7
|
+
data.tar.gz: 7c4c851417fb6fec73fd833a6cd753f29847cc9a097d5a972fadae0482a76a5073e7073405307af2099db23ffb6458b6b7fd758015cb36c924f4aedc39371cfc
|
@@ -432,28 +432,14 @@ module Pkg
|
|
432
432
|
def ship_pe_tarballs(local_tarball_directory, target_repo, ship_paths)
|
433
433
|
check_authorization
|
434
434
|
ship_paths.each do |path|
|
435
|
-
unset_cleanup_skip_on_artifacts(target_repo, path)
|
436
435
|
Dir.foreach(local_tarball_directory) do |pe_tarball|
|
437
436
|
next if pe_tarball == '.' || pe_tarball == ".."
|
438
437
|
begin
|
439
438
|
puts "Uploading #{pe_tarball} to #{target_repo}/#{path}#{pe_tarball}"
|
440
439
|
artifact = Artifactory::Resource::Artifact.new(
|
441
440
|
local_path: "#{local_tarball_directory}/#{pe_tarball}")
|
442
|
-
|
443
|
-
# The Artifactory gem property setter only works when '/api/storage' is used in
|
444
|
-
# the 'uri' field.
|
445
|
-
# Strangely, the above Artifactory::Resource::Artifact.new gives us the raw URI.
|
446
|
-
# Therefore we are forced to do some path surgery, inserting
|
447
|
-
# '/api/storage' before "/#{target_repo}" to make the property setting work.
|
448
|
-
storage_artifact = uploaded_artifact
|
449
|
-
unless storage_artifact.uri.include?("/api/storage")
|
450
|
-
storage_artifact.uri = storage_artifact.uri.sub(
|
451
|
-
"/#{target_repo}",
|
452
|
-
"/api/storage/#{target_repo}")
|
453
|
-
end
|
454
|
-
storage_artifact.properties(ARTIFACTORY_CLEANUP_SKIP_PROPERTY => true)
|
441
|
+
artifact.upload(target_repo, "#{path}#{pe_tarball}")
|
455
442
|
rescue Errno::EPIPE
|
456
|
-
## [eric.griswold] maybe this should be fatal?
|
457
443
|
STDERR.puts "Warning: Could not upload #{pe_tarball} to #{target_repo}/#{path}. Skipping."
|
458
444
|
next
|
459
445
|
end
|
@@ -478,29 +464,43 @@ module Pkg
|
|
478
464
|
end
|
479
465
|
end
|
480
466
|
|
481
|
-
#
|
482
|
-
#
|
483
|
-
#
|
484
|
-
#
|
467
|
+
# Start by clearing the ARTIFACTORY_CLEANUP_SKIP_PROPERTY on all artifacts in a
|
468
|
+
# single repo/directory location. This allows all artifacts in the directory to be cleaned.
|
469
|
+
# Once cleared, set ARTIFACTORY_CLEANUP_SKIP_PROPERTY on those matching pe_build_version,
|
470
|
+
# presumably the latest. This prevents those artifacts from being deleted.
|
485
471
|
#
|
486
472
|
# @param repo [String] Artifactory repository that contains the specified directory
|
487
473
|
# @param directory [String] Artifactory directory in repo containing the artifacts from which to
|
488
474
|
# set the 'cleanup.skip' property setting to false
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
475
|
+
# @param pe_build_version [String] Set 'cleanup.skip' property on artifacts that
|
476
|
+
# contain this string in their file inside the directory.
|
477
|
+
def prevent_artifact_cleanup(repo, directory, pe_build_version)
|
478
|
+
# Clean up any trailing slashes on directory, just in case
|
479
|
+
directory.sub!(/(\/)+$/, '')
|
480
|
+
|
481
|
+
all_artifacts_pattern = "#{directory}/*"
|
482
|
+
latest_artifacts_pattern = "#{directory}/*#{pe_build_version}*"
|
483
|
+
|
484
|
+
all_artifacts = Artifactory::Resource::Artifact.pattern_search(
|
485
|
+
repo: repo,
|
486
|
+
pattern: all_artifacts_pattern
|
487
|
+
)
|
488
|
+
latest_artifacts = Artifactory::Resource::Artifact.pattern_search(
|
489
|
+
repo: repo,
|
490
|
+
pattern: latest_artifacts_pattern
|
493
491
|
)
|
494
492
|
|
495
|
-
#
|
496
|
-
|
497
|
-
|
498
|
-
# For all tarball artifacts in #{directory} that have the Artifactory property
|
499
|
-
# 'cleanup.skip' set to true, set it to 'false'
|
500
|
-
artifacts_with_cleanup_skip.each do |artifact|
|
501
|
-
next unless artifact.uri.include?("/#{directory_no_trailing_slashes}/")
|
493
|
+
# Clear cleanup.skip on all artifacts in directory
|
494
|
+
puts "Clearing #{ARTIFACTORY_CLEANUP_SKIP_PROPERTY} in #{repo}/#{all_artifacts_pattern}"
|
495
|
+
all_artifacts.each do |artifact|
|
502
496
|
artifact.properties(ARTIFACTORY_CLEANUP_SKIP_PROPERTY => false)
|
503
497
|
end
|
498
|
+
|
499
|
+
# Set cleanup.skip on all artifacts in directory matching *pe_build_version*
|
500
|
+
puts "Setting #{ARTIFACTORY_CLEANUP_SKIP_PROPERTY} in #{repo}/#{latest_artifacts_pattern}"
|
501
|
+
latest_artifacts.each do |artifact|
|
502
|
+
artifact.properties(ARTIFACTORY_CLEANUP_SKIP_PROPERTY => true)
|
503
|
+
end
|
504
504
|
end
|
505
505
|
|
506
506
|
# Download an artifact based on name, repo, and path to artifact
|
@@ -584,7 +584,7 @@ module Pkg
|
|
584
584
|
copied_artifact_search = Artifactory::Resource::Artifact.pattern_search(repo: 'debian_enterprise__local', pattern: "#{target_path}/*/#{info["filename"]}")
|
585
585
|
fail "Error: what the hell, could not find just-copied package #{info["filename"]} under debian_enterprise__local/#{target_path}" if copied_artifact_search.nil?
|
586
586
|
copied_artifact = copied_artifact_search.first
|
587
|
-
properties = { 'deb.component' => Pkg::Paths.
|
587
|
+
properties = { 'deb.component' => Pkg::Paths.debian_component_from_path(target_path) }
|
588
588
|
copied_artifact.properties(properties)
|
589
589
|
end
|
590
590
|
end
|
data/lib/packaging/paths.rb
CHANGED
@@ -303,9 +303,10 @@ module Pkg::Paths
|
|
303
303
|
end
|
304
304
|
end
|
305
305
|
|
306
|
-
def
|
307
|
-
matches = path.match(
|
308
|
-
fail "Error: Could not determine
|
306
|
+
def debian_component_from_path(path)
|
307
|
+
matches = path.match(/(\d+\.\d+)\/(\w+)/)
|
308
|
+
fail "Error: Could not determine Debian Component from path #{path}" if matches.nil?
|
309
|
+
return matches[1] if matches[2] == 'repos'
|
309
310
|
return matches[0]
|
310
311
|
end
|
311
312
|
end
|
data/tasks/ship.rake
CHANGED
@@ -322,14 +322,12 @@ namespace :pl do
|
|
322
322
|
|
323
323
|
desc "Ship built gems to public Downloads server (#{Pkg::Config.gem_host})"
|
324
324
|
task :ship_gem_to_downloads => 'pl:fetch' do
|
325
|
-
|
325
|
+
if Pkg::Config.gem_host && Pkg::Config.gem_path
|
326
|
+
Pkg::Util::Execution.retry_on_fail(times: 3) do
|
327
|
+
Pkg::Util::Ship.ship_gem('pkg', Pkg::Config.gem_path, platform_independent: true)
|
328
|
+
end
|
329
|
+
else
|
326
330
|
warn 'Value `Pkg::Config.gem_host` not defined; skipping shipping to public Download server'
|
327
|
-
exit
|
328
|
-
end
|
329
|
-
fail 'Value `Pkg::Config.gem_path` not defined; skipping shipping to public Download server' unless Pkg::Config.gem_path
|
330
|
-
|
331
|
-
Pkg::Util::Execution.retry_on_fail(times: 3) do
|
332
|
-
Pkg::Util::Ship.ship_gem('pkg', Pkg::Config.gem_path, platform_independent: true)
|
333
331
|
end
|
334
332
|
end
|
335
333
|
|
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.99.
|
4
|
+
version: 0.99.48
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -244,28 +244,28 @@ signing_key:
|
|
244
244
|
specification_version: 4
|
245
245
|
summary: Puppet Labs' packaging automation
|
246
246
|
test_files:
|
247
|
+
- spec/lib/packaging_spec.rb
|
247
248
|
- spec/lib/packaging/retrieve_spec.rb
|
248
|
-
- spec/lib/packaging/paths_spec.rb
|
249
249
|
- spec/lib/packaging/tar_spec.rb
|
250
|
+
- spec/lib/packaging/gem_spec.rb
|
250
251
|
- spec/lib/packaging/deb/repo_spec.rb
|
251
|
-
- spec/lib/packaging/rpm/repo_spec.rb
|
252
|
-
- spec/lib/packaging/artifactory_spec.rb
|
253
|
-
- spec/lib/packaging/repo_spec.rb
|
254
252
|
- spec/lib/packaging/deb_spec.rb
|
253
|
+
- spec/lib/packaging/rpm/repo_spec.rb
|
255
254
|
- spec/lib/packaging/sign_spec.rb
|
256
|
-
- spec/lib/packaging/
|
257
|
-
- spec/lib/packaging/
|
258
|
-
- spec/lib/packaging/util/git_spec.rb
|
255
|
+
- spec/lib/packaging/config_spec.rb
|
256
|
+
- spec/lib/packaging/platforms_spec.rb
|
259
257
|
- spec/lib/packaging/util/os_spec.rb
|
258
|
+
- spec/lib/packaging/util/gpg_spec.rb
|
259
|
+
- spec/lib/packaging/util/net_spec.rb
|
260
260
|
- spec/lib/packaging/util/misc_spec.rb
|
261
|
-
- spec/lib/packaging/util/
|
261
|
+
- spec/lib/packaging/util/git_tag_spec.rb
|
262
|
+
- spec/lib/packaging/util/jenkins_spec.rb
|
262
263
|
- spec/lib/packaging/util/file_spec.rb
|
264
|
+
- spec/lib/packaging/util/git_spec.rb
|
265
|
+
- spec/lib/packaging/util/version_spec.rb
|
263
266
|
- spec/lib/packaging/util/execution_spec.rb
|
264
|
-
- spec/lib/packaging/util/
|
265
|
-
- spec/lib/packaging/util/jenkins_spec.rb
|
267
|
+
- spec/lib/packaging/util/rake_utils_spec.rb
|
266
268
|
- spec/lib/packaging/util/ship_spec.rb
|
267
|
-
- spec/lib/packaging/
|
268
|
-
- spec/lib/packaging/
|
269
|
-
- spec/lib/packaging/
|
270
|
-
- spec/lib/packaging/config_spec.rb
|
271
|
-
- spec/lib/packaging_spec.rb
|
269
|
+
- spec/lib/packaging/repo_spec.rb
|
270
|
+
- spec/lib/packaging/artifactory_spec.rb
|
271
|
+
- spec/lib/packaging/paths_spec.rb
|