apt_stage_artifacts 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/apt_add_to_freight_library.rb +6 -4
- data/lib/apt_stage_artifacts.rb +19 -16
- data/lib/apt_stage_from_tarball.rb +3 -0
- data/lib/mixins/constants.rb +1 -0
- data/lib/version.rb +1 -1
- 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: 8e43d6a863a30baa1254fc13176928c876311967637ee2c94aaa525db1d59434
|
4
|
+
data.tar.gz: 04c20925c5ffceac9f3861d0e5783cc3ffec3b30acc992bb7e8384acbcf6fcfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9eab7e0f70f96fa3f960a33c3013f7957e0eb863a7cf381b975e7d1de484ea157ad71635e792dbab50b449c7590bfa996e36959fd98d831f0ebb20795f773e8
|
7
|
+
data.tar.gz: 71c0f29097b376bb4d7e169e48b97d8e2377cc3a7c0267e7dbd21cba360a78e91b42e1e5aa6626c0b5818ca1b44faf17e1db2b2b4c7d62dd83cc6f1fd58912af
|
@@ -77,10 +77,12 @@ class AptAddToFreightLibrary
|
|
77
77
|
logger.info @version_string
|
78
78
|
@puppet_version = @user_options['--puppet-version']
|
79
79
|
fatal "Invalid Puppet version '#{@puppet_version}'" unless
|
80
|
-
VALID_PUPPET_VERSIONS.include? @puppet_version
|
80
|
+
AptStageArtifacts::VALID_PUPPET_VERSIONS.include? @puppet_version
|
81
81
|
|
82
82
|
@repo_type = @user_options['--repo-type']
|
83
|
-
|
83
|
+
unless AptStageArtifacts::VALID_REPO_TYPES.include? @repo_type
|
84
|
+
fatal "Invalid repo type '#{@repo_type}'"
|
85
|
+
end
|
84
86
|
|
85
87
|
@codename = @user_options['--codename']
|
86
88
|
unless AptStageArtifacts::VALID_CODENAMES.include? @codename
|
@@ -88,7 +90,7 @@ class AptAddToFreightLibrary
|
|
88
90
|
end
|
89
91
|
|
90
92
|
freight_config_file = File.join(
|
91
|
-
FREIGHT_CONFIG_DIRECTORY,
|
93
|
+
AptStageArtifacts::FREIGHT_CONFIG_DIRECTORY,
|
92
94
|
"puppet_#{@puppet_version}_#{@repo_type}.conf"
|
93
95
|
)
|
94
96
|
fatal "Cannot read '#{freight_config_file} on #{`hostname`.chomp}." unless
|
@@ -110,7 +112,7 @@ class AptAddToFreightLibrary
|
|
110
112
|
|
111
113
|
freight_add_command = %W[
|
112
114
|
sudo --user=jenkins --set-home
|
113
|
-
#{FREIGHT_COMMAND} add #{@verbose} --conf="#{freight_config_file}"
|
115
|
+
#{AptStageArtifacts::FREIGHT_COMMAND} add #{@verbose} --conf="#{freight_config_file}"
|
114
116
|
#{deb_artifact_path} "apt/#{@codename}"
|
115
117
|
].join(' ')
|
116
118
|
|
data/lib/apt_stage_artifacts.rb
CHANGED
@@ -16,14 +16,17 @@ class AptStageArtifacts
|
|
16
16
|
Stages .deb artifacts into a freight library from a Vanagon or packaging directory.
|
17
17
|
|
18
18
|
Usage:
|
19
|
-
apt-stage-artifacts [--
|
20
|
-
apt-stage-artifacts
|
19
|
+
apt-stage-artifacts [--repo-type=<repo-type>] [<top_directory>]
|
20
|
+
apt-stage-artifacts --version
|
21
|
+
apt-stage-artifacts --help
|
22
|
+
|
21
23
|
DOCOPT
|
22
24
|
|
23
25
|
def initialize(argv)
|
24
26
|
@script_name = File.basename($PROGRAM_NAME)
|
25
27
|
@log_level = Logger::INFO
|
26
28
|
@user_options = parse_options(argv)
|
29
|
+
@repo_type = @user_options['--repo-type'] || 'stable'
|
27
30
|
@version_string = "Version #{AptStageArtifacts::VERSION}"
|
28
31
|
|
29
32
|
@artifacts_tarball_name = 'artifacts.tgz'
|
@@ -44,6 +47,10 @@ class AptStageArtifacts
|
|
44
47
|
def run
|
45
48
|
logger.info @version_string
|
46
49
|
exit 0 if @user_options['--version']
|
50
|
+
unless AptStageArtifacts::VALID_REPO_TYPES.include? @repo_type
|
51
|
+
fatal "Unknown repo_type: \"#{@repo_type}\". Valid repo types are: " +
|
52
|
+
AptStageArtifacts::VALID_REPO_TYPES.join(', ')
|
53
|
+
end
|
47
54
|
load_builder_data_yaml
|
48
55
|
collect_artifacts
|
49
56
|
create_remote_staging_directory
|
@@ -114,10 +121,11 @@ class AptStageArtifacts
|
|
114
121
|
|
115
122
|
# A manifest is a staging to-do list represented in JSON as an array of hashes
|
116
123
|
# containing:
|
117
|
-
# deb_file_path:
|
118
|
-
# codename:
|
119
|
-
# puppet_version:
|
120
|
-
#
|
124
|
+
# deb_file_path: relative path to the .deb file
|
125
|
+
# codename: debian codename for this artifact, needed by freight
|
126
|
+
# puppet_version: part of the destination apt repo. We maintain apt repos by puppet major
|
127
|
+
# version
|
128
|
+
# repo_type: either 'stable' or 'nightly' typically. 'archive' is supported but unused.
|
121
129
|
def generate_manifest
|
122
130
|
manifest = []
|
123
131
|
|
@@ -126,15 +134,8 @@ class AptStageArtifacts
|
|
126
134
|
|
127
135
|
repo_name = artifact_components[-2]
|
128
136
|
case repo_name
|
129
|
-
when /^puppet(\d+)-nightly$/
|
130
|
-
puppet_version = Regexp.last_match(1)
|
131
|
-
repo_type = 'nightly'
|
132
|
-
when /^puppet(\d+)-archive/
|
133
|
-
puppet_version = Regexp.last_match(1)
|
134
|
-
repo_type = 'archive'
|
135
137
|
when /^puppet(\d+)+$/
|
136
138
|
puppet_version = Regexp.last_match(1)
|
137
|
-
repo_type = 'stable'
|
138
139
|
else
|
139
140
|
fatal("Unknown repo name \"#{repo_name}\" in #{deb_file_path}")
|
140
141
|
end
|
@@ -148,7 +149,7 @@ class AptStageArtifacts
|
|
148
149
|
deb_file_path: deb_file_path,
|
149
150
|
puppet_version: puppet_version,
|
150
151
|
codename: codename,
|
151
|
-
repo_type: repo_type
|
152
|
+
repo_type: @repo_type
|
152
153
|
}
|
153
154
|
end
|
154
155
|
|
@@ -161,12 +162,14 @@ class AptStageArtifacts
|
|
161
162
|
|
162
163
|
# Create a tarball that contains the staging manifest and the associated deb files.
|
163
164
|
def create_tarball
|
165
|
+
manifest_file_name = AptStageArtifacts::MANIFEST_JSON_FILENAME
|
166
|
+
|
164
167
|
tarball_create_command = %W[
|
165
168
|
tar --create --gzip --file #{@local_tarball_path} --directory=#{@top_directory}
|
166
169
|
].join(' ')
|
167
|
-
%x(#{tarball_create_command} #{
|
170
|
+
%x(#{tarball_create_command} #{manifest_file_name} #{@debian_artifacts.join(' ')})
|
168
171
|
unless $CHILD_STATUS.success?
|
169
|
-
fatal "#{tarball_create_command} #{
|
172
|
+
fatal "#{tarball_create_command} #{manifest_file_name} #{@debian_artifacts.join(' ')} failed."
|
170
173
|
end
|
171
174
|
|
172
175
|
logger.info("'#{@local_tarball_path}' created.")
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'version'
|
2
|
+
require 'mixins/constants'
|
2
3
|
require 'mixins/logging'
|
3
4
|
|
4
5
|
require 'English'
|
@@ -86,6 +87,8 @@ class AptStageFromTarball
|
|
86
87
|
|
87
88
|
# Keep a hash, key by puppet_version, of repo_types so that we can
|
88
89
|
# efficiently build out the freight caches later.
|
90
|
+
puppet_version = artifact[:puppet_version]
|
91
|
+
repo_type = artifact[:repo_type]
|
89
92
|
@repo_types_updated[puppet_version] = [] unless @repo_types_updated.key?(puppet_version)
|
90
93
|
@repo_types_updated[puppet_version] |= [repo_type]
|
91
94
|
end
|
data/lib/mixins/constants.rb
CHANGED
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.6.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-06-
|
11
|
+
date: 2021-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|