Skip to content

Commit de4da7e

Browse files
committed
wait for rds db to be available, cleanup
1 parent a016328 commit de4da7e

File tree

2 files changed

+33
-18
lines changed

2 files changed

+33
-18
lines changed

.github/workflows/cloudpod_release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ jobs:
3838
run: ls -R
3939
- name: Prepare Release.txt
4040
run: |
41-
echo "Cloud Pod Release for LocalStack Version ${{ inputs.release-tag || 'latest'}}." > Release.txt
42-
echo "Please use the 'release-pod-{database}.zip' you need for your configuration." >> Release.txt
43-
echo "By default LocalStack uses the engine 'mariadb'. If you start LocalStack with 'RDS_MYSQL_DOCKER=1', please use the 'mysql' pod." >> Release.txt
41+
echo "Cloud Pod of the Sample created with LocalStack Version ${{ inputs.release-tag || 'latest'}}." > Release.txt
42+
echo " * Please use the 'release-pod-{database}.zip' you need for your configuration." >> Release.txt
43+
echo " * By default LocalStack uses the engine 'mariadb', so you need 'release-pod-mariadb.zip' " >> Release.txt
44+
echo " * If you start LocalStack with 'RDS_MYSQL_DOCKER=1', please use the 'mysql' pod ('release-pod-mysql.zip')" >> Release.txt
4445
- name: Create Release
4546
id: create_release
4647
uses: softprops/action-gh-release@v1
4748
with:
4849
tag_name: "${{ inputs.release-tag || 'latest'}}"
4950
name: "Cloud Pod for LocalStack Version '${{ inputs.release-tag || 'latest'}}'"
50-
body: "The release features a cloud pod for LocalStack version '${{ inputs.release-tag || 'latest'}}'"
51+
body-path: ./Release.txt
5152
files: |
5253
./release-pod-mysql.zip
53-
./release-pod-mariadb.zip
54-
Release.txt
54+
./release-pod-mariadb.zip

.github/workflows/test_cloudpods.yml

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,38 +57,53 @@ jobs:
5757
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
5858
LOCALSTACK_VOLUME_DIR: ${{ github.workspace }}/ls_test
5959
MYSQL_FEATURE_FLAG: ${{ matrix.db }}
60+
DEBUG: 1
61+
POD_LOAD_CLI_TIMEOUT: 300
6062
run: |
6163
mkdir ls_test
6264
ls -la ls_test
6365
docker pull localstack/localstack-pro:${{ matrix.tag }}
6466
# Start LocalStack in the background
6567
if [ "mysql" == ${MYSQL_FEATURE_FLAG} ]; then
66-
DEBUG=1 RDS_MYSQL_DOCKER=1 localstack start -d
68+
RDS_MYSQL_DOCKER=1 localstack start -d
6769
else
68-
DEBUG=1 localstack start -d
70+
localstack start -d
6971
fi
7072
# Wait 30 seconds for the LocalStack container to become ready before timing out
7173
echo "Waiting for LocalStack startup..."
7274
localstack wait -t 15
7375
echo "Startup complete"
7476
- name: Inject Pod
75-
run: localstack pod load file://release-pod.zip
77+
run: |
78+
localstack pod load file://release-pod.zip
79+
state=$(awslocal rds describe-db-instances | jq -r ".DBInstances[0].DBInstanceStatus")
80+
while [ "$state" = creating ]; do
81+
sleep 1
82+
state=$(awslocal rds describe-db-instances | jq -r ".DBInstances[0].DBInstanceStatus")
83+
done
7684
- name: Run Smoke Tests
7785
run: |
78-
awslocal lambda invoke --cli-binary-format raw-in-base64-out --function-name my-lambda-rds-query-helper --payload '{"sqlQuery": "show tables", "secretName":"/rdsinitexample/rds/creds/mysql-01"}' output
86+
awslocal lambda invoke --cli-binary-format raw-in-base64-out --function-name my-lambda-rds-query-helper --payload '{"sqlQuery": "show tables", "secretName":"/rdsinitexample/rds/creds/mysql-01"}' output1
7987
echo "show tables:"
80-
cat output
81-
awslocal lambda invoke --cli-binary-format raw-in-base64-out --function-name my-lambda-rds-query-helper --payload '{"sqlQuery": "select Author from Books", "secretName":"/rdsinitexample/rds/creds/mysql-01"}' output
88+
cat output1
89+
awslocal lambda invoke --cli-binary-format raw-in-base64-out --function-name my-lambda-rds-query-helper --payload '{"sqlQuery": "select Author from Books", "secretName":"/rdsinitexample/rds/creds/mysql-01"}' output2
8290
echo "select Author from Books:"
83-
cat output
84-
return_status=$(cat output | jq -r .status)
85-
if [ "SUCCESS" != ${return_status} ]; then
86-
echo "unexpected response: ${return_status}"
87-
cat output
91+
cat output2
92+
return_status1=$(cat output1 | jq -r .status)
93+
if [ "SUCCESS" != ${return_status1} ]; then
94+
echo "unexpected response for query1: ${return_status1}"
95+
cat output1
96+
exit 1
97+
fi
98+
return_status2=$(cat output2 | jq -r .status)
99+
if [ "SUCCESS" != ${return_status2} ]; then
100+
echo "unexpected response for query2: ${return_status2}"
101+
cat output2
88102
exit 1
89103
fi
90104
- name: Show Logs
91105
if: failure()
92106
run: |
93107
localstack logs
94-
108+
# TODO add slack notification
109+
# add https://github.com/marketplace/actions/keepalive-workflow + adapt commit message https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs

0 commit comments

Comments
 (0)