mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-07-25 14:20:29 -07:00
fix linting and updating maintenance guide
Updating the maintainers guide with updated intructions from Ansible engineers. Fixing linting issues, and adding the linter as a GitHub workflow to ensure there are no regressions.
This commit is contained in:
parent
3fb4763e37
commit
a9545c77a4
15 changed files with 91 additions and 74 deletions
|
@ -8,42 +8,45 @@
|
|||
# - google-cloud-sdk (gcloudgcloud )
|
||||
set -e
|
||||
PROJECT_ID="${1}"
|
||||
SERVICE_ACCOUNT_NAME="${2}"
|
||||
# service account is unused today
|
||||
# SERVICE_ACCOUNT_NAME="${2}"
|
||||
ZONE="us-central1-a"
|
||||
|
||||
main() {
|
||||
# note: the ordering here is deliberate, to start with
|
||||
# leaf resources and work upwards to parent resources.
|
||||
cleanup_resource_per_region "compute vpn-tunnels"
|
||||
cleanup_resource "compute instances" "" "--zone=$ZONE"
|
||||
cleanup_resource_per_region "compute addresses"
|
||||
cleanup_resource "compute target-http-proxies" "" "--global"
|
||||
cleanup_resource "compute forwarding-rules" "--global" "--global"
|
||||
cleanup_resource "compute forwarding-rules" \
|
||||
cleanup_resource_per_region "compute" "vpn-tunnels"
|
||||
cleanup_resource "compute" "instances" "" "--zone=$ZONE"
|
||||
cleanup_resource_per_region "compute" "addresses"
|
||||
cleanup_resource "compute" "target-http-proxies" "" "--global"
|
||||
cleanup_resource "compute" "forwarding-rules" "--global" "--global"
|
||||
cleanup_resource "compute" "forwarding-rules" \
|
||||
"--regions=us-central1" "--region=us-central1"
|
||||
cleanup_resource "compute url-maps" "--global" "--global"
|
||||
cleanup_resource "compute url-maps" \
|
||||
cleanup_resource "compute" "url-maps" "--global" "--global"
|
||||
cleanup_resource "compute" "url-maps" \
|
||||
"--regions=us-central1" "--region=us-central1"
|
||||
cleanup_resource "compute backend-services" "--global" "--global"
|
||||
cleanup_resource "compute backend-services" \
|
||||
cleanup_resource "compute" "backend-services" "--global" "--global"
|
||||
cleanup_resource "compute" "backend-services" \
|
||||
"--regions=us-central1" "--region=us-central1"
|
||||
}
|
||||
|
||||
cleanup_resource() {
|
||||
resource_group="$1"
|
||||
extra_list_args="$2"
|
||||
extra_delete_args="$3"
|
||||
resource="$2"
|
||||
extra_list_arg="$3"
|
||||
extra_delete_arg="$4"
|
||||
|
||||
for resource in $(gcloud $resource_group list --project="${PROJECT_ID}" --format="csv[no-heading](name)" $extra_list_args); do
|
||||
gcloud $resource_group delete "${resource}" --project="${PROJECT_ID}" -q $extra_delete_args
|
||||
for resource_id in $(gcloud "${resource_group}" "${resource}" list --project="${PROJECT_ID}" --format="csv[no-heading](name)" "${extra_list_arg}"); do
|
||||
gcloud "${resource_group}" "${resource}" delete "${resource_id}" --project="${PROJECT_ID}" -q "${extra_delete_arg}"
|
||||
done
|
||||
}
|
||||
|
||||
cleanup_resource_per_region() {
|
||||
resource_group="$1"
|
||||
for resource_and_region in $(gcloud $resource_group list --project="${PROJECT_ID}" --format="csv[no-heading](name,region)"); do
|
||||
read -r resource region < <(echo "$resource_and_region" | tr "," " ")
|
||||
gcloud $resource_group delete "${resource}" --project="${PROJECT_ID}" -q --region="${region}"
|
||||
resource="$2"
|
||||
for resource_and_region in $(gcloud "${resource_group}" "${resource}" list --project="${PROJECT_ID}" --format="csv[no-heading](name,region)"); do
|
||||
read -r resource_id region < <(echo "$resource_and_region" | tr "," " ")
|
||||
gcloud "${resource_group}" "${resource}" delete "${resource_id}" --project="${PROJECT_ID}" -q --region="${region}"
|
||||
done
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue