Skip to content

Commit 2c3a1c2

Browse files
Add files via upload
1 parent 24b982b commit 2c3a1c2

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/cleanup.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: "Clean up deployment"
16+
on:
17+
pull_request:
18+
# run on pull requests targeting main
19+
branches:
20+
- main
21+
types: closed
22+
paths-ignore:
23+
- '**/README.md'
24+
- 'kustomize/**'
25+
- '.github/workflows/kustomize-build-ci.yaml'
26+
- 'terraform/**'
27+
- '.github/workflows/terraform-validate-ci.yaml'
28+
jobs:
29+
cleanup-namespace:
30+
runs-on: [self-hosted, is-enabled]
31+
steps:
32+
- name: Delete PR namespace in staging cluster
33+
if: ${{ always() }}
34+
timeout-minutes: 20
35+
run: |
36+
gcloud container clusters get-credentials $PR_CLUSTER \
37+
--region $REGION --project $PROJECT_ID
38+
NAMESPACE="pr${PR_NUMBER}"
39+
kubectl delete namespace $NAMESPACE
40+
env:
41+
PROJECT_ID: "online-boutique-ci"
42+
PR_CLUSTER: "prs-gke-cluster"
43+
REGION: "us-central1"
44+
PR_NUMBER: ${{ github.event.number }}

0 commit comments

Comments
 (0)