Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumps main stack to 9.0.0-SNAPSHOT #2475

Merged
merged 6 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
env:
RUBY_VERSION: "{{ matrix.ruby }}"
TEST_SUITE: "{{ matrix.suite }}"
STACK_VERSION: 8.16.0-SNAPSHOT
STACK_VERSION: 9.0.0-SNAPSHOT
TRANSPORT_VERSION: "{{ matrix.transport }}"
RUBY_SOURCE: "{{ matrix.ruby_source }}"
QUIET: false
Expand Down Expand Up @@ -67,7 +67,7 @@ steps:
provider: "gcp"
env:
RUBY_VERSION: "3.3"
STACK_VERSION: 8.16.0-SNAPSHOT
STACK_VERSION: 9.0.0-SNAPSHOT
ES_YAML_TESTS_BRANCH: main
TRANSPORT_VERSION: "8.3"
RUBY_SOURCE: "ruby"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
sudo sysctl -w vm.max_map_count=262144
- uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 8.16.0-SNAPSHOT
stack-version: 9.0.0-SNAPSHOT
security-enabled: false
- uses: ruby/setup-ruby@v1
with:
Expand All @@ -40,4 +40,4 @@ jobs:
- name: elasticsearch
run: cd elasticsearch && bundle exec rake test:all
- name: elasticsearch-api
run: rake es:download_artifacts[8.16.0-SNAPSHOT] && cd elasticsearch-api && bundle exec rake test:spec test:platinum:unit
run: rake es:download_artifacts[9.0.0-SNAPSHOT] && cd elasticsearch-api && bundle exec rake test:spec test:platinum:unit
4 changes: 2 additions & 2 deletions .github/workflows/otel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
sudo sysctl -w vm.max_map_count=262144
- uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 8.16.0-SNAPSHOT
stack-version: 9.0.0-SNAPSHOT
security-enabled: false
- uses: ruby/setup-ruby@v1
with:
Expand All @@ -42,4 +42,4 @@ jobs:
- name: elasticsearch
run: cd elasticsearch && bundle exec rake test:all
- name: elasticsearch-api
run: rake es:download_artifacts[8.16.0-SNAPSHOT] && cd elasticsearch-api && bundle exec rake test:spec test:platinum:unit
run: rake es:download_artifacts[9.0.0-SNAPSHOT] && cd elasticsearch-api && bundle exec rake test:spec test:platinum:unit
11 changes: 3 additions & 8 deletions elasticsearch-api/elasticsearch-api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,10 @@ Gem::Specification.new do |s|
s.add_development_dependency 'yard'

# Gems for testing integrations
s.add_development_dependency 'jsonify'
s.add_development_dependency 'activesupport'
s.add_development_dependency 'hashie'
# Temporary support for Ruby 2.6, since it's EOL March 2022:
if RUBY_VERSION < '2.7.0'
s.add_development_dependency 'jbuilder', '< 7.0.0'
else
s.add_development_dependency 'activesupport'
s.add_development_dependency 'jbuilder'
end
s.add_development_dependency 'jbuilder'
s.add_development_dependency 'jsonify'

s.add_development_dependency 'cane'
s.add_development_dependency 'escape_utils' unless defined? JRUBY_VERSION
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch-api/lib/elasticsearch/api/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@

module Elasticsearch
module API
VERSION = '8.14.0'.freeze
VERSION = '9.0.0'.freeze
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
describe 'Perform request args' do
Elasticsearch::API::FilesHelper.files.each do |filepath|
spec = Elasticsearch::API::EndpointSpec.new(filepath)
next if spec.module_namespace.flatten.first == '_internal'
next if spec.module_namespace.flatten.first == '_internal' || spec.visibility != 'public'

# These are the path parts defined by the user in the method argument
defined_path_parts = spec.path_params.inject({}) do |params, part|
Expand Down
31 changes: 29 additions & 2 deletions elasticsearch-api/utils/thor/endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,38 @@ module API
class EndpointSpec
include EndpointSpecifics

# These APIs are private, but were added in 8.x since the generator didn't consider
# visibility. They will be removed in 9.x since we're using a different generator that
# considers visibility. But new private APIs code won't be generated for the client.
EXCLUDED_8X = [
'autoscaling.delete_autoscaling_policy', 'autoscaling.get_autoscaling_capacity',
'autoscaling.get_autoscaling_policy', 'autoscaling.put_autoscaling_policy', 'capabilities',
'connector.secret_delete', 'connector.secret_get', 'connector.secret_post',
'connector.secret_put', 'fleet.delete_secret', 'fleet.get_secret', 'fleet.post_secret',
'ml.validate', 'ml.validate_detector', 'monitoring.bulk', 'profiling.flamegraph',
'profiling.stacktraces', 'profiling.status', 'profiling.topn_functions',
'security.activate_user_profile', 'security.disable_user_profile',
'security.enable_user_profile', 'security.get_user_profile',
'security.has_privileges_user_profile', 'security.suggest_user_profiles',
'security.update_user_profile_data', 'shutdown.delete_node', 'shutdown.get_node',
'shutdown.put_node'
].freeze

def initialize(filepath)
@path = Pathname(filepath)
json = MultiJson.load(File.read(@path))
@spec = json.values.first
@endpoint_name = json.keys.first

full_namespace = parse_full_namespace
@namespace_depth = full_namespace.size > 0 ? full_namespace.size - 1 : 0
@namespace_depth = full_namespace.size.positive? ? full_namespace.size - 1 : 0
@module_namespace = full_namespace[0, @namespace_depth]
@method_name = full_namespace.last

@path_parts = parse_endpoint_parts(@spec)
@params = @spec['params'] || {}
@paths = @spec['url']['paths'].map { |b| b['path'] } if @spec['url']
@path_params = path_variables.flatten.uniq.collect(&:to_sym)
@path_params = path_variables.flatten.uniq.collect(&:to_sym)
@http_method = parse_http_method(@spec)
@deprecation_note = @spec['url']['paths'].last&.[]('deprecated')
@http_path = parse_http_path(@paths)
Expand Down Expand Up @@ -71,6 +88,16 @@ def stability
@spec['stability']
end

def visibility
@spec['visibility']
end

def skippable?
return true if module_namespace.flatten.first == '_internal'

visibility != 'public' && !EXCLUDED_8X.include?(endpoint_name)
end

# Function that adds the listified h param code
def specific_params
super(@module_namespace.first, @method_name)
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch-api/utils/thor/generate_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def generate_source
@spec = EndpointSpec.new(filepath)
say_status 'json', @spec.path, :yellow
# Don't generate code for internal APIs:
next if @spec.module_namespace.flatten.first == '_internal'
next if @spec.skippable?

path_to_file = output.join(@spec.module_namespace.join('/')).join("#{@spec.method_name}.rb")
dir = output.join(@spec.module_namespace.join('/'))
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/elasticsearch.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 2.5'

s.add_dependency 'elastic-transport', '~> 8.3'
s.add_dependency 'elasticsearch-api', '8.14.0'
s.add_dependency 'elasticsearch-api', '9.0.0'

s.add_development_dependency 'base64'
s.add_development_dependency 'bundler'
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/lib/elasticsearch/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
# under the License.

module Elasticsearch
VERSION = '8.14.0'.freeze
VERSION = '9.0.0'.freeze
end