Skip to content

Commit

Permalink
Don't honor VERSION_QUALIFIER if set but empty (#17032)
Browse files Browse the repository at this point in the history
PR #17006 revealed that the `VERSION_QUALIFIER` env var gets honored in
various scripts when present but empty.
This shouldn't be the case as the DRA process is designed to gracefully
ignore empty values for this variable.

This commit changes various ruby scripts to not treat "" as truthy.
Bash scripts (used by CI etc.) are already ok with this as part of
refactorings done in #16907.

---------

Co-authored-by: Andrea Selva <[email protected]>
  • Loading branch information
dliappis and andsel authored Feb 7, 2025
1 parent e23da79 commit c7204fd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion logstash-core-plugin-api/logstash-core-plugin-api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if File.exist?(project_versions_yaml_path)
# each time we build the logstash-core gem
original_lines = IO.readlines(project_versions_yaml_path)
# introduce the version qualifier (e.g. beta1, rc1) into the copied yml so it's displayed by Logstash
if ENV['VERSION_QUALIFIER']
unless ENV['VERSION_QUALIFIER'].to_s.strip.empty?
logstash_version_line = original_lines.find {|line| line.match(/^logstash:/) }
logstash_version_line.chomp!
logstash_version_line << "-#{ENV['VERSION_QUALIFIER']}\n"
Expand Down
2 changes: 1 addition & 1 deletion logstash-core/logstash-core.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if File.exist?(project_versions_yaml_path)
# each time we build the logstash-core gem
original_lines = IO.readlines(project_versions_yaml_path)
# introduce the version qualifier (e.g. beta1, rc1) into the copied yml so it's displayed by Logstash
if ENV['VERSION_QUALIFIER']
unless ENV['VERSION_QUALIFIER'].to_s.strip.empty?
logstash_version_line = original_lines.find {|line| line.match(/^logstash:/) }
logstash_version_line.chomp!
logstash_version_line << "-#{ENV['VERSION_QUALIFIER']}\n"
Expand Down
2 changes: 1 addition & 1 deletion qa/docker/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def version
end

def qualified_version
qualifier = ENV['VERSION_QUALIFIER']
qualifier = ENV['VERSION_QUALIFIER'].to_s.strip.empty? ? nil : ENV['VERSION_QUALIFIER']
qualified_version = qualifier ? [version, qualifier].join("-") : version
ENV["RELEASE"] == "1" ? qualified_version : [qualified_version, "SNAPSHOT"].join("-")
end
Expand Down
2 changes: 1 addition & 1 deletion rakelib/artifacts.rake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace "artifact" do
SNAPSHOT_BUILD = ENV["RELEASE"] != "1"
VERSION_QUALIFIER = ENV["VERSION_QUALIFIER"]
VERSION_QUALIFIER = ENV["VERSION_QUALIFIER"].to_s.strip.empty? ? nil : ENV["VERSION_QUALIFIER"]
LOCAL_ARTIFACTS = ENV["LOCAL_ARTIFACTS"] || "true"
PACKAGE_SUFFIX = SNAPSHOT_BUILD ? "-SNAPSHOT" : ""

Expand Down

0 comments on commit c7204fd

Please sign in to comment.