-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to purge RDS snapshots (#947)
* Adding purge aws rds snapshots workflow Signed-off-by: willdavsmith <[email protected]> * Adding purge aws rds snapshots workflow Signed-off-by: willdavsmith <[email protected]> --------- Signed-off-by: willdavsmith <[email protected]>
- Loading branch information
1 parent
5939bd6
commit 555acf4
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# ------------------------------------------------------------ | ||
# Copyright 2023 The Radius Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ------------------------------------------------------------ | ||
|
||
set -xe | ||
|
||
aws rds describe-db-snapshots --query 'DBSnapshots[].DBSnapshotIdentifier' --output text > snapshots.txt | ||
for rds_snapshot_identifier in $(cat ./snapshots.txt) | ||
do | ||
aws rds delete-db-snapshot --db-snapshot-identifier $rds_snapshot_identifier | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Purge AWS RDS DBInstance snapshots | ||
on: | ||
schedule: | ||
# Runs at 00:30 and 12:30 | ||
- cron: "30 0,12 * * *" | ||
jobs: | ||
purge_rds_snapshots: | ||
name: Purge AWS RDS DBInstance snapshots | ||
runs-on: [ubuntu-latest] | ||
steps: | ||
- name: Purge AWS RDS DBInstance snapshots | ||
run: | | ||
./.github/scripts/purge-aws-rds-snapshots.sh | ||
- name: Create GitHub issue on failure | ||
if: ${{ failure() }} | ||
run: | | ||
gh issue create --title "Purge AWS RDS DBInstance snapshots workflow failed" \ | ||
--body "Test failed on ${{ github.repository }}. See [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details." \ | ||
--repo ${{ github.repository }} |