Skip to content

Commit 5379028

Browse files
inject VERSION_QUALIFIER into artifacts (#16904) (#17049) (#17064)
VERSION_QUALIFIER was already observed in rake artifacts task but only to influence the name of the artifact. This commit ensure that the qualifier is also displayed in the cli and in the http api. (cherry picked from commit 00f8b91) Co-authored-by: João Duarte <[email protected]>
1 parent d7bad3d commit 5379028

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

logstash-core-plugin-api/logstash-core-plugin-api.gemspec

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ if File.exist?(project_versions_yaml_path)
1212
# we ignore the copy in git and we overwrite an existing file
1313
# each time we build the logstash-core gem
1414
original_lines = IO.readlines(project_versions_yaml_path)
15-
original_lines << ""
15+
# introduce the version qualifier (e.g. beta1, rc1) into the copied yml so it's displayed by Logstash
16+
if ENV['VERSION_QUALIFIER']
17+
logstash_version_line = original_lines.find {|line| line.match(/^logstash:/) }
18+
logstash_version_line.chomp!
19+
logstash_version_line << "-#{ENV['VERSION_QUALIFIER']}\n"
20+
end
21+
original_lines << "\n"
1622
original_lines << "# This is a copy the project level versions.yml into this gem's root and it is created when the gemspec is evaluated."
1723
gem_versions_yaml_path = File.expand_path("./versions-gem-copy.yml", File.dirname(__FILE__))
1824
File.open(gem_versions_yaml_path, 'w') do |new_file|

logstash-core/lib/logstash/api/commands/default_metadata.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def host
6060
end
6161

6262
def version
63-
LOGSTASH_CORE_VERSION
63+
LOGSTASH_VERSION
6464
end
6565

6666
def http_address

logstash-core/logstash-core.gemspec

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ if File.exist?(project_versions_yaml_path)
1717
# we ignore the copy in git and we overwrite an existing file
1818
# each time we build the logstash-core gem
1919
original_lines = IO.readlines(project_versions_yaml_path)
20-
original_lines << ""
20+
# introduce the version qualifier (e.g. beta1, rc1) into the copied yml so it's displayed by Logstash
21+
if ENV['VERSION_QUALIFIER']
22+
logstash_version_line = original_lines.find {|line| line.match(/^logstash:/) }
23+
logstash_version_line.chomp!
24+
logstash_version_line << "-#{ENV['VERSION_QUALIFIER']}\n"
25+
end
26+
original_lines << "\n"
2127
original_lines << "# This is a copy the project level versions.yml into this gem's root and it is created when the gemspec is evaluated."
2228
gem_versions_yaml_path = File.expand_path("./versions-gem-copy.yml", File.dirname(__FILE__))
2329
File.open(gem_versions_yaml_path, 'w') do |new_file|

rakelib/artifacts.rake

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@
1818
namespace "artifact" do
1919
SNAPSHOT_BUILD = ENV["RELEASE"] != "1"
2020
VERSION_QUALIFIER = ENV["VERSION_QUALIFIER"]
21-
if VERSION_QUALIFIER
22-
PACKAGE_SUFFIX = SNAPSHOT_BUILD ? "-#{VERSION_QUALIFIER}-SNAPSHOT" : "-#{VERSION_QUALIFIER}"
23-
else
24-
PACKAGE_SUFFIX = SNAPSHOT_BUILD ? "-SNAPSHOT" : ""
25-
end
21+
LOCAL_ARTIFACTS = ENV["LOCAL_ARTIFACTS"] || "true"
22+
PACKAGE_SUFFIX = SNAPSHOT_BUILD ? "-SNAPSHOT" : ""
2623

2724
## TODO: Install new service files
2825
def package_files

0 commit comments

Comments
 (0)