This repository has been archived by the owner on Jul 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(delivery): add CI cleanup script (#395)
- Loading branch information
Ace Nassri
committed
May 26, 2022
1 parent
7a8cb90
commit 7a977bb
Showing
1 changed file
with
82 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,82 @@ | ||
#!/bin/bash | ||
# Copyright 2021 Google LLC | ||
# | ||
# 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. | ||
|
||
######################################### | ||
# This script deletes resources not # | ||
# deleted by `terraform apply -destroy` # | ||
######################################### | ||
|
||
echo "###################################################" | ||
echo "# THIS IS A CLEANUP SCRIPT (errors are not fatal) #" | ||
echo "###################################################" | ||
|
||
# Pub/Sub topics | ||
gcloud pubsub topics delete gcr \ | ||
--project ${OPS_PROJECT} \ | ||
|| true | ||
gcloud pubsub topics delete nightly_builds \ | ||
--project ${OPS_PROJECT} \ | ||
|| true | ||
|
||
# Artifact Registry repositories | ||
gcloud artifacts repositories delete website \ | ||
--project ${OPS_PROJECT} \ | ||
--location ${REGION} \ | ||
-q \ | ||
|| true | ||
gcloud artifacts repositories delete content-api \ | ||
--project ${OPS_PROJECT} \ | ||
--location ${REGION} \ | ||
-q \ | ||
|| true | ||
gcloud artifacts repositories delete e2e-runner \ | ||
--project ${OPS_PROJECT} \ | ||
--location ${REGION} \ | ||
-q \ | ||
|| true | ||
|
||
# Service accounts | ||
gcloud iam service-accounts delete \ | ||
website-test-user@${OPS_PROJECT}.iam.gserviceaccount.com \ | ||
--project ${OPS_PROJECT} \ | ||
-q \ | ||
|| true | ||
gcloud iam service-accounts delete \ | ||
website-test-approver@${OPS_PROJECT}.iam.gserviceaccount.com \ | ||
--project ${OPS_PROJECT} \ | ||
-q \ | ||
|| true | ||
|
||
# Secrets | ||
# (QUESTION: this will brick auth; **should** we delete these?) | ||
gcloud secrets delete client_id_secret \ | ||
--project ${OPS_PROJECT} \ | ||
-q \ | ||
|| true | ||
gcloud secrets delete client_secret_secret \ | ||
--project ${OPS_PROJECT} \ | ||
-q \ | ||
|| true | ||
|
||
# Cloud Scheduler jobs | ||
gcloud scheduler jobs delete nightly-builds \ | ||
--project ${OPS_PROJECT} \ | ||
--location ${REGION} \ | ||
-q \ | ||
|| true | ||
|
||
echo "###################################################" | ||
echo "# End cleanup #" | ||
echo "###################################################" |