Skip to content

Commit 4ce9ac2

Browse files
committed
[CI] Updates pipeline, adds info task
1 parent 7bf3b88 commit 4ce9ac2

File tree

4 files changed

+73
-76
lines changed

4 files changed

+73
-76
lines changed

.buildkite/pipeline.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@ steps:
3737
DEBUG: true
3838
command: ./.buildkite/run-yaml-tests.sh
3939
artifact_paths: "elasticsearch-api/tmp/*"
40-
- wait: ~
41-
continue_on_failure: true
42-
- label: "Log Results"
43-
command: ./.buildkite/log-results.sh
44-
- label: ":elasticsearch: Serverless :rspec: API Tests :ruby:"
40+
- label: ":elasticsearch: Serverless :rspec: API Tests :ruby: {{ matrix.ruby_source }} - {{ matrix.ruby }}"
4541
agents:
4642
provider: "gcp"
4743
env:
@@ -61,4 +57,8 @@ steps:
6157
- with:
6258
ruby_source: 'jruby'
6359
ruby: '9.4'
64-
command: './.buildkite/run-serverless-tests.sh'
60+
command: ./.buildkite/run-serverless-tests.sh
61+
- wait: ~
62+
continue_on_failure: true
63+
- label: "Log Results"
64+
command: ./.buildkite/log-results.sh

.buildkite/run-client.sh

Lines changed: 0 additions & 70 deletions
This file was deleted.

.buildkite/run-serverless-tests.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Once called Elasticsearch should be up and running
4+
#
5+
script_path=$(dirname $(realpath -s $0))
6+
set -euo pipefail
7+
repo=`pwd`
8+
9+
export RUBY_VERSION=${RUBY_VERSION:-3.4}
10+
export TRANSPORT_VERSION=${TRANSPORT_VERSION:-8}
11+
12+
if [[ -z $EC_PROJECT_PREFIX ]]; then
13+
echo -e "\033[31;1mERROR:\033[0m Required environment variable [EC_PROJECT_PREFIX] not set\033[0m"
14+
exit 1
15+
fi
16+
17+
# Create a serverless project:
18+
source $script_path/create-serverless.sh
19+
# Make sure we remove projects:
20+
trap cleanup EXIT
21+
22+
echo "--- :ruby: Building Docker image"
23+
docker build \
24+
--file $script_path/Dockerfile \
25+
--tag elastic/elasticsearch-ruby \
26+
--build-arg RUBY_VERSION=$RUBY_VERSION \
27+
--build-arg TRANSPORT_VERSION=$TRANSPORT_VERSION \
28+
--build-arg RUBY_SOURCE=$RUBY_SOURCE \
29+
.
30+
31+
echo "--- :ruby: Running $TEST_SUITE tests"
32+
docker run \
33+
-e "ELASTIC_USER=elastic" \
34+
-e "BUILDKITE=true" \
35+
-e "QUIET=${QUIET}" \
36+
-e "TRANSPORT_VERSION=${TRANSPORT_VERSION}" \
37+
-e "ELASTICSEARCH_URL=${ELASTICSEARCH_URL}" \
38+
-e "API_KEY=${ES_API_SECRET_KEY}" \
39+
--volume $repo:/usr/src/app \
40+
--name elasticsearch-ruby \
41+
--rm \
42+
elastic/elasticsearch-ruby \
43+
bundle exec rake info

rake_tasks/serverless.rake

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
require 'elasticsearch'
18+
19+
desc 'Server info'
20+
task :info do
21+
client = Elasticsearch::Client.new(url: ENV['ELASTICSEARCH_URL'], api_key: ENV['API_KEY'])
22+
info = client.info
23+
puts "Connected to Elasticsearch cluster #{info['cluster_name']}"
24+
end

0 commit comments

Comments
 (0)