kpm 0.12.4 → 0.13.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/README.adoc +10 -1
- data/lib/kpm/base_artifact.rb +2 -0
- data/lib/kpm/base_installer.rb +2 -2
- data/lib/kpm/killbill_server_artifact.rb +27 -25
- data/lib/kpm/nexus_helper/cloudsmith_api_calls.rb +1 -0
- data/lib/kpm/nexus_helper/github_api_calls.rb +2 -1
- data/lib/kpm/nexus_helper/maven_central_api_calls.rb +9 -2
- data/lib/kpm/nexus_helper/nexus_api_calls_v2.rb +17 -2
- data/lib/kpm/plugins_directory.yml +19 -11
- data/lib/kpm/tasks.rb +2 -2
- data/lib/kpm/version.rb +1 -1
- data/pom.xml +1 -1
- data/spec/kpm/remote/maven_central_api_calls_spec.rb +3 -3
- data/spec/kpm/unit/cloudsmith_api_calls_spec.rb +42 -0
- data/spec/kpm/unit/killbill_server_artifact_spec.rb +76 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 817fec3c9a504b781644074e6e66347b99002d91666001ee3df9111ae42cf83c
|
|
4
|
+
data.tar.gz: '02833765cd7d555f1c1545e058d1d29a9362a1b01c7d717b17cb323afd926315'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: db560939c990a15fa671ca9a8c5970203656df1cc5983bac099f8863fc91db21dada8195117e175e0340231aa819a2e5504dd91b8bf082def92e2b81c8b1b7b1
|
|
7
|
+
data.tar.gz: 9e4ba6daff0e1bedf4e4fa9b751e7ed9101f1c9c77487d17edb03b9ebcdebd72e48d6b50e8dbb35c23ea12ba007163df914a9e9a6c7c4d0279190669da60203d
|
data/README.adoc
CHANGED
|
@@ -93,10 +93,12 @@ You can download specific artifacts with the following commands:
|
|
|
93
93
|
* `kpm pull_kb_server_war <version>`: downloads the Kill Bill war
|
|
94
94
|
* `kpm install_java_plugin plugin-key <kb-version>`: downloads a Java plugin identified by `plugin-key`
|
|
95
95
|
* `kpm install_ruby_plugin plugin-key <kb-version>`: downloads a Ruby plugin identified by `plugin-key`
|
|
96
|
-
* `kpm pull_defaultbundles <kb-version>`: downloads the default Kill Bill OSGI bundles
|
|
96
|
+
* `kpm pull_defaultbundles <kb-version>`: downloads the default Kill Bill OSGI bundles. If `kb-version` isn't specified, the latest `killbill` version of the repository is used to find the matching `killbill-platform` version
|
|
97
97
|
|
|
98
98
|
This is especially useful when scripting deployments.
|
|
99
99
|
|
|
100
|
+
About `pull_defaultbundles`: the bundles version comes from the `killbill-platform` property of `killbill-oss-parent`, which is the source of truth for the versions used by a Kill Bill release. When no `kb-version` is given, KPM reads the `killbill` pom of the latest `killbill` version of the repository (resolved through its `maven-metadata.xml`) and uses the `killbill-oss-parent` it declares. If the repository doesn't host that pom (e.g. `com.kill-bill` vs `org.kill-bill` groupId mismatch), the latest `killbill-oss-parent` of the repository is used instead.
|
|
101
|
+
|
|
100
102
|
Note: previous plugin versions aren't cleaned up by default to facilitate rollbacks. If your deployment is stateful, unused, old plugin versions will slow the Kill Bill startup time. To cleanup these entries, use `kpm cleanup` which will delete all non-default plugin versions, or `kpm uninstall`.
|
|
101
103
|
|
|
102
104
|
[[kpm-uninstall]]
|
|
@@ -265,3 +267,10 @@ kpm pull_kb_server_war 0.22.21-SNAPSHOT \
|
|
|
265
267
|
....
|
|
266
268
|
|
|
267
269
|
Replace `TOKEN` with a Cloudsmith entitlement token, and specify the right `ORG` and `REPO`.
|
|
270
|
+
|
|
271
|
+
When no version is specified, `LATEST` is resolved from the artifact's `maven-metadata.xml`. For example, to download the default OSGI bundles matching the latest `killbill` version:
|
|
272
|
+
|
|
273
|
+
....
|
|
274
|
+
kpm pull_defaultbundles \
|
|
275
|
+
--overrides url:https://dl.cloudsmith.io/<TOKEN>/<ORG>/<REPO>/maven
|
|
276
|
+
....
|
data/lib/kpm/base_artifact.rb
CHANGED
|
@@ -22,6 +22,8 @@ module KPM
|
|
|
22
22
|
KILLPAY_CLASSIFIER = nil
|
|
23
23
|
|
|
24
24
|
KILLBILL_JAVA_PLUGIN_GROUP_ID = 'org.kill-bill.billing.plugin.java'
|
|
25
|
+
# Group ids for which the plugin key does not need a user namespace (e.g. namespace:key)
|
|
26
|
+
KILLBILL_JAVA_PLUGIN_GROUP_IDS = [KILLBILL_JAVA_PLUGIN_GROUP_ID, 'com.kill-bill.billing.plugin.java'].freeze
|
|
25
27
|
KILLBILL_JAVA_PLUGIN_PACKAGING = 'jar'
|
|
26
28
|
KILLBILL_JAVA_PLUGIN_CLASSIFIER = nil
|
|
27
29
|
|
data/lib/kpm/base_installer.rb
CHANGED
|
@@ -91,9 +91,9 @@ module KPM
|
|
|
91
91
|
validate_installation_arg!(plugin_key, 'type', specified_type, looked_up_type)
|
|
92
92
|
validate_installation_arg!(plugin_key, 'classifier', specified_classifier, looked_up_classifier)
|
|
93
93
|
|
|
94
|
-
# If there is no entry in plugins_directory.yml and the group_id is not the killbill default
|
|
94
|
+
# If there is no entry in plugins_directory.yml and the group_id is not one of the killbill default group_ids, the key provided must be a user key and must have a namespace
|
|
95
95
|
if looked_up_artifact_id.nil? &&
|
|
96
|
-
|
|
96
|
+
!KPM::BaseArtifact::KILLBILL_JAVA_PLUGIN_GROUP_IDS.include?(specified_group_id) &&
|
|
97
97
|
plugin_key.split(':').size == 1
|
|
98
98
|
raise ArgumentError, "Aborting installation: pluginKey = #{plugin_key} does not exist in plugin_directory.yml so format of the key must have a user namespace (e.g namespace:key)"
|
|
99
99
|
end
|
|
@@ -21,36 +21,22 @@ module KPM
|
|
|
21
21
|
# Initialize as early as possible (used in rescue block below)
|
|
22
22
|
sha1_checker = sha1_file ? Sha1Checker.from_file(sha1_file) : nil
|
|
23
23
|
|
|
24
|
-
version = KPM::Installer.get_kb_latest_stable_version if version == 'LATEST'
|
|
25
|
-
|
|
26
24
|
versions = {}
|
|
27
25
|
Dir.mktmpdir do |dir|
|
|
28
|
-
|
|
29
|
-
kb_pom_info = pull(logger,
|
|
30
|
-
KPM::BaseArtifact::KILLBILL_GROUP_ID,
|
|
31
|
-
'killbill',
|
|
32
|
-
'pom',
|
|
33
|
-
nil,
|
|
34
|
-
version,
|
|
35
|
-
dir,
|
|
36
|
-
sha1_file,
|
|
37
|
-
force_download,
|
|
38
|
-
verify_sha1,
|
|
39
|
-
overrides,
|
|
40
|
-
ssl_verify)
|
|
26
|
+
oss_parent_version = 'LATEST'
|
|
41
27
|
|
|
42
|
-
#
|
|
43
|
-
|
|
28
|
+
# killbill-oss-parent is the source of truth for the versions: use the one declared by the Kill Bill release.
|
|
29
|
+
# For LATEST, the repository may not host the Kill Bill pom (e.g. different groupId): use the latest killbill-oss-parent instead.
|
|
30
|
+
kb_pom = nil
|
|
44
31
|
begin
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
32
|
+
kb_pom = pull_killbill_pom(logger, dir, version, sha1_file, force_download, verify_sha1, overrides, ssl_verify)
|
|
33
|
+
rescue KPM::NexusFacade::ArtifactNotFoundException
|
|
34
|
+
raise unless version == 'LATEST'
|
|
35
|
+
end
|
|
36
|
+
if kb_pom
|
|
37
|
+
oss_parent_version = kb_pom[:parent_version]
|
|
38
|
+
versions['killbill'] = kb_pom[:version]
|
|
51
39
|
end
|
|
52
|
-
versions['killbill'] = kb_version
|
|
53
|
-
versions['killbill-oss-parent'] = oss_parent_version
|
|
54
40
|
|
|
55
41
|
# Retrieve the killbill-oss-parent pom
|
|
56
42
|
oss_pom_info = pull(logger,
|
|
@@ -68,6 +54,7 @@ module KPM
|
|
|
68
54
|
file = File.new(oss_pom_info[:file_path])
|
|
69
55
|
begin
|
|
70
56
|
pom = REXML::Document.new(file)
|
|
57
|
+
versions['killbill-oss-parent'] = pom.root.elements['version']&.text || oss_parent_version
|
|
71
58
|
properties_element = pom.root.elements['properties']
|
|
72
59
|
%w[killbill-api killbill-plugin-api killbill-commons killbill-platform].each do |property|
|
|
73
60
|
versions[property] = properties_element.elements["#{property}.version"].text
|
|
@@ -87,6 +74,21 @@ module KPM
|
|
|
87
74
|
# Use the cache
|
|
88
75
|
cached_version
|
|
89
76
|
end
|
|
77
|
+
|
|
78
|
+
private
|
|
79
|
+
|
|
80
|
+
# Retrieve the main Kill Bill pom and extract its version and the killbill-oss-parent version it declares
|
|
81
|
+
def pull_killbill_pom(logger, dir, version, sha1_file, force_download, verify_sha1, overrides, ssl_verify)
|
|
82
|
+
pom_info = pull(logger, KPM::BaseArtifact::KILLBILL_GROUP_ID, 'killbill', 'pom', nil, version, dir, sha1_file, force_download, verify_sha1, overrides, ssl_verify)
|
|
83
|
+
file = File.new(pom_info[:file_path])
|
|
84
|
+
begin
|
|
85
|
+
pom = REXML::Document.new(file)
|
|
86
|
+
{ version: pom.root.elements['version'].text, parent_version: pom.root.elements['parent/version'].text }
|
|
87
|
+
ensure
|
|
88
|
+
file.close
|
|
89
|
+
FileUtils.rm_f(pom_info[:file_path])
|
|
90
|
+
end
|
|
91
|
+
end
|
|
90
92
|
end
|
|
91
93
|
end
|
|
92
94
|
end
|
|
@@ -31,6 +31,7 @@ module KPM
|
|
|
31
31
|
|
|
32
32
|
alias parent_get_artifact_info get_artifact_info
|
|
33
33
|
def get_artifact_info(coordinates)
|
|
34
|
+
coordinates = resolve_latest(coordinates)
|
|
34
35
|
_, versioned_artifact, coords = build_base_path_and_coords(coordinates)
|
|
35
36
|
sha1 = get_sha1(coordinates)
|
|
36
37
|
"<artifact-resolution>
|
|
@@ -4,6 +4,7 @@ require 'net/http'
|
|
|
4
4
|
require 'uri'
|
|
5
5
|
require 'json'
|
|
6
6
|
require 'rexml/document'
|
|
7
|
+
require 'cgi'
|
|
7
8
|
|
|
8
9
|
module KPM
|
|
9
10
|
module NexusFacade
|
|
@@ -35,7 +36,13 @@ module KPM
|
|
|
35
36
|
url = "#{SEARCH_API}?#{query}"
|
|
36
37
|
|
|
37
38
|
response = Net::HTTP.get_response(URI(url))
|
|
38
|
-
|
|
39
|
+
|
|
40
|
+
unless response.code.to_i == 200
|
|
41
|
+
puts "Search URL: #{url}"
|
|
42
|
+
puts "Response Code: #{response.code}"
|
|
43
|
+
puts "Response Body: #{response.body}"
|
|
44
|
+
raise "Search failed: #{response.code}"
|
|
45
|
+
end
|
|
39
46
|
|
|
40
47
|
json = JSON.parse(response.body)
|
|
41
48
|
docs = json['response']['docs']
|
|
@@ -198,7 +205,7 @@ module KPM
|
|
|
198
205
|
get_response_with_retries(nil, location, nil)
|
|
199
206
|
end
|
|
200
207
|
when '404'
|
|
201
|
-
raise
|
|
208
|
+
raise ArtifactNotFoundException, ERROR_MESSAGE_404
|
|
202
209
|
else
|
|
203
210
|
raise UnexpectedStatusCodeException, response.code
|
|
204
211
|
end
|
|
@@ -25,6 +25,9 @@ module KPM
|
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
class ArtifactNotFoundException < StandardError
|
|
29
|
+
end
|
|
30
|
+
|
|
28
31
|
# This is an extract and slim down of functions needed from nexus_cli to maintain the response expected by the base_artifact.
|
|
29
32
|
class NexusApiCallsV2
|
|
30
33
|
READ_TIMEOUT_DEFAULT = 60
|
|
@@ -51,7 +54,7 @@ module KPM
|
|
|
51
54
|
logger.debug "response body: #{response.body}"
|
|
52
55
|
response.body
|
|
53
56
|
when '404'
|
|
54
|
-
raise
|
|
57
|
+
raise ArtifactNotFoundException, ERROR_MESSAGE_404
|
|
55
58
|
else
|
|
56
59
|
raise UnexpectedStatusCodeException, response.code
|
|
57
60
|
end
|
|
@@ -105,6 +108,18 @@ module KPM
|
|
|
105
108
|
|
|
106
109
|
private
|
|
107
110
|
|
|
111
|
+
# Repositories without a resolve API (Cloudsmith, GitHub Packages): use the artifact level maven-metadata.xml to find the latest version
|
|
112
|
+
def resolve_latest(coordinates)
|
|
113
|
+
base_path, _, coords = build_base_path_and_coords(coordinates)
|
|
114
|
+
return coordinates unless coords[:version].casecmp('latest').zero?
|
|
115
|
+
|
|
116
|
+
metadata = REXML::Document.new(get_response_with_retries(nil, "#{base_path}/maven-metadata.xml", nil))
|
|
117
|
+
latest_version = metadata.elements['//versioning/release']&.text || metadata.elements['//versioning/latest']&.text
|
|
118
|
+
raise ArtifactNotFoundException, "Unable to find the latest version of #{coords[:group_id]}:#{coords[:artifact_id]}" if latest_version.nil? || latest_version.empty?
|
|
119
|
+
|
|
120
|
+
coordinates.sub(/[^:]+\z/, latest_version)
|
|
121
|
+
end
|
|
122
|
+
|
|
108
123
|
def parse_coordinates(coordinates)
|
|
109
124
|
raise ArtifactMalformedException if coordinates.nil?
|
|
110
125
|
|
|
@@ -159,7 +174,7 @@ module KPM
|
|
|
159
174
|
get_response_with_retries(nil, location, nil)
|
|
160
175
|
end
|
|
161
176
|
when '404'
|
|
162
|
-
raise
|
|
177
|
+
raise ArtifactNotFoundException, ERROR_MESSAGE_404
|
|
163
178
|
else
|
|
164
179
|
raise UnexpectedStatusCodeException, response.code
|
|
165
180
|
end
|
|
@@ -9,21 +9,21 @@
|
|
|
9
9
|
:0.18: 0.5.26
|
|
10
10
|
:0.20: 0.7.0
|
|
11
11
|
:0.22: 0.9.0
|
|
12
|
-
:0.24: 0.10.
|
|
12
|
+
:0.24: 0.10.1
|
|
13
13
|
:analytics:
|
|
14
14
|
:type: :java
|
|
15
15
|
:versions:
|
|
16
16
|
:0.18: 4.2.5
|
|
17
17
|
:0.20: 6.0.1
|
|
18
18
|
:0.22: 7.2.7
|
|
19
|
-
:0.24: 8.1.
|
|
19
|
+
:0.24: 8.1.4
|
|
20
20
|
:avatax:
|
|
21
21
|
:type: :java
|
|
22
22
|
:versions:
|
|
23
23
|
:0.18: 0.4.1
|
|
24
24
|
:0.20: 0.6.1
|
|
25
25
|
:0.22: 0.8.4
|
|
26
|
-
:0.24: 0.9.
|
|
26
|
+
:0.24: 0.9.3
|
|
27
27
|
:cybersource:
|
|
28
28
|
:type: :ruby
|
|
29
29
|
:versions:
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
:type: :java
|
|
33
33
|
:versions:
|
|
34
34
|
:0.22: 0.0.2
|
|
35
|
-
:0.24: 0.1.
|
|
35
|
+
:0.24: 0.1.1
|
|
36
36
|
:dwolla:
|
|
37
37
|
:type: :java
|
|
38
38
|
:versions:
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
:0.18: 0.3.1
|
|
45
45
|
:0.20: 0.5.1
|
|
46
46
|
:0.22: 0.7.2
|
|
47
|
-
:0.24: 0.8.
|
|
47
|
+
:0.24: 0.8.2
|
|
48
48
|
:forte:
|
|
49
49
|
:type: :java
|
|
50
50
|
:versions:
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
:artifact_id: payment-test-plugin
|
|
80
80
|
:versions:
|
|
81
81
|
:0.22: 7.0.4
|
|
82
|
-
:0.24: 8.0.
|
|
82
|
+
:0.24: 8.0.1
|
|
83
83
|
:securenet:
|
|
84
84
|
:type: :ruby
|
|
85
85
|
:versions:
|
|
@@ -88,19 +88,19 @@
|
|
|
88
88
|
:type: :java
|
|
89
89
|
:versions:
|
|
90
90
|
:0.22: 7.3.3
|
|
91
|
-
:0.24: 8.0.
|
|
91
|
+
:0.24: 8.0.3
|
|
92
92
|
:braintree:
|
|
93
93
|
:type: :java
|
|
94
94
|
:versions:
|
|
95
|
-
:0.24: 1.0.
|
|
95
|
+
:0.24: 1.0.3
|
|
96
96
|
:catalog-test:
|
|
97
97
|
:type: :java
|
|
98
98
|
:versions:
|
|
99
|
-
:0.24: 0.5.
|
|
99
|
+
:0.24: 0.5.2
|
|
100
100
|
:gocardless:
|
|
101
101
|
:type: :java
|
|
102
102
|
:versions:
|
|
103
|
-
:0.24: 1.0.
|
|
103
|
+
:0.24: 1.0.2
|
|
104
104
|
:qualpay:
|
|
105
105
|
:type: :java
|
|
106
106
|
:versions:
|
|
@@ -109,4 +109,12 @@
|
|
|
109
109
|
:invgrp:
|
|
110
110
|
:type: :java
|
|
111
111
|
:versions:
|
|
112
|
-
:0.24: 1.0.
|
|
112
|
+
:0.24: 1.0.8
|
|
113
|
+
:vertex:
|
|
114
|
+
:type: :java
|
|
115
|
+
:versions:
|
|
116
|
+
:0.24: 0.2.1
|
|
117
|
+
:kintsugi:
|
|
118
|
+
:type: :java
|
|
119
|
+
:versions:
|
|
120
|
+
:0.24: 0.1.5
|
data/lib/kpm/tasks.rb
CHANGED
|
@@ -347,9 +347,9 @@ module KPM
|
|
|
347
347
|
options[:overrides],
|
|
348
348
|
options[:ssl_verify])
|
|
349
349
|
resolved_kb_version = versions_info['killbill']
|
|
350
|
-
kb_version = resolved_kb_version.split('.').slice(0, 2).join('.')
|
|
350
|
+
kb_version = resolved_kb_version ? resolved_kb_version.split('.').slice(0, 2).join('.') : nil
|
|
351
351
|
|
|
352
|
-
plugins_info = KPM::PluginsDirectory.list_plugins(true, kb_version)
|
|
352
|
+
plugins_info = kb_version ? KPM::PluginsDirectory.list_plugins(true, kb_version) : {}
|
|
353
353
|
|
|
354
354
|
if options[:as_json]
|
|
355
355
|
puts({ 'killbill' => versions_info, 'plugins' => plugins_info }.to_json)
|
data/lib/kpm/version.rb
CHANGED
data/pom.xml
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<modelVersion>4.0.0</modelVersion>
|
|
23
23
|
<groupId>org.kill-bill.billing.installer</groupId>
|
|
24
24
|
<artifactId>kpm</artifactId>
|
|
25
|
-
<version>0.
|
|
25
|
+
<version>0.13.0</version>
|
|
26
26
|
<packaging>pom</packaging>
|
|
27
27
|
<name>KPM</name>
|
|
28
28
|
<description>KPM: the Kill Bill Package Manager</description>
|
|
@@ -9,7 +9,7 @@ describe KPM::NexusFacade do
|
|
|
9
9
|
logger.level = Logger::DEBUG
|
|
10
10
|
logger
|
|
11
11
|
end
|
|
12
|
-
let(:test_version) { '0.24.
|
|
12
|
+
let(:test_version) { '0.24.16' }
|
|
13
13
|
let(:coordinates_map) do
|
|
14
14
|
{ version: test_version,
|
|
15
15
|
group_id: 'org.kill-bill.billing',
|
|
@@ -38,7 +38,7 @@ describe KPM::NexusFacade do
|
|
|
38
38
|
parsed_pom = REXML::Document.new(File.read(destination))
|
|
39
39
|
expect(parsed_pom.elements['//groupId'].text).to eq('org.kill-bill.billing')
|
|
40
40
|
expect(parsed_pom.elements['//artifactId'].text).to eq('killbill-oss-parent')
|
|
41
|
-
expect(parsed_pom.elements['//version'].text).to eq('0.146.
|
|
41
|
+
expect(parsed_pom.elements['//version'].text).to eq('0.146.67')
|
|
42
42
|
}
|
|
43
43
|
end
|
|
44
44
|
|
|
@@ -63,7 +63,7 @@ describe KPM::NexusFacade do
|
|
|
63
63
|
parsed_doc = REXML::Document.new(response)
|
|
64
64
|
expect(parsed_doc.elements['//groupId'].text).to eq('org.kill-bill.billing')
|
|
65
65
|
expect(parsed_doc.elements['//artifactId'].text).to eq('killbill')
|
|
66
|
-
expect(parsed_doc.elements['//version'].text).to
|
|
66
|
+
expect(parsed_doc.elements['//version'].text).to match(/\A\d+\.\d+\.\d+\z/)
|
|
67
67
|
end
|
|
68
68
|
end
|
|
69
69
|
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe KPM::NexusFacade::CloudsmithApiCalls do
|
|
6
|
+
let(:logger) { ::Logger.new(nil) }
|
|
7
|
+
let(:nexus_remote) { described_class.new({ url: 'https://dl.cloudsmith.io/token/org/repo/maven' }, true, logger) }
|
|
8
|
+
let(:metadata) do
|
|
9
|
+
'<metadata><versioning><latest>0.147.37-SNAPSHOT</latest><release>0.147.36</release></versioning></metadata>'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe '#get_artifact_info' do
|
|
13
|
+
it 'resolves LATEST from the artifact maven-metadata.xml' do
|
|
14
|
+
requested = []
|
|
15
|
+
allow(nexus_remote).to receive(:get_response_with_retries) do |_coordinates, endpoint, _params|
|
|
16
|
+
requested << endpoint
|
|
17
|
+
endpoint.end_with?('maven-metadata.xml') ? metadata : 'sha1-value'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
info = REXML::Document.new(nexus_remote.get_artifact_info('org.kill-bill.billing:killbill-oss-parent:pom:LATEST'))
|
|
21
|
+
|
|
22
|
+
expect(info.elements['//version'].text).to eq '0.147.36'
|
|
23
|
+
expect(info.elements['//sha1'].text).to eq 'sha1-value'
|
|
24
|
+
expect(requested.first).to eq '/token/org/repo/maven/org/kill-bill/billing/killbill-oss-parent/maven-metadata.xml'
|
|
25
|
+
expect(requested.last).to eq '/token/org/repo/maven/org/kill-bill/billing/killbill-oss-parent/0.147.36/killbill-oss-parent-0.147.36.pom.sha1'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'does not look up the metadata when the version is specified' do
|
|
29
|
+
allow(nexus_remote).to receive(:get_response_with_retries).and_return('sha1-value')
|
|
30
|
+
|
|
31
|
+
nexus_remote.get_artifact_info('org.kill-bill.billing:killbill-oss-parent:pom:0.147.36')
|
|
32
|
+
|
|
33
|
+
expect(nexus_remote).to have_received(:get_response_with_retries).once
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'fails when the metadata has no version' do
|
|
37
|
+
allow(nexus_remote).to receive(:get_response_with_retries).and_return('<metadata><versioning/></metadata>')
|
|
38
|
+
|
|
39
|
+
expect { nexus_remote.get_artifact_info('org.kill-bill.billing:killbill-oss-parent:pom:LATEST') }.to raise_error(KPM::NexusFacade::ArtifactNotFoundException, /Unable to find the latest version/)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe KPM::KillbillServerArtifact do
|
|
6
|
+
describe '.info' do
|
|
7
|
+
let(:oss_parent_pom) do
|
|
8
|
+
properties = %w[killbill-api killbill-plugin-api killbill-commons killbill-platform].map { |p| "<#{p}.version>0.42.4</#{p}.version>" }.join
|
|
9
|
+
"<project><version>0.147.36</version><properties>#{properties}</properties></project>"
|
|
10
|
+
end
|
|
11
|
+
let(:killbill_pom) { '<project><parent><version>0.147.30</version></parent><version>0.25.6</version></project>' }
|
|
12
|
+
|
|
13
|
+
# Fake the repository: record what is pulled and write the matching pom
|
|
14
|
+
def stub_pull
|
|
15
|
+
pulled = []
|
|
16
|
+
allow(described_class).to receive(:pull) do |_logger, _group_id, artifact_id, _packaging, _classifier, version, dir, *_|
|
|
17
|
+
pulled << [artifact_id, version]
|
|
18
|
+
file_path = File.join(dir, "#{artifact_id}.pom")
|
|
19
|
+
File.write(file_path, artifact_id == 'killbill' ? killbill_pom : oss_parent_pom)
|
|
20
|
+
{ file_path: file_path }
|
|
21
|
+
end
|
|
22
|
+
pulled
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'uses the killbill-oss-parent declared by the latest Kill Bill when no version is specified' do
|
|
26
|
+
pulled = stub_pull
|
|
27
|
+
|
|
28
|
+
info = described_class.info('LATEST')
|
|
29
|
+
|
|
30
|
+
expect(pulled).to eq [%w[killbill LATEST], %w[killbill-oss-parent 0.147.30]]
|
|
31
|
+
expect(info['killbill']).to eq '0.25.6'
|
|
32
|
+
expect(info['killbill-platform']).to eq '0.42.4'
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'falls back to the latest killbill-oss-parent when the latest Kill Bill pom is not hosted' do
|
|
36
|
+
pulled = []
|
|
37
|
+
allow(described_class).to receive(:pull) do |_logger, _group_id, artifact_id, _packaging, _classifier, version, dir, *_|
|
|
38
|
+
pulled << [artifact_id, version]
|
|
39
|
+
raise KPM::NexusFacade::ArtifactNotFoundException, 'not found' if artifact_id == 'killbill'
|
|
40
|
+
|
|
41
|
+
file_path = File.join(dir, "#{artifact_id}.pom")
|
|
42
|
+
File.write(file_path, oss_parent_pom)
|
|
43
|
+
{ file_path: file_path }
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
info = described_class.info('LATEST')
|
|
47
|
+
|
|
48
|
+
expect(pulled).to eq [%w[killbill LATEST], %w[killbill-oss-parent LATEST]]
|
|
49
|
+
expect(info['killbill']).to be_nil
|
|
50
|
+
expect(info['killbill-oss-parent']).to eq '0.147.36'
|
|
51
|
+
expect(info['killbill-platform']).to eq '0.42.4'
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it 'does not hide other errors when resolving the latest Kill Bill pom' do
|
|
55
|
+
allow(described_class).to receive(:pull).and_raise(KPM::ArtifactCorruptedException, 'bad checksum')
|
|
56
|
+
|
|
57
|
+
expect { described_class.info('LATEST') }.to raise_error(KPM::ArtifactCorruptedException)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it 'does not hide the error when the specified Kill Bill pom is not hosted' do
|
|
61
|
+
allow(described_class).to receive(:pull).and_raise(KPM::NexusFacade::ArtifactNotFoundException, 'not found')
|
|
62
|
+
|
|
63
|
+
expect { described_class.info('2026.11.13') }.to raise_error(KPM::NexusFacade::ArtifactNotFoundException, 'not found')
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'uses the killbill-oss-parent of the specified Kill Bill version' do
|
|
67
|
+
pulled = stub_pull
|
|
68
|
+
|
|
69
|
+
info = described_class.info('0.25.6')
|
|
70
|
+
|
|
71
|
+
expect(pulled).to eq [%w[killbill 0.25.6], %w[killbill-oss-parent 0.147.30]]
|
|
72
|
+
expect(info['killbill']).to eq '0.25.6'
|
|
73
|
+
expect(info['killbill-platform']).to eq '0.42.4'
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kpm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kill Bill core team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-11-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: highline
|
|
@@ -215,12 +215,14 @@ files:
|
|
|
215
215
|
- spec/kpm/remote/tenant_config_spec.yml
|
|
216
216
|
- spec/kpm/unit/actions_spec.rb
|
|
217
217
|
- spec/kpm/unit/base_artifact_spec.rb
|
|
218
|
+
- spec/kpm/unit/cloudsmith_api_calls_spec.rb
|
|
218
219
|
- spec/kpm/unit/cpu_information_spec.rb
|
|
219
220
|
- spec/kpm/unit/disk_space_information_spec.rb
|
|
220
221
|
- spec/kpm/unit/entropy_information_spec.rb
|
|
221
222
|
- spec/kpm/unit/formatter_spec.rb
|
|
222
223
|
- spec/kpm/unit/inspector_spec.rb
|
|
223
224
|
- spec/kpm/unit/installer_spec.rb
|
|
225
|
+
- spec/kpm/unit/killbill_server_artifact_spec.rb
|
|
224
226
|
- spec/kpm/unit/memory_information_spec.rb
|
|
225
227
|
- spec/kpm/unit/os_information_spec.rb
|
|
226
228
|
- spec/kpm/unit/plugins_directory_spec.rb
|