https://github.com/qiyihuang/build-cleaner
Google Cloud function for cleaning up Cloud Build artifact after deployment.
https://github.com/qiyihuang/build-cleaner
google-cloud-build google-cloud-functions google-cloud-storage
Last synced: 5 months ago
JSON representation
Google Cloud function for cleaning up Cloud Build artifact after deployment.
- Host: GitHub
- URL: https://github.com/qiyihuang/build-cleaner
- Owner: qiyihuang
- Archived: true
- Created: 2022-04-04T09:38:40.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-07-07T14:54:57.000Z (almost 4 years ago)
- Last Synced: 2024-06-21T09:37:35.008Z (almost 2 years ago)
- Topics: google-cloud-build, google-cloud-functions, google-cloud-storage
- Language: Go
- Homepage:
- Size: 61.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Build Cleaner
Google Cloud function for cleaning up Cloud Build artifact storage after successful deployment. Artifacts are only used during build/deployment. Cloud Build won't clean them up automatically and lifecycle setting in Cloud Storage won't let us delete the artifact immediately.
## Deployment
- Google Cloud Pub/Sub API enabled.
- Create Pub/Sub topic "cloud-builds" if not existing.
- Create a subscription that "push" message to the the function endpoint. Set acknowledge deadline to 260 seconds or higher due to the gap between build completion and deployment completion.
- Grant the service worker build-cleaner uses the "Cloud Functions Viewer" and "Storage Object Admin" permissions.
- The function requires ~20mb memory to run.
- Add environment variables required (shown in .env.example) to the function.