-
Notifications
You must be signed in to change notification settings - Fork 510
117 lines (112 loc) · 3.6 KB
/
get-gke-credentials-it.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: get-gke-credentials Integration
on:
push:
paths:
- 'get-gke-credentials/**'
- '.github/workflows/get-gke-credentials**'
jobs:
gcloud:
name: with setup-gcloud & kubectl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: google-github-actions/setup-gcloud@master # Set up ADC for credentials
with:
service_account_key: ${{ secrets.GET_GKE_CRED_SA_KEY_JSON }}
export_default_credentials: true
- id: build
name: Build dist
working-directory: get-gke-credentials
run: |-
npm install
npm run build
- id: get-kubeconfig
uses: ./get-gke-credentials
with:
project_id: ${{ secrets.GET_GKE_CRED_PROJECT }}
cluster_name: ${{ secrets.GET_GKE_CRED_CLUSTER_NAME }}
location: ${{ secrets.GET_GKE_CRED_CLUSTER_LOCATION }}
use_auth_provider: true
- name: test-kubectl # Use kubectl with the generated kubeconfig to auth and list pods. There should be no pods in the default ns.
run: |
pods=$(kubectl get pods -o=jsonpath='{$.items[*]}')
if [ -n "$pods" ]
then
echo "Expected no pods. Got ${pods}"
exit 1
fi
base64:
name: with base64 creds & API
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: build
name: Build dist
working-directory: get-gke-credentials
run: |-
npm install
npm run build
- id: get-kubeconfig
uses: ./get-gke-credentials
with:
project_id: ${{ secrets.GET_GKE_CRED_PROJECT }}
credentials: ${{ secrets.GET_GKE_CRED_SA_KEY_B64 }}
cluster_name: ${{ secrets.GET_GKE_CRED_CLUSTER_NAME }}
location: ${{ secrets.GET_GKE_CRED_CLUSTER_LOCATION }}
- uses: actions/setup-node@master
with:
node-version: 12.x
- run: npm install
working-directory: ./get-gke-credentials
- name: integration tests
run: npm run e2e-tests
working-directory: ./get-gke-credentials
json-api:
name: with json creds & API
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: build
name: Build dist
working-directory: get-gke-credentials
run: |-
npm install
npm run build
- id: get-kubeconfig
uses: ./get-gke-credentials
with:
project_id: ${{ secrets.GET_GKE_CRED_PROJECT }}
credentials: ${{ secrets.GET_GKE_CRED_SA_KEY_JSON }}
cluster_name: ${{ secrets.GET_GKE_CRED_CLUSTER_NAME }}
location: ${{ secrets.GET_GKE_CRED_CLUSTER_LOCATION }}
- run: npm install
working-directory: ./get-gke-credentials
- name: integration tests
run: npm run e2e-tests
working-directory: ./get-gke-credentials
json-kubectl:
name: with json creds & kubectl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: build
name: Build dist
working-directory: get-gke-credentials
run: |-
npm install
npm run build
- id: get-kubeconfig
uses: ./get-gke-credentials
with:
project_id: ${{ secrets.GET_GKE_CRED_PROJECT }}
credentials: ${{ secrets.GET_GKE_CRED_SA_KEY_JSON }}
cluster_name: ${{ secrets.GET_GKE_CRED_CLUSTER_NAME }}
location: ${{ secrets.GET_GKE_CRED_CLUSTER_LOCATION }}
- name: test-kubectl # Use kubectl with the generated kubeconfig to auth and list pods. There should be no pods in the default ns.
run: |
pods=$(kubectl get pods -o=jsonpath='{$.items[*]}')
if [ -n "$pods" ]
then
echo "Expected no pods. Got ${pods}"
exit 1
fi