Skip to content

Commit 62d96a5

Browse files
committed
[CI] Install qaf and run directly
1 parent f8f8b68 commit 62d96a5

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

.buildkite/create-serverless.sh

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,36 @@
22

33
set -euo pipefail
44

5-
export EC_REGISTER_BACKEND=buildkite
5+
export EC_REGISTER_BACKEND=local
66
export EC_ENV=qa
77
export EC_REGION=aws-eu-west-1
88
# Using BUILDKITE_JOB_ID for the name to make it unique:
99
export EC_PROJECT_NAME="$EC_PROJECT_PREFIX-$BUILDKITE_JOB_ID"
1010

1111
# fetch cloud creds used by qaf
1212
CLOUD_ACCESS_KEY=$(vault read -field="$EC_ENV" $CLOUD_CREDENTIALS_PATH)
13-
echo "{\"api_key\":{\"$EC_ENV\":\"$CLOUD_ACCESS_KEY\"}}" > "$(pwd)/cloud.json"
13+
mkdir ~/.elastic
14+
echo "{\"api_key\":{\"$EC_ENV\":\"$CLOUD_ACCESS_KEY\"}}" > "~/.elastic/cloud.json"
1415

1516
echo -e "--- Buildkite: ${BUILDKITE}"
1617

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-
}
18+
git clone https://github.com/elastic/qaf
19+
pushd qaf
20+
pip install -e .
21+
popd
3022

3123
# ensure serverless instance is deleted even if script errors
3224
cleanup() {
3325
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"
26+
qaf elastic-cloud projects delete
27+
rm -rf "~/.elastic/cloud.json"
3628
}
3729
trap cleanup EXIT
3830

3931
echo -e "--- :elasticsearch: Start serverless instance $EC_PROJECT_NAME"
4032

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")
33+
qaf elastic-cloud projects create --project-type elasticsearch
34+
deployment=$(qaf elastic-cloud projects describe $EC_PROJECT_NAME --as-json --show-credentials)
4335

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

0 commit comments

Comments
 (0)