apt_stage_artifacts 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +17 -118
- data/apt_stage_artifacts.gemspec +5 -1
- data/lib/apt_add_to_freight_library.rb +4 -4
- data/lib/apt_stage_artifacts.rb +5 -4
- data/lib/apt_stage_from_tarball.rb +17 -11
- data/lib/apt_update_freight_cache.rb +1 -1
- data/lib/version.rb +1 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d51905e7a2e23e20b04d1cd22a6e61edc8ec929177f1a5ccdee059af132232d0
|
4
|
+
data.tar.gz: fc6413ef75d8b67e8aa58c2bc02cb5f5c054d54da142041b369983ea8ee4b60d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c407f46e72961f82815fda25d44bf691086028088755f54fc816685193833a6daf299aa5258523ba91981988ff3e3501e9cb21c3f8ce324784942fbd11b470e8
|
7
|
+
data.tar.gz: feae60918c1195903d34d210bb068d17333bb2ad353b09c74280f1c2d5512a6d6668915184247bdd9cd75d7611ca630f6a08ec92471c040d3fd10c9e2d07338a
|
data/.rubocop.yml
CHANGED
@@ -3,150 +3,49 @@
|
|
3
3
|
require: rubocop-rake
|
4
4
|
|
5
5
|
AllCops:
|
6
|
+
TargetRubyVersion: 2.3
|
7
|
+
|
6
8
|
Exclude:
|
7
9
|
- Rakefile
|
8
10
|
- Gemfile
|
9
11
|
- bin/*
|
10
12
|
- spec/**/*.rb
|
13
|
+
- '*.gemspec'
|
11
14
|
- templates/*
|
12
15
|
|
13
|
-
|
14
|
-
Enabled: true
|
15
|
-
|
16
|
-
Layout/FirstArrayElementIndentation:
|
16
|
+
Style/FrozenStringLiteralComment:
|
17
17
|
Enabled: false
|
18
18
|
|
19
|
-
|
19
|
+
Style/MutableConstant:
|
20
20
|
Enabled: false
|
21
21
|
|
22
|
-
Layout/
|
23
|
-
|
24
|
-
|
25
|
-
Lint/AmbiguousAssignment:
|
26
|
-
Enabled: true
|
27
|
-
|
28
|
-
Lint/DeprecatedConstants:
|
29
|
-
Enabled: true
|
30
|
-
|
31
|
-
Lint/DuplicateBranch:
|
32
|
-
Enabled: true
|
33
|
-
|
34
|
-
Lint/DuplicateRegexpCharacterClassElement:
|
35
|
-
Enabled: true
|
36
|
-
|
37
|
-
Lint/EmptyBlock:
|
38
|
-
Enabled: true
|
39
|
-
|
40
|
-
Lint/EmptyClass:
|
41
|
-
Enabled: true
|
42
|
-
|
43
|
-
Lint/LambdaWithoutLiteralBlock:
|
44
|
-
Enabled: true
|
45
|
-
|
46
|
-
Lint/NoReturnInBeginEndBlocks:
|
47
|
-
Enabled: true
|
48
|
-
|
49
|
-
Lint/NumberedParameterAssignment:
|
50
|
-
Enabled: true
|
51
|
-
|
52
|
-
Lint/OrAssignmentToConstant:
|
53
|
-
Enabled: true
|
54
|
-
|
55
|
-
Lint/RedundantDirGlobSort:
|
56
|
-
Enabled: true
|
22
|
+
Layout/LineLength:
|
23
|
+
Max: 100
|
57
24
|
|
58
|
-
|
59
|
-
Enabled: true
|
60
|
-
|
61
|
-
Lint/ToEnumArguments:
|
62
|
-
Enabled: true
|
63
|
-
|
64
|
-
Lint/TripleQuotes:
|
65
|
-
Enabled: true
|
66
|
-
|
67
|
-
Lint/UnexpectedBlockArity:
|
68
|
-
Enabled: true
|
69
|
-
|
70
|
-
Lint/UnmodifiedReduceAccumulator:
|
71
|
-
Enabled: true
|
72
|
-
|
73
|
-
Metrics/AbcSize:
|
74
|
-
Enabled: false
|
75
|
-
|
76
|
-
Metrics/ClassLength:
|
25
|
+
Style/Documentation:
|
77
26
|
Enabled: false
|
78
27
|
|
79
|
-
Metrics/
|
28
|
+
Metrics/AbcSize:
|
80
29
|
Enabled: false
|
81
30
|
|
82
31
|
Metrics/MethodLength:
|
83
32
|
Enabled: false
|
84
33
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
Metrics/PerceivedComplexity:
|
89
|
-
Enabled: false
|
90
|
-
|
91
|
-
Style/ArgumentsForwarding:
|
92
|
-
Enabled: true
|
93
|
-
|
94
|
-
Style/CollectionCompact:
|
95
|
-
Enabled: true
|
96
|
-
|
97
|
-
Style/DocumentDynamicEvalDefinition:
|
98
|
-
Enabled: true
|
99
|
-
|
100
|
-
Style/Documentation:
|
101
|
-
Enabled: false
|
102
|
-
|
103
|
-
Style/EachWithObject:
|
104
|
-
Enabled: false
|
105
|
-
|
106
|
-
Style/EndlessMethod:
|
107
|
-
Enabled: true
|
108
|
-
|
109
|
-
Style/FormatString:
|
110
|
-
Enabled: false
|
34
|
+
Style/CommandLiteral:
|
35
|
+
EnforcedStyle: percent_x
|
111
36
|
|
112
|
-
|
37
|
+
Metrics/ClassLength:
|
113
38
|
Enabled: false
|
114
39
|
|
115
|
-
Style/
|
40
|
+
Style/RedundantReturn:
|
116
41
|
Enabled: false
|
117
42
|
|
118
|
-
Style/
|
119
|
-
|
120
|
-
|
121
|
-
Style/HashExcept:
|
122
|
-
Enabled: true
|
43
|
+
Style/PercentLiteralDelimiters:
|
44
|
+
PreferredDelimiters:
|
45
|
+
default: '()'
|
123
46
|
|
124
47
|
Style/IfUnlessModifier:
|
125
48
|
Enabled: false
|
126
49
|
|
127
|
-
|
128
|
-
Enabled: true
|
129
|
-
|
130
|
-
Style/MutableConstant:
|
131
|
-
Enabled: false
|
132
|
-
|
133
|
-
Style/NegatedIfElseCondition:
|
134
|
-
Enabled: true
|
135
|
-
|
136
|
-
Style/NilLambda:
|
137
|
-
Enabled: true
|
138
|
-
|
139
|
-
Style/RedundantArgument:
|
140
|
-
Enabled: true
|
141
|
-
|
142
|
-
Style/RedundantReturn:
|
143
|
-
Enabled: false
|
144
|
-
|
145
|
-
Style/StringChars:
|
146
|
-
Enabled: true
|
147
|
-
|
148
|
-
Style/SwapValues:
|
149
|
-
Enabled: true
|
150
|
-
|
151
|
-
Style/CommandLiteral:
|
50
|
+
Metrics/CyclomaticComplexity:
|
152
51
|
Enabled: false
|
data/apt_stage_artifacts.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
|
9
9
|
spec.summary = 'Stages .deb artifacts to a remote freight repository'
|
10
10
|
spec.homepage = 'https://github.com/puppetlabs/apt_stage_artifacts'
|
11
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
11
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
12
12
|
|
13
13
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
14
14
|
|
@@ -29,6 +29,10 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency 'pry-byebug', '~> 3.0'
|
30
30
|
spec.add_development_dependency 'rake', '~> 13.0'
|
31
31
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
32
|
+
|
33
|
+
# Rubocop 0.81 as the last to support Ruby 2.3. Drop this whenever we can stop
|
34
|
+
# supporting older rubies
|
35
|
+
spec.add_development_dependency 'rubocop', '0.81'
|
32
36
|
spec.add_development_dependency 'rubocop-rake'
|
33
37
|
spec.add_development_dependency 'rubocop-rspec'
|
34
38
|
spec.add_development_dependency 'yard', '~> 0.9'
|
@@ -94,7 +94,7 @@ class AptAddToFreightLibrary
|
|
94
94
|
AptStageArtifacts::FREIGHT_CONFIG_DIRECTORY,
|
95
95
|
"puppet#{@puppet_version}.conf"
|
96
96
|
)
|
97
|
-
fatal "Cannot read '#{freight_config_file} on #{
|
97
|
+
fatal "Cannot read '#{freight_config_file} on #{%x(hostname).chomp}." unless
|
98
98
|
File.readable?(freight_config_file)
|
99
99
|
|
100
100
|
logger.info "Using '#{freight_config_file}'"
|
@@ -115,9 +115,9 @@ class AptAddToFreightLibrary
|
|
115
115
|
end
|
116
116
|
|
117
117
|
freight_add_command = %W[
|
118
|
-
|
119
|
-
|
120
|
-
|
118
|
+
sudo --user=jenkins --set-home
|
119
|
+
#{AptStageArtifacts::FREIGHT_COMMAND} add #{@verbose} --conf="#{freight_config_file}"
|
120
|
+
#{deb_artifact_path} "apt/#{@codename}/#{@apt_component}"
|
121
121
|
].join(' ')
|
122
122
|
|
123
123
|
%x(#{freight_add_command})
|
data/lib/apt_stage_artifacts.rb
CHANGED
@@ -92,9 +92,9 @@ class AptStageArtifacts
|
|
92
92
|
end
|
93
93
|
return unless @debian_artifacts.empty?
|
94
94
|
|
95
|
-
logger.warn
|
96
|
-
|
97
|
-
|
95
|
+
logger.warn 'This project does not contain artifacts suitable for shipping to the ' \
|
96
|
+
'APT server. Expected repo layout is "pkg/<debian codename>/puppet<N>/*.deb". ' \
|
97
|
+
'Skipping.'
|
98
98
|
exit 0
|
99
99
|
end
|
100
100
|
|
@@ -197,7 +197,8 @@ class AptStageArtifacts
|
|
197
197
|
# Invoke the remote staging of the sent artifacts
|
198
198
|
def invoke_remote_staging
|
199
199
|
# Do this in a login shell so we get rvm PATH goodness
|
200
|
-
|
200
|
+
staging_command = "#{@remote_staging_command} #{@remote_tarball_path}"
|
201
|
+
%x(ssh #{@staging_server} '/bin/bash -l -c "#{staging_command}"')
|
201
202
|
return if $CHILD_STATUS.success?
|
202
203
|
|
203
204
|
fatal "'ssh #{@staging_server} #{@remote_staging_command} #{@remote_tarball_path}' failed."
|
@@ -31,7 +31,7 @@ class AptStageFromTarball
|
|
31
31
|
extract_tarball
|
32
32
|
add_artifacts_to_freight_library
|
33
33
|
update_freight_cache
|
34
|
-
|
34
|
+
cleanup_tarball_directory
|
35
35
|
logger.info 'Freight artifact staging successful.'
|
36
36
|
end
|
37
37
|
|
@@ -46,9 +46,10 @@ class AptStageFromTarball
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def extract_tarball
|
49
|
-
fatal "
|
50
|
-
fatal "'#{@tarball_path}'
|
51
|
-
fatal "'#{@tarball_path}' is not
|
49
|
+
fatal "Missing tarball_path command argument." if !@tarball_path
|
50
|
+
fatal "'#{@tarball_path}' does not exist" unless File.exist?(@tarball_path)
|
51
|
+
fatal "'#{@tarball_path}' is not a regular file" unless File.file?(@tarball_path)
|
52
|
+
fatal "'#{@tarball_path}' is not readable" unless File.readable?(@tarball_path)
|
52
53
|
|
53
54
|
@tarball_directory = File.dirname(@tarball_path)
|
54
55
|
|
@@ -69,6 +70,11 @@ class AptStageFromTarball
|
|
69
70
|
logger.info("'#{@tarball_path}' extracted.")
|
70
71
|
end
|
71
72
|
|
73
|
+
def cleanup_tarball_directory
|
74
|
+
FileUtils.rm_r @tarball_directory
|
75
|
+
logger.info("'#{@tarball_directory}' deleted.")
|
76
|
+
end
|
77
|
+
|
72
78
|
# Read through the staging manifest, adding each line into the correct apt freight
|
73
79
|
# library.
|
74
80
|
def add_artifacts_to_freight_library
|
@@ -76,12 +82,12 @@ class AptStageFromTarball
|
|
76
82
|
manifest_file = File.read(@manifest_path)
|
77
83
|
JSON.parse(manifest_file, symbolize_names: true).each do |artifact|
|
78
84
|
add_to_freight_library_command = %W[
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
+
#{@apt_add_to_freight_library_command}
|
86
|
+
--verbose
|
87
|
+
--puppet-version=#{artifact[:puppet_version]}
|
88
|
+
--component=#{artifact[:apt_component]}
|
89
|
+
--codename=#{artifact[:codename]}
|
90
|
+
#{File.join(Dir.pwd, artifact[:deb_file_path])}
|
85
91
|
].join(' ')
|
86
92
|
|
87
93
|
%x(#{add_to_freight_library_command})
|
@@ -102,7 +108,7 @@ class AptStageFromTarball
|
|
102
108
|
#{@apt_update_freight_cache_command}
|
103
109
|
--verbose
|
104
110
|
--puppet-version=#{puppet_version}
|
105
|
-
|
111
|
+
].join(' ')
|
106
112
|
|
107
113
|
%x(#{update_freight_cache_command})
|
108
114
|
fatal "#{update_freight_cache_command} failed." unless $CHILD_STATUS.success?
|
@@ -72,7 +72,7 @@ class AptUpdateFreightCache
|
|
72
72
|
end
|
73
73
|
|
74
74
|
freight_config_file = "/etc/freight.conf.d/puppet#{@puppet_version}.conf"
|
75
|
-
fatal "Cannot read '#{freight_config_file} on #{
|
75
|
+
fatal "Cannot read '#{freight_config_file} on #{%x(hostname).chomp}." unless
|
76
76
|
File.readable?(freight_config_file)
|
77
77
|
|
78
78
|
logger.info "Using '#{freight_config_file}'"
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apt_stage_artifacts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Release Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.81'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.81'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rubocop-rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,14 +186,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
186
|
requirements:
|
173
187
|
- - ">="
|
174
188
|
- !ruby/object:Gem::Version
|
175
|
-
version: 2.
|
189
|
+
version: 2.3.0
|
176
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
191
|
requirements:
|
178
192
|
- - ">="
|
179
193
|
- !ruby/object:Gem::Version
|
180
194
|
version: '0'
|
181
195
|
requirements: []
|
182
|
-
|
196
|
+
rubyforge_project:
|
197
|
+
rubygems_version: 2.7.6
|
183
198
|
signing_key:
|
184
199
|
specification_version: 4
|
185
200
|
summary: Stages .deb artifacts to a remote freight repository
|