packaging 0.99.42 → 0.99.47
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/packaging.rb +1 -0
- data/lib/packaging/artifactory.rb +250 -29
- data/lib/packaging/config.rb +1 -1
- data/lib/packaging/metrics.rb +15 -0
- data/lib/packaging/paths.rb +11 -3
- data/lib/packaging/platforms.rb +7 -0
- data/lib/packaging/sign/msi.rb +2 -2
- data/lib/packaging/util/date.rb +5 -0
- data/spec/lib/packaging/artifactory_spec.rb +11 -0
- data/spec/lib/packaging/config_spec.rb +4 -1
- data/spec/lib/packaging/platforms_spec.rb +2 -1
- data/spec/lib/packaging/util/ship_spec.rb +10 -2
- data/tasks/jenkins.rake +6 -0
- data/tasks/ship.rake +5 -0
- metadata +32 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 462c33ee387ad86103e9ac1edead54aa1a6c017328c92a3ccba336484f89458c
|
4
|
+
data.tar.gz: '09c84bce3ea8c21637fe60ad730d2e07604796721f1f5cb366dab0a16ae8eca2'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f47f740aade3d02bea8a007f1b727271a203d47d298ff144b207cfad8ae58cba66c3d4ebc758bb695666d18208b5f18220b8e9886357a35e0f41257d7d1fdb2
|
7
|
+
data.tar.gz: 113d0f5b9227fe43cdfaf68986e0850c768268937f7969fd390370c257ea963ceffcb67d128d21673a6b9c69ec62f30b94bd4efd7a888aa113e467a2c10f5c54
|
data/lib/packaging.rb
CHANGED
@@ -1,7 +1,69 @@
|
|
1
|
+
require 'artifactory'
|
1
2
|
require 'uri'
|
2
3
|
require 'open-uri'
|
3
4
|
require 'digest'
|
4
5
|
|
6
|
+
#
|
7
|
+
# [eric.griswold] This is unfortunate. The 'pattern_search' class method really does belong in
|
8
|
+
# the Artifactory gem. However, because of some of Chef's social policies,
|
9
|
+
# I am unwilling to contribute this code there. If that changes, I'll submit a PR. Until
|
10
|
+
# then, it'll live here.
|
11
|
+
#
|
12
|
+
module Artifactory
|
13
|
+
class Resource::Artifact
|
14
|
+
#
|
15
|
+
# Search for an artifact in a repo using an Ant-like pattern.
|
16
|
+
# Unlike many Artifactory searches, this one is restricted to a single
|
17
|
+
# repository.
|
18
|
+
#
|
19
|
+
# @example Search in a repository named 'foo_local' for an artifact in a directory containing
|
20
|
+
# the word "recent", named "artifact[0-9].txt"
|
21
|
+
# Artifact.pattern_search(pattern: '*recent*/artifact[0-9].txt',
|
22
|
+
# repo: 'foo_local')
|
23
|
+
#
|
24
|
+
# @param [Hash] options
|
25
|
+
# A hash of options, as follows:
|
26
|
+
#
|
27
|
+
# @option options [Artifactory::Client] :client
|
28
|
+
# the client object to make the request with
|
29
|
+
# @option options [String] :pattern
|
30
|
+
# the Ant-like pattern to use for finding artifacts within the repos. Note that the
|
31
|
+
# Ant pattern '**' is barred in this case by JFrog.
|
32
|
+
# @option options [String] :repo
|
33
|
+
# the repo to search
|
34
|
+
#
|
35
|
+
# @return [Array<Resource::Artifact>]
|
36
|
+
# a list of artifacts that match the query
|
37
|
+
#
|
38
|
+
def self.pattern_search(options = {})
|
39
|
+
client = extract_client!(options)
|
40
|
+
params = Util.slice(options, :pattern, :repo)
|
41
|
+
pattern_search_parameter = { :pattern => "#{params[:repo]}:#{params[:pattern]}" }
|
42
|
+
response = client.get('/api/search/pattern', pattern_search_parameter)
|
43
|
+
return [] if response['files'].nil? || response['files'].empty?
|
44
|
+
|
45
|
+
# A typical response:
|
46
|
+
# {
|
47
|
+
# "repoUri"=>"https:<artifactory endpoint>/<repo>",
|
48
|
+
# "sourcePattern"=>"<repo>:<provided search pattern>",
|
49
|
+
# "files"=>[<filename that matched pattern>, ...]
|
50
|
+
# }
|
51
|
+
#
|
52
|
+
# Inserting '/api/storage' before the repo makes the 'from_url' call work correctly.
|
53
|
+
#
|
54
|
+
repo_uri = response['repoUri']
|
55
|
+
unless repo_uri.include?('/api/storage/')
|
56
|
+
# rubocop:disable Style/PercentLiteralDelimiters
|
57
|
+
repo_uri.sub!(%r(/#{params[:repo]}$), "/api/storage/#{params[:repo]}")
|
58
|
+
end
|
59
|
+
response['files'].map do |file_path|
|
60
|
+
from_url("#{repo_uri}/#{file_path}", client: client)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
|
5
67
|
module Pkg
|
6
68
|
|
7
69
|
# The Artifactory class
|
@@ -10,6 +72,11 @@ module Pkg
|
|
10
72
|
# artifacts to the repos, and to retrieve them back from the repos.
|
11
73
|
class ManageArtifactory
|
12
74
|
|
75
|
+
# The Artifactory property that the artifactCleanup user plugin
|
76
|
+
# {https://github.com/jfrog/artifactory-user-plugins/tree/master/cleanup/artifactCleanup}
|
77
|
+
# uses to tell it to not clean a particular artifact
|
78
|
+
ARTIFACTORY_CLEANUP_SKIP_PROPERTY = 'cleanup.skip'
|
79
|
+
|
13
80
|
DEFAULT_REPO_TYPE = 'generic'
|
14
81
|
DEFAULT_REPO_BASE = 'development'
|
15
82
|
|
@@ -24,8 +91,6 @@ module Pkg
|
|
24
91
|
# @option :repo_base [String] The base of all repos, set for consistency.
|
25
92
|
# This currently defaults to 'development'
|
26
93
|
def initialize(project, project_version, opts = {})
|
27
|
-
require 'artifactory'
|
28
|
-
|
29
94
|
@artifactory_uri = opts[:artifactory_uri] || 'https://artifactory.delivery.puppetlabs.net/artifactory'
|
30
95
|
@repo_base = opts[:repo_base] || DEFAULT_REPO_BASE
|
31
96
|
|
@@ -297,17 +362,20 @@ module Pkg
|
|
297
362
|
# get the artifact name
|
298
363
|
artifact_names = all_package_names(yaml_data[:platform_data], platform_tag)
|
299
364
|
artifact_names.each do |artifact_name|
|
300
|
-
|
365
|
+
artifact_search_results = Artifactory::Resource::Artifact.search(
|
366
|
+
name: artifact_name, :artifactory_uri => @artifactory_uri)
|
301
367
|
|
302
|
-
if
|
368
|
+
if artifact_search_results.empty?
|
303
369
|
raise "Error: could not find PKG=#{pkg} at REF=#{git_ref} for #{platform_tag}"
|
304
370
|
end
|
371
|
+
artifact_to_promote = artifact_search_results[0]
|
305
372
|
|
306
373
|
# This makes an assumption that we're using some consistent repo names
|
307
374
|
# but need to either prepend 'rpm_' or 'debian_' based on package type
|
308
|
-
|
375
|
+
case File.extname(artifact_name)
|
376
|
+
when '.rpm'
|
309
377
|
promotion_path = "rpm_#{repository}/#{platform_tag}/#{artifact_name}"
|
310
|
-
|
378
|
+
when '.deb'
|
311
379
|
promotion_path = "debian_#{repository}/#{platform_tag}/#{artifact_name}"
|
312
380
|
properties = { 'deb.component' => debian_component } unless debian_component.nil?
|
313
381
|
else
|
@@ -315,8 +383,9 @@ module Pkg
|
|
315
383
|
end
|
316
384
|
|
317
385
|
begin
|
318
|
-
|
319
|
-
|
386
|
+
source_path = artifact_to_promote.download_uri.sub(@artifactory_uri, '')
|
387
|
+
puts "promoting #{artifact_name} from #{source_path} to #{promotion_path}"
|
388
|
+
artifact_to_promote.copy(promotion_path)
|
320
389
|
unless properties.nil?
|
321
390
|
artifacts = Artifactory::Resource::Artifact.search(name: artifact_name, :artifactory_uri => @artifactory_uri)
|
322
391
|
promoted_artifact = artifacts.select { |artifact| artifact.download_uri =~ %r{#{promotion_path}} }.first
|
@@ -356,37 +425,81 @@ module Pkg
|
|
356
425
|
end
|
357
426
|
|
358
427
|
# Ship PE tarballs to specified artifactory repo and paths
|
359
|
-
# @param
|
428
|
+
# @param local_tarball_directory [String] the local directory containing the tarballs
|
360
429
|
# @param target_repo [String] the artifactory repo to ship the tarballs to
|
361
|
-
# @param ship_paths [Array] the artifactory path(s) to ship the tarballs to within
|
362
|
-
|
430
|
+
# @param ship_paths [Array] the artifactory path(s) to ship the tarballs to within
|
431
|
+
# the target_repo
|
432
|
+
def ship_pe_tarballs(local_tarball_directory, target_repo, ship_paths)
|
363
433
|
check_authorization
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
434
|
+
ship_paths.each do |path|
|
435
|
+
unset_cleanup_skip_on_artifacts(target_repo, path)
|
436
|
+
Dir.foreach(local_tarball_directory) do |pe_tarball|
|
437
|
+
next if pe_tarball == '.' || pe_tarball == ".."
|
438
|
+
begin
|
439
|
+
puts "Uploading #{pe_tarball} to #{target_repo}/#{path}#{pe_tarball}"
|
440
|
+
artifact = Artifactory::Resource::Artifact.new(
|
441
|
+
local_path: "#{local_tarball_directory}/#{pe_tarball}")
|
442
|
+
uploaded_artifact = artifact.upload(target_repo, "#{path}#{pe_tarball}")
|
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}")
|
373
453
|
end
|
454
|
+
storage_artifact.properties(ARTIFACTORY_CLEANUP_SKIP_PROPERTY => true)
|
455
|
+
rescue Errno::EPIPE
|
456
|
+
## [eric.griswold] maybe this should be fatal?
|
457
|
+
STDERR.puts "Warning: Could not upload #{pe_tarball} to #{target_repo}/#{path}. Skipping."
|
458
|
+
next
|
374
459
|
end
|
375
460
|
end
|
376
461
|
end
|
377
462
|
end
|
378
463
|
|
379
|
-
#
|
380
|
-
# @param
|
381
|
-
# @param target_repo [String] repo on artifactory to
|
382
|
-
# @param
|
383
|
-
def
|
464
|
+
# Upload file to Artifactory
|
465
|
+
# @param local_path [String] local path to file to upload
|
466
|
+
# @param target_repo [String] repo on artifactory to upload to
|
467
|
+
# @param target_path [String] path within target_repo to upload to
|
468
|
+
def upload_file(local_path, target_repo, target_path)
|
469
|
+
fail "Error: Couldn't find file at #{local_path}." unless File.exist? local_path
|
384
470
|
check_authorization
|
385
|
-
artifact = Artifactory::Resource::Artifact.new(local_path:
|
471
|
+
artifact = Artifactory::Resource::Artifact.new(local_path: local_path)
|
472
|
+
full_upload_path = File.join(target_path, File.basename(local_path))
|
386
473
|
begin
|
387
|
-
|
388
|
-
|
389
|
-
|
474
|
+
puts "Uploading #{local_path} to #{target_repo}/#{full_upload_path} . . ."
|
475
|
+
artifact.upload(target_repo, full_upload_path)
|
476
|
+
rescue Artifactory::Error::HTTPError => e
|
477
|
+
fail "Error: Upload failed. Ensure path #{target_path} exists in the #{target_repo} repository."
|
478
|
+
end
|
479
|
+
end
|
480
|
+
|
481
|
+
# Clear the ARTIFACTORY_CLEANUP_SKIP_PROPERTY on all artifacts in
|
482
|
+
# a specified directory in a given Artifactory repo that match
|
483
|
+
# /<directory>/*.tar. Use this before uploading newer tarballs to maintain
|
484
|
+
# 'cleanup.skip' on the latest tarballs only.
|
485
|
+
#
|
486
|
+
# @param repo [String] Artifactory repository that contains the specified directory
|
487
|
+
# @param directory [String] Artifactory directory in repo containing the artifacts from which to
|
488
|
+
# set the 'cleanup.skip' property setting to false
|
489
|
+
def unset_cleanup_skip_on_artifacts(repo, directory)
|
490
|
+
artifacts_with_cleanup_skip = Artifactory::Resource::Artifact.property_search(
|
491
|
+
ARTIFACTORY_CLEANUP_SKIP_PROPERTY => true,
|
492
|
+
"repos" => repo
|
493
|
+
)
|
494
|
+
|
495
|
+
# For the upcoming directory check, make sure we know where our trailing slashes are.
|
496
|
+
directory_no_trailing_slashes = directory.sub(/(\/)+$/, '')
|
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}/")
|
502
|
+
artifact.properties(ARTIFACTORY_CLEANUP_SKIP_PROPERTY => false)
|
390
503
|
end
|
391
504
|
end
|
392
505
|
|
@@ -404,6 +517,114 @@ module Pkg
|
|
404
517
|
end
|
405
518
|
end
|
406
519
|
|
520
|
+
# Download final pe tarballs to local path based on name, repo, and path on artifactory
|
521
|
+
# @param pe_version [String] pe final tag
|
522
|
+
# @param repo [String] repo the tarballs live
|
523
|
+
# @param remote_path [String] path to tarballs in the repo
|
524
|
+
# @param local_path [String] local path to download tarballs to
|
525
|
+
def download_final_pe_tarballs(pe_version, repo, remote_path, local_path)
|
526
|
+
check_authorization
|
527
|
+
artifacts = Artifactory::Resource::Artifact.search(name: pe_version, repos: repo)
|
528
|
+
artifacts.each do |artifact|
|
529
|
+
next unless artifact.download_uri.include? remote_path
|
530
|
+
next if artifact.download_uri.include? "-rc"
|
531
|
+
artifact.download(local_path)
|
532
|
+
end
|
533
|
+
end
|
534
|
+
|
535
|
+
# Download beta pe tarballs to local path based on tag, repo, and path on artifactory
|
536
|
+
# @param beta_tag [String] rc tag of beta release ex. 2019.2.0-rc10
|
537
|
+
# @param repo [String] repo the tarballs live
|
538
|
+
# @param remote_path [String] path to tarballs in the repo
|
539
|
+
# @param local_path [String] local path to download tarballs to
|
540
|
+
def download_beta_pe_tarballs(beta_tag, repo, remote_path, local_path)
|
541
|
+
check_authorization
|
542
|
+
pattern = "#{remote_path}/*-#{beta_tag}-*"
|
543
|
+
artifacts = Artifactory::Resource::Artifact.pattern_search(repo: repo, pattern: pattern)
|
544
|
+
artifacts.each do |artifact|
|
545
|
+
artifact.download(local_path)
|
546
|
+
end
|
547
|
+
end
|
548
|
+
|
549
|
+
# When we ship a new PE release we copy final tarballs to archives/releases
|
550
|
+
# @param pe_version [String] pe final tag
|
551
|
+
# @param repo [String] repo the tarballs live
|
552
|
+
# @param remote_path [String] path to tarballs in the repo
|
553
|
+
# @param target_path [String] path copy tarballs to, assumes same repo
|
554
|
+
def copy_final_pe_tarballs(pe_version, repo, remote_path, target_path)
|
555
|
+
check_authorization
|
556
|
+
final_tarballs = Artifactory::Resource::Artifact.search(name: pe_version, repos: repo)
|
557
|
+
final_tarballs.each do |artifact|
|
558
|
+
next unless artifact.download_uri.include? remote_path
|
559
|
+
next if artifact.download_uri.include? "-rc"
|
560
|
+
artifact.copy("#{repo}/#{target_path}")
|
561
|
+
end
|
562
|
+
end
|
563
|
+
|
564
|
+
# When we cut a new PE branch, we need to copy the pe components into <pe_version>/{repos,feature,release}/<platform>
|
565
|
+
# @param manifest [File] JSON file containing information about what packages to download and the corresponding md5sums
|
566
|
+
# @param target_path [String] path on artifactory to copy components to, e.g. <pe_version>/release
|
567
|
+
def populate_pe_repos(manifest, target_path)
|
568
|
+
check_authorization
|
569
|
+
manifest.each do |dist, packages|
|
570
|
+
puts "Copying #{dist} packages..."
|
571
|
+
packages.each do |name, info|
|
572
|
+
artifact = Artifactory::Resource::Artifact.checksum_search(md5: "#{info["md5"]}", repos: ["rpm_enterprise__local", "debian_enterprise__local"]).first
|
573
|
+
if artifact.nil?
|
574
|
+
raise "Error: what the hell, could not find package #{info["filename"]} with md5sum #{info["md5"]}"
|
575
|
+
end
|
576
|
+
begin
|
577
|
+
artifact_target_path = "#{artifact.repo}/#{target_path}/#{dist}/#{info["filename"]}"
|
578
|
+
puts "Copying #{artifact.download_uri} to #{artifact_target_path}"
|
579
|
+
artifact.copy(artifact_target_path)
|
580
|
+
rescue Artifactory::Error::HTTPError
|
581
|
+
STDERR.puts "Could not copy #{artifact_target_path}. Source and destination are the same. Skipping..."
|
582
|
+
end
|
583
|
+
if File.extname(info["filename"]) == '.deb'
|
584
|
+
copied_artifact_search = Artifactory::Resource::Artifact.pattern_search(repo: 'debian_enterprise__local', pattern: "#{target_path}/*/#{info["filename"]}")
|
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
|
+
copied_artifact = copied_artifact_search.first
|
587
|
+
properties = { 'deb.component' => Pkg::Paths.two_digit_pe_version_from_path(target_path) }
|
588
|
+
copied_artifact.properties(properties)
|
589
|
+
end
|
590
|
+
end
|
591
|
+
end
|
592
|
+
end
|
593
|
+
|
594
|
+
# Remove all artifacts in repo based on pattern, used when we purge all artifacts in release/ after PE release
|
595
|
+
# @param repos [Array] repos that we want to search for artifacts in
|
596
|
+
# @param pattern [String] pattern for artifacts that should be deleted ex. `2019.1/release/*/*`
|
597
|
+
def teardown_repo(repos, pattern)
|
598
|
+
check_authorization
|
599
|
+
repos.each do |repo|
|
600
|
+
artifacts = Artifactory::Resource::Artifact.pattern_search(repo: repo, pattern: pattern)
|
601
|
+
artifacts.each do |artifact|
|
602
|
+
puts "Deleting #{artifact.download_uri}"
|
603
|
+
artifact.delete
|
604
|
+
end
|
605
|
+
end
|
606
|
+
end
|
607
|
+
|
608
|
+
# Remove promoted artifacts if promotion is reverted, use information provided in manifest
|
609
|
+
# @param manifest [File] JSON file containing information about what packages to download and the corresponding md5sums
|
610
|
+
# @param remote_path [String] path on artifactory to promoted packages ex. 2019.1/repos/
|
611
|
+
# @param package [String] package name ex. puppet-agent
|
612
|
+
# @param repos [Array] the repos the promoted artifacts live
|
613
|
+
def remove_promoted_packages(manifest, remote_path, package, repos)
|
614
|
+
check_authorization
|
615
|
+
manifest.each do |dist, packages|
|
616
|
+
packages.each do |package_name, info|
|
617
|
+
next unless package_name == package
|
618
|
+
artifacts = Artifactory::Resource::Artifact.checksum_search(md5: "#{info["md5"]}", repos: repos)
|
619
|
+
artifacts.each do |artifact|
|
620
|
+
next unless artifact.download_uri.include? remote_path
|
621
|
+
puts "Removing reverted package #{artifact.download_uri}"
|
622
|
+
artifact.delete
|
623
|
+
end
|
624
|
+
end
|
625
|
+
end
|
626
|
+
end
|
627
|
+
|
407
628
|
# Remove shipped PE tarballs from artifactory
|
408
629
|
# Used when compose fails, we only want the tarball shipped to artifactory if all platforms succeed
|
409
630
|
# Identify which packages were created and shipped based on md5sum and remove them
|
data/lib/packaging/config.rb
CHANGED
@@ -99,7 +99,7 @@ module Pkg
|
|
99
99
|
# beaker install the msi without having to know any version
|
100
100
|
# information, but we should report the versioned artifact in
|
101
101
|
# platform_data
|
102
|
-
next if platform
|
102
|
+
next if platform =~ /^windows.*$/ && File.basename(artifact) == "#{self.project}-#{arch}.#{package_format}"
|
103
103
|
|
104
104
|
# Sometimes we have source or debug packages. We don't want to save
|
105
105
|
# these paths in favor of the artifact paths.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Pkg::Metrics
|
2
|
+
module_function
|
3
|
+
|
4
|
+
def update_release_metrics
|
5
|
+
metrics_repo = 'release-metrics'
|
6
|
+
command = <<CMD
|
7
|
+
git clone git@github.com:puppetlabs/#{metrics_repo}.git
|
8
|
+
cd #{metrics_repo}
|
9
|
+
bundle exec add-release --date #{Pkg::Util::Date.today} --project #{Pkg::Config.project} --version #{Pkg::Config.ref}
|
10
|
+
cd ..
|
11
|
+
rm -r #{metrics_repo}
|
12
|
+
CMD
|
13
|
+
Pkg::Util::Execution.capture3(command, true)
|
14
|
+
end
|
15
|
+
end
|
data/lib/packaging/paths.rb
CHANGED
@@ -25,13 +25,15 @@ module Pkg::Paths
|
|
25
25
|
# with the artifact and path
|
26
26
|
def tag_from_artifact_path(path)
|
27
27
|
platform = Pkg::Platforms.supported_platforms.find { |p| path =~ /(\/|\.)#{p}[^\.]/ }
|
28
|
+
platform = 'windowsfips' if path =~ /windowsfips/
|
29
|
+
|
28
30
|
codename = Pkg::Platforms.codenames.find { |c| path =~ /\/#{c}/ }
|
29
31
|
|
30
32
|
if codename
|
31
33
|
platform, version = Pkg::Platforms.codename_to_platform_version(codename)
|
32
34
|
end
|
33
35
|
|
34
|
-
version = '2012' if platform
|
36
|
+
version = '2012' if platform =~ /^windows.*$/
|
35
37
|
|
36
38
|
version ||= Pkg::Platforms.versions_for_platform(platform).find { |v| path =~ /#{platform}(\/|-)?#{v}/ }
|
37
39
|
|
@@ -152,7 +154,7 @@ module Pkg::Paths
|
|
152
154
|
if is_legacy_repo?(repo_name(nonfinal))
|
153
155
|
[File.join(path_prefix, 'windows'), nil]
|
154
156
|
else
|
155
|
-
[File.join(path_prefix,
|
157
|
+
[File.join(path_prefix, platform, repo_name(nonfinal)), link_name(nonfinal).nil? ? nil : File.join(path_prefix, platform, link_name(nonfinal))]
|
156
158
|
end
|
157
159
|
else
|
158
160
|
raise "Not sure where to find packages with a package format of '#{package_format}'"
|
@@ -242,7 +244,7 @@ module Pkg::Paths
|
|
242
244
|
if options[:legacy]
|
243
245
|
File.join('repos', 'windows')
|
244
246
|
else
|
245
|
-
File.join('repos',
|
247
|
+
File.join('repos', platform, repo_target)
|
246
248
|
end
|
247
249
|
else
|
248
250
|
raise "Not sure what to do with a package format of '#{package_format}'"
|
@@ -300,4 +302,10 @@ module Pkg::Paths
|
|
300
302
|
return nil
|
301
303
|
end
|
302
304
|
end
|
305
|
+
|
306
|
+
def two_digit_pe_version_from_path(path)
|
307
|
+
matches = path.match(/\d+\.\d+/)
|
308
|
+
fail "Error: Could not determine PE version from path #{path}" if matches.nil?
|
309
|
+
return matches[0]
|
310
|
+
end
|
303
311
|
end
|
data/lib/packaging/platforms.rb
CHANGED
@@ -340,6 +340,13 @@ module Pkg
|
|
340
340
|
repo: false,
|
341
341
|
}
|
342
342
|
},
|
343
|
+
'windowsfips' => {
|
344
|
+
'2012' => {
|
345
|
+
architectures: ['x64'],
|
346
|
+
package_format: 'msi',
|
347
|
+
repo: false,
|
348
|
+
}
|
349
|
+
},
|
343
350
|
}.freeze
|
344
351
|
|
345
352
|
# @return [Array] An array of Strings, containing all of the supported
|
data/lib/packaging/sign/msi.rb
CHANGED
@@ -9,7 +9,7 @@ module Pkg::Sign::Msi
|
|
9
9
|
|
10
10
|
work_dir = "Windows/Temp/#{Pkg::Util.rand_string}"
|
11
11
|
Pkg::Util::Net.remote_ssh_cmd(ssh_host_string, "mkdir -p C:/#{work_dir}")
|
12
|
-
msis = Dir.glob("#{target_dir}/windows
|
12
|
+
msis = Dir.glob("#{target_dir}/windows*/**/*.msi")
|
13
13
|
Pkg::Util::Net.rsync_to(msis.join(" "), rsync_host_string, "/cygdrive/c/#{work_dir}")
|
14
14
|
|
15
15
|
# Please Note:
|
@@ -87,7 +87,7 @@ for msi in #{msis.map { |d| File.basename(d) }.join(" ")}; do
|
|
87
87
|
done;
|
88
88
|
echo $ret
|
89
89
|
if [[ $ret != *"Succeeded"* ]]; then exit 1; fi
|
90
|
-
sha256Servers=(http://
|
90
|
+
sha256Servers=(http://timestamp.digicert.com/sha256/timestamp
|
91
91
|
http://timestamp.comodoca.com?td=sha256)
|
92
92
|
for timeserver in "${sha256Servers[@]}"; do
|
93
93
|
for ((try=1; try<=$tries; try++)) do
|
data/lib/packaging/util/date.rb
CHANGED
@@ -26,6 +26,11 @@ describe 'artifactory.rb' do
|
|
26
26
|
:repo_config => '',
|
27
27
|
:additional_artifacts => ["./windows/puppet-agent-extras-5.3.1.34-x86.msi"],
|
28
28
|
},
|
29
|
+
'windowsfips-2012-x64' => {
|
30
|
+
:artifact => "./windowsfips/puppet-agent-5.3.1.34-x64.msi",
|
31
|
+
:repo_config => '',
|
32
|
+
:additional_artifacts => ["./windowsfips/puppet-agent-extras-5.3.1.34-x64.msi"],
|
33
|
+
},
|
29
34
|
'eos-4-i386' => {
|
30
35
|
:artifact => "./eos/4/PC1/i386/puppet-agent-5.3.1.34.gf65f9ef-1.eos4.i386.swix",
|
31
36
|
:repo_config => '',
|
@@ -65,6 +70,12 @@ describe 'artifactory.rb' do
|
|
65
70
|
:package_name => 'path/to/a/windows/package/puppet-agent-5.3.1.34-x86.msi',
|
66
71
|
:all_package_names => ['puppet-agent-5.3.1.34-x86.msi','puppet-agent-extras-5.3.1.34-x86.msi']
|
67
72
|
},
|
73
|
+
'windowsfips-2012-x64' => {
|
74
|
+
:toplevel_repo => 'generic',
|
75
|
+
:repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/windowsfips-x64",
|
76
|
+
:package_name => 'path/to/a/windowsfips/package/puppet-agent-5.3.1.34-x64.msi',
|
77
|
+
:all_package_names => ['puppet-agent-5.3.1.34-x64.msi','puppet-agent-extras-5.3.1.34-x64.msi']
|
78
|
+
},
|
68
79
|
'eos-4-i386' => {
|
69
80
|
:toplevel_repo => 'generic',
|
70
81
|
:repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/eos-4-i386",
|
@@ -232,7 +232,9 @@ describe "Pkg::Config" do
|
|
232
232
|
"./artifacts/windows/puppet-agent-x64.msi\n" \
|
233
233
|
"./artifacts/windows/puppet-agent-5.3.2-x86.wixpdb\n" \
|
234
234
|
"./artifacts/windows/puppet-agent-5.3.2-x86.msi\n" \
|
235
|
-
"./artifacts/windows/puppet-agent-5.3.2-x64.msi"
|
235
|
+
"./artifacts/windows/puppet-agent-5.3.2-x64.msi\n"\
|
236
|
+
"./artifacts/windowsfips/puppet-agent-x64.msi\n" \
|
237
|
+
"./artifacts/windowsfips/puppet-agent-5.3.2-x64.msi"
|
236
238
|
|
237
239
|
solaris_artifacts = \
|
238
240
|
"./artifacts/solaris/11/PC1/puppet-agent@5.3.2,5.11-1.sparc.p5p\n" \
|
@@ -297,6 +299,7 @@ describe "Pkg::Config" do
|
|
297
299
|
data = Pkg::Config.platform_data
|
298
300
|
expect(data['windows-2012-x86']).to include(:artifact => './windows/puppet-agent-5.3.2-x86.msi')
|
299
301
|
expect(data['windows-2012-x64']).to include(:artifact => './windows/puppet-agent-5.3.2-x64.msi')
|
302
|
+
expect(data['windowsfips-2012-x64']).to include(:artifact => './windowsfips/puppet-agent-5.3.2-x64.msi')
|
300
303
|
end
|
301
304
|
|
302
305
|
it "should not collect debug packages" do
|
@@ -19,7 +19,7 @@ describe 'Pkg::Platforms' do
|
|
19
19
|
|
20
20
|
describe '#supported_platforms' do
|
21
21
|
it 'should return all supported platforms' do
|
22
|
-
platforms = ['aix', 'cisco-wrlinux', 'cumulus', 'debian', 'el', 'eos', 'fedora', 'osx', 'redhatfips', 'sles', 'solaris', 'ubuntu', 'windows']
|
22
|
+
platforms = ['aix', 'cisco-wrlinux', 'cumulus', 'debian', 'el', 'eos', 'fedora', 'osx', 'redhatfips', 'sles', 'solaris', 'ubuntu', 'windows', 'windowsfips']
|
23
23
|
expect(Pkg::Platforms.supported_platforms).to match_array(platforms)
|
24
24
|
end
|
25
25
|
end
|
@@ -127,6 +127,7 @@ describe 'Pkg::Platforms' do
|
|
127
127
|
test_cases = {
|
128
128
|
'debian-9-amd64' => ['debian', '9', 'amd64'],
|
129
129
|
'windows-2012-x86' => ['windows', '2012', 'x86'],
|
130
|
+
'windowsfips-2012-x64' => ['windowsfips', '2012', 'x64'],
|
130
131
|
'el-7-x86_64' => ['el', '7', 'x86_64'],
|
131
132
|
'cisco-wrlinux-7-x86_64' => ['cisco-wrlinux', '7', 'x86_64'],
|
132
133
|
'cisco-wrlinux-7' => ['cisco-wrlinux', '7', ''],
|
@@ -4,7 +4,9 @@ describe '#Pkg::Util::Ship' do
|
|
4
4
|
describe '#collect_packages' do
|
5
5
|
msi_pkgs = [
|
6
6
|
'pkg/windows/puppet5/puppet-agent-1.4.1.2904.g8023dd1-x86.msi',
|
7
|
-
'pkg/windows/puppet5/puppet-agent-x86.msi'
|
7
|
+
'pkg/windows/puppet5/puppet-agent-x86.msi',
|
8
|
+
'pkg/windowsfips/puppet5/puppet-agent-1.4.1.2904.g8023dd1-x64.msi',
|
9
|
+
'pkg/windowsfips/puppet5/puppet-agent-x64.msi'
|
8
10
|
]
|
9
11
|
swix_pkgs = [
|
10
12
|
'pkg/eos/puppet5/4/i386/puppet-agent-1.4.1.2904.g8023dd1-1.eos4.i386.swix',
|
@@ -24,7 +26,13 @@ describe '#Pkg::Util::Ship' do
|
|
24
26
|
expect(Pkg::Util::Ship.collect_packages(['pkg/**/*.msi'], ['puppet-agent-x(86|64).msi'])).not_to include('pkg/windows/puppet5/puppet-agent-x86.msi')
|
25
27
|
end
|
26
28
|
it 'correctly includes packages that do not match a passed excluded argument' do
|
27
|
-
expect(Pkg::Util::Ship.collect_packages(['pkg/**/*.msi'], ['puppet-agent-x(86|64).msi'])).to
|
29
|
+
expect(Pkg::Util::Ship.collect_packages(['pkg/**/*.msi'], ['puppet-agent-x(86|64).msi'])).to \
|
30
|
+
match_array(
|
31
|
+
[
|
32
|
+
'pkg/windows/puppet5/puppet-agent-1.4.1.2904.g8023dd1-x86.msi',
|
33
|
+
'pkg/windowsfips/puppet5/puppet-agent-1.4.1.2904.g8023dd1-x64.msi',
|
34
|
+
]
|
35
|
+
)
|
28
36
|
end
|
29
37
|
end
|
30
38
|
|
data/tasks/jenkins.rake
CHANGED
@@ -267,6 +267,12 @@ namespace :pl do
|
|
267
267
|
end
|
268
268
|
# mark the build as successfully shipped
|
269
269
|
Rake::Task["pl:jenkins:ship"].invoke("shipped")
|
270
|
+
# add the release to release-metrics
|
271
|
+
begin
|
272
|
+
Rake::Task["pl:update_release_metrics"].invoke
|
273
|
+
rescue => e
|
274
|
+
puts "Uh oh! Something went wrong updating release-metrics:\n#{e}\nPlease add this release manually. Proceeding..."
|
275
|
+
end
|
270
276
|
end
|
271
277
|
|
272
278
|
task :stage_nightlies => "pl:fetch" do
|
data/tasks/ship.rake
CHANGED
@@ -434,6 +434,11 @@ namespace :pl do
|
|
434
434
|
Pkg::Util::Ship.ship_msi('pkg', Pkg::Config.nonfinal_msi_path, excludes: ["#{Pkg::Config.project}-x(86|64).msi"], nonfinal: true)
|
435
435
|
end
|
436
436
|
|
437
|
+
desc "Add #{Pkg::Config.project} version #{Pkg::Config.ref} to release-metrics"
|
438
|
+
task :update_release_metrics => "pl:fetch" do
|
439
|
+
Pkg::Metrics.update_release_metrics
|
440
|
+
end
|
441
|
+
|
437
442
|
desc 'UBER ship: ship all the things in pkg'
|
438
443
|
task uber_ship: 'pl:fetch' do
|
439
444
|
if Pkg::Util.confirm_ship(FileList['pkg/**/*'])
|
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.47
|
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-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '12.3'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '12.3'
|
69
69
|
- !ruby/object:Gem::Dependency
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: release-metrics
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description: Packaging automation written in Rake and Ruby. Easily build native packages
|
84
98
|
for most platforms with a few data files and git.
|
85
99
|
email: info@puppetlabs.com
|
@@ -98,6 +112,7 @@ files:
|
|
98
112
|
- lib/packaging/deb.rb
|
99
113
|
- lib/packaging/deb/repo.rb
|
100
114
|
- lib/packaging/gem.rb
|
115
|
+
- lib/packaging/metrics.rb
|
101
116
|
- lib/packaging/nuget.rb
|
102
117
|
- lib/packaging/paths.rb
|
103
118
|
- lib/packaging/platforms.rb
|
@@ -229,28 +244,28 @@ signing_key:
|
|
229
244
|
specification_version: 4
|
230
245
|
summary: Puppet Labs' packaging automation
|
231
246
|
test_files:
|
247
|
+
- spec/lib/packaging/retrieve_spec.rb
|
232
248
|
- spec/lib/packaging/paths_spec.rb
|
249
|
+
- spec/lib/packaging/tar_spec.rb
|
233
250
|
- 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
|
+
- spec/lib/packaging/deb_spec.rb
|
255
|
+
- spec/lib/packaging/sign_spec.rb
|
256
|
+
- spec/lib/packaging/gem_spec.rb
|
257
|
+
- spec/lib/packaging/util/rake_utils_spec.rb
|
258
|
+
- spec/lib/packaging/util/git_spec.rb
|
259
|
+
- spec/lib/packaging/util/os_spec.rb
|
234
260
|
- spec/lib/packaging/util/misc_spec.rb
|
261
|
+
- spec/lib/packaging/util/version_spec.rb
|
262
|
+
- spec/lib/packaging/util/file_spec.rb
|
235
263
|
- spec/lib/packaging/util/execution_spec.rb
|
236
264
|
- spec/lib/packaging/util/gpg_spec.rb
|
237
265
|
- spec/lib/packaging/util/jenkins_spec.rb
|
238
266
|
- spec/lib/packaging/util/ship_spec.rb
|
239
267
|
- spec/lib/packaging/util/git_tag_spec.rb
|
240
|
-
- spec/lib/packaging/util/git_spec.rb
|
241
|
-
- spec/lib/packaging/util/rake_utils_spec.rb
|
242
|
-
- spec/lib/packaging/util/file_spec.rb
|
243
|
-
- spec/lib/packaging/util/os_spec.rb
|
244
|
-
- spec/lib/packaging/util/version_spec.rb
|
245
268
|
- spec/lib/packaging/util/net_spec.rb
|
246
|
-
- spec/lib/packaging/deb_spec.rb
|
247
269
|
- spec/lib/packaging/platforms_spec.rb
|
248
|
-
- spec/lib/packaging/rpm/repo_spec.rb
|
249
|
-
- spec/lib/packaging/sign_spec.rb
|
250
|
-
- spec/lib/packaging/retrieve_spec.rb
|
251
|
-
- spec/lib/packaging/repo_spec.rb
|
252
|
-
- spec/lib/packaging/artifactory_spec.rb
|
253
|
-
- spec/lib/packaging/gem_spec.rb
|
254
|
-
- spec/lib/packaging/tar_spec.rb
|
255
270
|
- spec/lib/packaging/config_spec.rb
|
256
271
|
- spec/lib/packaging_spec.rb
|