-
-
Notifications
You must be signed in to change notification settings - Fork 94
101 lines (90 loc) · 3.77 KB
/
e2e-test.yaml
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
name: E2E Test
on:
push:
branches:
- "master"
paths:
- '**.go'
- '**.yaml'
- '**.mod'
pull_request:
paths:
- '**.go'
- '**.yaml'
- '**.mod'
env:
# Common versions
GO_VERSION: '1.19'
jobs:
kind:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Go build
run: |
go build -ldflags="-X github.com/sunny0826/kubecm/version.Version=${{ github.run_id }} \
-X github.com/sunny0826/kubecm/version.GitRevision=${{ github.sha }} \
-X 'github.com/sunny0826/kubecm/version.BuildDate=${{ steps.date.outputs.date }}'" \
-o bin/kubecm .
- name: Setup Kind
uses: engineerd/setup-kind@v0.5.0
with:
version: "v0.11.1"
- name: Setup 2nd Kind
run: |
kind create cluster --image kindest/node:v1.20.15 --name 2nd-kind --kubeconfig 2nd-kind
kind get clusters
- name: Setup 3rd Kind
run: |
kind create cluster --image kindest/node:v1.19.16 --name 3rd-kind --kubeconfig 3rd-kind
kind get clusters
- name: E2E Test
run: |
bin/kubecm version
echo "********************************************************************************"
echo "Running kubecm add..."
echo "********************************************************************************"
bin/kubecm add -cf 2nd-kind
bin/kubecm add -cf 3rd-kind --context-name 3rd
echo "********************************************************************************"
echo "Running kubecm merge multiple kubeconfig..."
echo "********************************************************************************"
bin/kubecm merge -y 2nd-kind 3rd-kind --config multi.config
cat multi.config
echo "********************************************************************************"
echo "Running kubecm merge in dir..."
echo "********************************************************************************"
mkdir -p tmp/kubecm-merge
cp -r 2nd-kind tmp/kubecm-merge/2nd-kind
cp -r 3rd-kind tmp/kubecm-merge/3rd-kind
bin/kubecm merge -f tmp/kubecm-merge -y --config merge.config
cat merge.config
echo "********************************************************************************"
echo "Running kubecm ls..."
echo "********************************************************************************"
bin/kubecm list
echo "********************************************************************************"
echo "Running kubecm switch..."
echo "********************************************************************************"
bin/kubecm s 3rd
echo "********************************************************************************"
echo "Running kubecm delete..."
echo "********************************************************************************"
bin/kubecm d kind-kind
echo "********************************************************************************"
echo "Running kubecm global flag --config..."
echo "********************************************************************************"
bin/kubecm s kind-3rd-kind --config merge.config
bin/kubecm list --config merge.config