Skip to content

Commit ad080a8

Browse files
committed
cleanup workflows
1 parent e927e1c commit ad080a8

File tree

4 files changed

+41
-37
lines changed

4 files changed

+41
-37
lines changed

.github/workflows/cloudpod_release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
- 'README.md'
1010
branches:
1111
- main
12-
- cloudpod_workflow # TODO remove
1312

1413
permissions:
1514
contents: write
@@ -35,8 +34,10 @@ jobs:
3534
uses: actions/download-artifact@v3
3635
with:
3736
name: cloudpod
37+
3838
- name: Display structure of downloaded files
3939
run: ls -R
40+
4041
- name: Prepare Release Notes
4142
run: |
4243
echo "This release includes the Cloud Pod of the sample created with LocalStack Version \`${{ inputs.release-tag || 'latest'}}\`." > Release.txt
@@ -49,6 +50,7 @@ jobs:
4950
echo "If you start LocalStack with \`RDS_MYSQL_DOCKER=1\`, please use the \`mysql\` pod \`release-pod-mysql.zip\`" >> Release.txt
5051
echo "You can click the Launchpad to inject the \`mysql\` version of the pod into your running LocalStack instance:" >> Release.txt
5152
echo "[![LocalStack Pods Launchpad](https://localstack.cloud/gh/launch-pod-badge.svg)](https://app.localstack.cloud/launchpad?url=https://github.com/$GITHUB_REPOSITORY/releases/download/${{ inputs.release-tag || 'latest'}}/release-pod-mysql.zip)" >> Release.txt
53+
5254
- name: Create Release
5355
id: create_release
5456
uses: softprops/action-gh-release@v1

.github/workflows/main.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,9 @@ jobs:
6161
make bootstrap
6262
make deploy
6363
64-
- name: Smoke Test
64+
- name: Run Smoke Tests
6565
run: |
66-
awslocal --version
67-
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
68-
echo "show tables:"
69-
cat output
70-
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
71-
echo "select Author from Books:"
72-
cat output
73-
return_status=$(cat output | jq -r .status)
74-
if [ "SUCCESS" != ${return_status} ]; then
75-
echo "unexpected response: ${return_status}"
76-
cat output
77-
exit 1
78-
fi
66+
./test-helper/smoke-test.sh
7967
8068
- name: Show Logs
8169
if: always()

.github/workflows/setup.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,19 @@ jobs:
6363
make build
6464
make bootstrap
6565
make deploy
66+
6667
# TODO should we run smoke tests before creating the pod?
6768
- name: Run Smoke Tests
6869
run: |
6970
./test-helper/smoke-test.sh
71+
7072
- name: Save the Cloud Pod
7173
if: ${{ inputs.store-cloudpod == 'true' }}
7274
uses: HarshCasper/cloud-pod-save@v0.1.0
7375
with:
7476
name: 'release-pod-${{ inputs.database-type }}.zip'
7577
location: 'disk'
78+
7679
- name: Upload Pod as Artifact
7780
if: ${{ inputs.store-cloudpod == 'true' }}
7881
uses: actions/upload-artifact@v3

.github/workflows/test_cloudpods.yml

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
name: Test Released Cloud Pods
22

33
on:
4-
#schedule: TODO activate
4+
schedule:
55
# “At 00:00 on Saturday.”
6-
# - cron: "0 0 * * 6"
6+
- cron: "0 0 * * 6"
77
workflow_dispatch:
88
push: # TODO remove
99
paths-ignore:
1010
- 'README.md'
1111
branches:
1212
- cloudpod_workflow
1313

14+
permissions:
15+
contents: write
16+
1417
jobs:
1518
get-releases:
1619
name: Retrieve Released Cloud Pods
@@ -46,13 +49,16 @@ jobs:
4649
download_url="https://github.com/$GITHUB_REPOSITORY/releases/download/${{ matrix.tag }}/release-pod-${{ matrix.db }}.zip"
4750
curl -L $download_url --output release-pod.zip
4851
ls -la
52+
4953
- name: Setup Python
5054
uses: actions/setup-python@v4
5155
with:
5256
python-version: '3.9'
57+
5358
- name: Install Dependencies
5459
run: |
5560
pip install localstack awscli-local
61+
5662
- name: Start LocalStack
5763
env:
5864
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
@@ -74,6 +80,7 @@ jobs:
7480
echo "Waiting for LocalStack startup..."
7581
localstack wait -t 15
7682
echo "Startup complete"
83+
7784
- name: Inject Pod
7885
run: |
7986
localstack pod load file://release-pod.zip
@@ -82,29 +89,33 @@ jobs:
8289
sleep 1
8390
state=$(awslocal rds describe-db-instances | jq -r ".DBInstances[0].DBInstanceStatus")
8491
done
92+
8593
- name: Run Smoke Tests
8694
run: |
87-
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
88-
echo "show tables:"
89-
cat output1
90-
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
91-
echo "select Author from Books:"
92-
cat output2
93-
return_status1=$(cat output1 | jq -r .status)
94-
if [ "SUCCESS" != ${return_status1} ]; then
95-
echo "unexpected response for query1: ${return_status1}"
96-
cat output1
97-
exit 1
98-
fi
99-
return_status2=$(cat output2 | jq -r .status)
100-
if [ "SUCCESS" != ${return_status2} ]; then
101-
echo "unexpected response for query2: ${return_status2}"
102-
cat output2
103-
exit 1
104-
fi
95+
./test-helper/smoke-test.sh
96+
10597
- name: Show Logs
10698
if: failure()
10799
run: |
108100
localstack logs
109-
# TODO add slack notification
110-
# add https://github.com/marketplace/actions/keepalive-workflow + adapt commit message https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs
101+
102+
- name: Send a Slack notification
103+
if: failure() || github.event_name != 'pull_request'
104+
uses: ravsamhq/notify-slack-action@v2
105+
with:
106+
status: ${{ job.status }}
107+
token: ${{ secrets.GITHUB_TOKEN }}
108+
notification_title: "{workflow} has {status_message}"
109+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
110+
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Workflow run>"
111+
notify_when: "failure"
112+
env:
113+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
114+
115+
- name: Prevent Workflows from getting Stale
116+
if: always()
117+
uses: gautamkrishnar/keepalive-workflow@v1
118+
with:
119+
# this message should prevent automatic triggering of workflows
120+
# see https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs
121+
commit_message: "[skip ci] Automated commit by Keepalive Workflow to keep the repository active"

0 commit comments

Comments
 (0)