Fix OpenSearch compatibility issue (#30278)
This commit is contained in:
		
							
								
								
									
										20
									
								
								.github/workflows/test-ruby.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								.github/workflows/test-ruby.yml
									
									
									
									
										vendored
									
									
								
							@@ -264,8 +264,8 @@ jobs:
 | 
				
			|||||||
        ports:
 | 
					        ports:
 | 
				
			||||||
          - 6379:6379
 | 
					          - 6379:6379
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      search:
 | 
					      elasticsearch:
 | 
				
			||||||
        image: ${{ matrix.search-image }}
 | 
					        image: ${{ contains(matrix.search-image, 'elasticsearch') && matrix.search-image || '' }}
 | 
				
			||||||
        env:
 | 
					        env:
 | 
				
			||||||
          discovery.type: single-node
 | 
					          discovery.type: single-node
 | 
				
			||||||
          xpack.security.enabled: false
 | 
					          xpack.security.enabled: false
 | 
				
			||||||
@@ -277,6 +277,20 @@ jobs:
 | 
				
			|||||||
        ports:
 | 
					        ports:
 | 
				
			||||||
          - 9200:9200
 | 
					          - 9200:9200
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      opensearch:
 | 
				
			||||||
 | 
					        image: ${{ contains(matrix.search-image, 'opensearch') && matrix.search-image || '' }}
 | 
				
			||||||
 | 
					        env:
 | 
				
			||||||
 | 
					          discovery.type: single-node
 | 
				
			||||||
 | 
					          DISABLE_INSTALL_DEMO_CONFIG: true
 | 
				
			||||||
 | 
					          DISABLE_SECURITY_PLUGIN: true
 | 
				
			||||||
 | 
					        options: >-
 | 
				
			||||||
 | 
					          --health-cmd "curl http://localhost:9200/_cluster/health"
 | 
				
			||||||
 | 
					          --health-interval 10s
 | 
				
			||||||
 | 
					          --health-timeout 5s
 | 
				
			||||||
 | 
					          --health-retries 10
 | 
				
			||||||
 | 
					        ports:
 | 
				
			||||||
 | 
					          - 9200:9200
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    env:
 | 
					    env:
 | 
				
			||||||
      DB_HOST: localhost
 | 
					      DB_HOST: localhost
 | 
				
			||||||
      DB_USER: postgres
 | 
					      DB_USER: postgres
 | 
				
			||||||
@@ -300,6 +314,8 @@ jobs:
 | 
				
			|||||||
        include:
 | 
					        include:
 | 
				
			||||||
          - ruby-version: '.ruby-version'
 | 
					          - ruby-version: '.ruby-version'
 | 
				
			||||||
            search-image: docker.elastic.co/elasticsearch/elasticsearch:8.10.2
 | 
					            search-image: docker.elastic.co/elasticsearch/elasticsearch:8.10.2
 | 
				
			||||||
 | 
					          - ruby-version: '.ruby-version'
 | 
				
			||||||
 | 
					            search-image: opensearchproject/opensearch:2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v4
 | 
					      - uses: actions/checkout@v4
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -40,6 +40,7 @@ require_relative '../lib/mastodon/rack_middleware'
 | 
				
			|||||||
require_relative '../lib/public_file_server_middleware'
 | 
					require_relative '../lib/public_file_server_middleware'
 | 
				
			||||||
require_relative '../lib/devise/strategies/two_factor_ldap_authenticatable'
 | 
					require_relative '../lib/devise/strategies/two_factor_ldap_authenticatable'
 | 
				
			||||||
require_relative '../lib/devise/strategies/two_factor_pam_authenticatable'
 | 
					require_relative '../lib/devise/strategies/two_factor_pam_authenticatable'
 | 
				
			||||||
 | 
					require_relative '../lib/elasticsearch/client_extensions'
 | 
				
			||||||
require_relative '../lib/chewy/settings_extensions'
 | 
					require_relative '../lib/chewy/settings_extensions'
 | 
				
			||||||
require_relative '../lib/chewy/index_extensions'
 | 
					require_relative '../lib/chewy/index_extensions'
 | 
				
			||||||
require_relative '../lib/chewy/strategy/mastodon'
 | 
					require_relative '../lib/chewy/strategy/mastodon'
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								lib/elasticsearch/client_extensions.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								lib/elasticsearch/client_extensions.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					# frozen_string_literal: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module Elasticsearch
 | 
				
			||||||
 | 
					  module ClientExtensions
 | 
				
			||||||
 | 
					    def verify_elasticsearch
 | 
				
			||||||
 | 
					      @verified = true
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Elasticsearch::Client.prepend(Elasticsearch::ClientExtensions)
 | 
				
			||||||
		Reference in New Issue
	
	Block a user