Skip to content

Commit

Permalink
add clean up for test
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
sean1588 committed May 17, 2024
1 parent 89b2e93 commit 6d201cb
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
45 changes: 45 additions & 0 deletions .github/workflows/bucket-cleanup-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "Scheduled jobs: Bucket cleanup testing"
on:
schedule:
# * is a special character in YAML so you have to quote this string.
# Run every day at 3:00PM UTC.
- cron: '0 15 * * *'
workflow_dispatch:
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
all:
env:
GOPATH: ${{ github.workspace }}/go
name: Bucket cleanup
environment: testing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v1
with:
node-version: '18.x'

- uses: actions/setup-go@v2
with:
go-version: 1.19.x

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::571684982431:role/ContinuousDelivery
role-session-name: docs-deploy
role-duration-seconds: 7200
aws-region: us-west-2

- name: Run make ci_bucket_cleanup
run: make ci_bucket_cleanup
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
PULUMI_STACK_NAME: ${{ vars.PULUMI_STACK_NAME }}
SLACK_ACCESS_TOKEN: ${{ secrets.SLACK_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEPLOYMENT_ENVIRONMENT: ${{ vars.DEPLOYMENT_ENVIRONMENT }}
WEBSITE_URL: ${{ vars.WEBSITE_URL }}
1 change: 1 addition & 0 deletions .github/workflows/bucket-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ jobs:
SLACK_ACCESS_TOKEN: ${{ secrets.SLACK_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEPLOYMENT_ENVIRONMENT: ${{ vars.DEPLOYMENT_ENVIRONMENT }}
WEBSITE_URL: ${{ vars.WEBSITE_URL }}
8 changes: 7 additions & 1 deletion scripts/list-recent-buckets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,14 @@ if [ "$bucket_count" == "0" ]; then
exit
fi

# Check if WEBSITE_URL is set
if [ -z "$WEBSITE_URL" ]; then
echo "WEBSITE_URL is not set."
exit 1
fi

# Query for the bucket currently serving pulumi.com.
currently_deployed_bucket="$(curl -s https://www.pulumi.com/metadata.json | jq -r '.bucket' || echo '')"
currently_deployed_bucket="$(curl -s ${WEBSITE_URL}/metadata.json | jq -r '.bucket' || echo '')"

maybe_echo "Found ${bucket_count} recent buckets matching the prefix $(origin_bucket_prefix)-${bucket_prefix}:"

Expand Down

0 comments on commit 6d201cb

Please sign in to comment.