Skip to content

Commit ef4721c

Browse files
committed
[CI] Install qaf and run directly
1 parent 6953001 commit ef4721c

File tree

2 files changed

+16
-33
lines changed

2 files changed

+16
-33
lines changed

.buildkite/create-serverless.sh

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,21 @@
22

33
set -euo pipefail
44

5-
export EC_REGISTER_BACKEND=buildkite
6-
export EC_ENV=qa
7-
export EC_REGION=aws-eu-west-1
85
# Using BUILDKITE_JOB_ID for the name to make it unique:
96
export EC_PROJECT_NAME="$EC_PROJECT_PREFIX-$BUILDKITE_JOB_ID"
107

11-
# fetch cloud creds used by qaf
12-
CLOUD_ACCESS_KEY=$(vault read -field="$EC_ENV" $CLOUD_CREDENTIALS_PATH)
13-
echo "{\"api_key\":{\"$EC_ENV\":\"$CLOUD_ACCESS_KEY\"}}" > "$(pwd)/cloud.json"
14-
15-
echo -e "--- Buildkite: ${BUILDKITE}"
16-
17-
run_qaf() {
18-
cmd=$1
19-
docker run --rm \
20-
-e EC_REGISTER_BACKEND \
21-
-e EC_ENV \
22-
-e EC_REGION \
23-
-e EC_PROJECT_NAME \
24-
-e VAULT_TOKEN \
25-
-e "BUILDKITE=${BUILDKITE}" \
26-
-v "$(pwd)/cloud.json:/root/.elastic/cloud.json" \
27-
docker.elastic.co/appex-qa/qaf:latest \
28-
bash -c "$cmd"
29-
}
30-
318
# ensure serverless instance is deleted even if script errors
329
cleanup() {
3310
echo -e "--- :elasticsearch: :broom::sparkles: Tear down serverless instance $EC_PROJECT_NAME"
34-
run_qaf 'qaf elastic-cloud projects delete'
35-
rm -rf "$(pwd)/cloud.json"
11+
qaf elastic-cloud projects delete
12+
rm -rf "~/.elastic/cloud.json"
3613
}
3714
trap cleanup EXIT
3815

3916
echo -e "--- :elasticsearch: Start serverless instance $EC_PROJECT_NAME"
4017

41-
run_qaf "qaf elastic-cloud projects create --project-type elasticsearch"
42-
deployment=$(run_qaf "qaf elastic-cloud projects describe $EC_PROJECT_NAME --as-json --show-credentials")
18+
qaf elastic-cloud projects create --project-type elasticsearch
19+
deployment=$(qaf elastic-cloud projects describe $EC_PROJECT_NAME --as-json --show-credentials)
4320

4421
# Set ELASTICSEARCH_URL and API_KEY variables
4522
export ES_API_SECRET_KEY=$(echo "$deployment" | jq -r '.credentials.api_key')

.buildkite/pipeline.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,31 @@ steps:
3939
artifact_paths: "elasticsearch-api/tmp/*"
4040
- label: ":elasticsearch: Serverless :rspec: API Tests :ruby: {{ matrix.ruby_source }} - {{ matrix.ruby }}"
4141
agents:
42-
provider: "gcp"
42+
image: docker.elastic.co/appex-qa/qaf:latest
4343
env:
4444
RUBY_VERSION: "{{ matrix.ruby }}"
45-
TEST_SUITE: 'serverless'
4645
RUBY_SOURCE: "{{ matrix.ruby_source }}"
46+
TEST_SUITE: serverless
4747
QUIET: false
48-
EC_PROJECT_PREFIX: 'ruby'
49-
CLOUD_CREDENTIALS_PATH: 'secret/ci/elastic-elasticsearch-ruby/cloud-access'
48+
EC_PROJECT_PREFIX: ruby
49+
EC_REGISTER_BACKEND: local
50+
EC_REGION: aws-eu-west-1
51+
EC_ENV: qa
5052
matrix:
5153
setup:
5254
ruby:
53-
- "3.4"
55+
- '3.4'
5456
ruby_source:
5557
- 'ruby'
5658
adjustments:
5759
- with:
5860
ruby_source: 'jruby'
5961
ruby: '9.4'
60-
command: ./.buildkite/run-serverless-tests.sh
62+
commands:
63+
- mkdir ~/.elastic
64+
- touch ~/.elastic/cloud.json
65+
- echo "{\"api_key\":{\"qa\":\"$(vault read -field=qa secret/ci/elastic-elasticsearch-ruby/cloud-access)\"}}" > ~/.elastic/cloud.json
66+
- ./.buildkite/run-serverless-tests.sh
6167
- wait: ~
6268
continue_on_failure: true
6369
- label: "Log Results"

0 commit comments

Comments
 (0)