-
Notifications
You must be signed in to change notification settings - Fork 19
173 lines (169 loc) · 5.34 KB
/
basic-ci.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Harvester-Node-Disk-Manager CI
# synchronize for pull request update
on:
push:
branches:
- master
- 'v**'
pull_request:
types: [opened, reopened, synchronize]
env:
LIBVIRT_DEFAULT_URI: "qemu:///system"
VM_DEPLOYED: false
jobs:
validation:
runs-on:
- self-hosted
- golang
steps:
- name: "Clone and check"
uses: actions/checkout@v3
- name: "Run validations"
run: |
make validate
make validate-ci
job-new-installation:
needs: validation
runs-on:
- self-hosted
- golang
steps:
- name: "Clone and check"
uses: actions/checkout@v3
- name: "Build the Image for the Integration Test"
run: |
BUILD_FOR_CI=true make
./ci/scripts/patch-ttl-repo.sh
echo "NDM override result as below:"
cat ci/charts/ndm-override.yaml
- name: "Local Deployment (Harvester+Longhorn+Node-Disk-Manager) for testing"
id: vm_deploy
run: |
rm -rf ndm-new-vagrant-k3s
git clone https://github.com/bk201/vagrant-k3s ndm-new-vagrant-k3s
pushd ndm-new-vagrant-k3s
yq e -i ".cluster_size = 1" settings.yaml
./new-cluster.sh
echo "VM_DEPLOYED=true" >> "$GITHUB_ENV"
yq e -i ".longhorn_version = \"1.7.1\"" settings.yaml
./scripts/deploy_longhorn.sh
popd
- name: "Patch Image target"
run: |
./ci/scripts/patch-ttl-repo.sh
echo "NDM override result as below:"
cat ci/charts/ndm-override.yaml
- name: "Deploy NDM"
run: |
pushd ndm-new-vagrant-k3s
cp ../ci/scripts/deploy_ndm_current.sh ./deploy_ndm_current.sh
cp ../ci/charts/ndm-override.yaml ./ndm-override.yaml
./deploy_ndm_current.sh
popd
- name: "Add disk"
run: |
pushd ndm-new-vagrant-k3s
./scripts/attach-disk.sh node1 ndm-new-vagrant-k3s
sleep 30
popd
- name: "Run Basic Test"
id: basic-test
run: |
pushd ndm-new-vagrant-k3s
vagrant ssh-config node1 > ../ssh-config
cp kubeconfig ../kubeconfig
popd
echo Running integration tests
NDM_HOME=`pwd` go test -v ./tests/...
- name: "Get NDM logs"
if: always()
run: |
if [ ${{ env.VM_DEPLOYED }} != 'true' ]; then
echo "VM is not deployed, skip getting logs"
exit 0
fi
./ci/scripts/get-debug-info.sh
- name: "Tear Down / Cleanup"
if: always()
run: |
if [ ${{ env.VM_DEPLOYED }} != 'true' ]; then
echo "VM is not deployed, skip VM destroy"
exit 0
fi
rm -rf /tmp/hotplug_disks/ndm-new-vagrant-k3s
pushd ndm-new-vagrant-k3s
vagrant destroy -f --parallel
popd
jobs-upgrade:
needs: validation
runs-on:
- self-hosted
- golang
steps:
- name: "Clone and check"
uses: actions/checkout@v3
- name: "Build the Image for the Integration Test"
run: |
BUILD_FOR_CI=true make
./ci/scripts/patch-ttl-repo.sh
echo "NDM override result as below:"
cat ci/charts/ndm-override.yaml
- name: "Local Deployment (Harvester+Longhorn+Node-Disk-Manager) for testing"
id: vm_deploy
run: |
rm -rf ndm-upgrade-vagrant-k3s
git clone https://github.com/bk201/vagrant-k3s ndm-upgrade-vagrant-k3s
pushd ndm-upgrade-vagrant-k3s
yq e -i ".cluster_size = 1" settings.yaml
./new-cluster.sh
echo "VM_DEPLOYED=true" >> "$GITHUB_ENV"
yq e -i ".longhorn_version = \"1.7.1\"" settings.yaml
./scripts/deploy_longhorn.sh
cp ../ci/scripts/deploy_ndm_chart.sh ./deploy_ndm_chart.sh
./deploy_ndm_chart.sh
popd
- name: "Add disk"
run: |
pushd ndm-upgrade-vagrant-k3s
./scripts/attach-disk.sh node1 ndm-upgrade-vagrant-k3s
sleep 30
popd
- name: "Patch Image target (for upgrade)"
run: |
./ci/scripts/patch-ttl-repo.sh
echo "NDM override result as below:"
cat ci/charts/ndm-override.yaml
- name: "Upgrade NDM"
run: |
pushd ndm-upgrade-vagrant-k3s
cp ../ci/scripts/upgrade_ndm.sh ./upgrade_ndm.sh
./upgrade_ndm.sh
popd
- name: "Run Basic Test"
id: basic-test
run: |
pushd ndm-upgrade-vagrant-k3s
vagrant ssh-config node1 > ../ssh-config
cp kubeconfig ../kubeconfig
popd
echo Running integration tests
NDM_HOME=`pwd` go test -v ./tests/...
- name: "Get NDM logs"
if: always()
run: |
if [ ${{ env.VM_DEPLOYED }} != 'true' ]; then
echo "VM is not deployed, skip getting logs"
exit 0
fi
./ci/scripts/get-debug-info.sh
- name: "Tear Down / Cleanup"
if: always()
run: |
if [ ${{ env.VM_DEPLOYED }} != 'true' ]; then
echo "VM is not deployed, skip VM destroy"
exit 0
fi
rm -rf /tmp/hotplug_disks/ndm-upgrade-vagrant-k3s
pushd ndm-upgrade-vagrant-k3s
vagrant destroy -f --parallel
popd