Skip to content

Commit 05506f5

Browse files
authored
ci: improve astradb setup (#329)
1 parent ea9e94b commit 05506f5

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

.github/actions/setup-astra-db/action.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,33 @@ runs:
3434
env:
3535
TERM: linux
3636
run: |
37-
set -x
37+
set -e
3838
(curl -Ls "https://dtsx.io/get-astra-cli" | bash) || true
39-
/home/runner/.astra/cli/astra db create -v "${{ inputs.db-name }}" \
39+
(/home/runner/.astra/cli/astra db create -v "${{ inputs.db-name }}" \
4040
--env "${{ inputs.env }}" \
4141
-k default_keyspace \
4242
--token "${{ inputs.astra-token }}" \
4343
--vector \
4444
--region "${{ inputs.region }}" \
4545
--cloud "${{ inputs.cloud }}" \
46-
--timeout 600
46+
--timeout 1200) || "Failed to create database, check if creation is still in progress"
4747
48-
describe_out=$(/home/runner/.astra/cli/astra db describe "${{ inputs.db-name }}" \
49-
--token "${{ inputs.astra-token }}" --env "${{ inputs.env }}" -o json)
48+
while true; do
49+
describe_out=$(/home/runner/.astra/cli/astra db describe "${{ inputs.db-name }}" \
50+
--token "${{ inputs.astra-token }}" --env "${{ inputs.env }}" -o json)
51+
status=$(echo "$describe_out" | jq -r '.data.status')
52+
database_id=$(echo "$describe_out" | jq -r '.data.id')
53+
if [ "$status" == "ACTIVE" ]; then
54+
break
55+
fi
56+
if [ "$status" == "INITIALIZING" ]; then
57+
echo "Database is not active, status: $status"
58+
sleep 10
59+
fi
60+
echo "Database creation failed, status: $status"
61+
exit 1
62+
done
5063
51-
database_id=$(echo "$describe_out" | jq -r '.data.id')
5264
echo "Found database id: $database_id"
5365
domain="astra"
5466
if [ "${{ inputs.env }}" == "DEV" ]; then

.github/workflows/_run_e2e_tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
- name: Setup AstraDB
7171
uses: ./.github/actions/setup-astra-db
7272
id: astra-db
73+
timeout-minutes: 10
7374
if: ${{ inputs.astradb }}
7475
with:
7576
astra-token: ${{ secrets[inputs.astradb-token-secret-name] }}

0 commit comments

Comments
 (0)