1
- # /bin/bash
1
+ #! /bin/bash
2
+
2
3
# Importing this library shouldn't have side effects
3
4
4
- script_dir= $( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd )
5
+ pkgdir= ${GOPATH} /src/github.com/kubernetes-csi/csi-proxy
5
6
6
- # current_account is the current Google SDK Account
7
- current_account=$( gcloud config list account --format " value(core.account)" | sed -r ' s/@\S+//g' )
7
+ # current_account is the current user
8
+ # in CI, the value is `prow`
9
+ current_account=$USER
8
10
# windows_node is the id of the GCE Windows instance
9
11
windows_node=$( kubectl get nodes -l kubernetes.io/os=windows -o jsonpath=' {.items[*].metadata.name}' )
10
12
11
- if ! [ -z $GCP_ZONE ]; then
12
- export CLOUDSDK_COMPUTE_ZONE=$GCP_ZONE
13
+ # set the default zone for the gcloud sdk
14
+ if ! [ -z " ${GCP_ZONE:- } " ]; then
15
+ export CLOUDSDK_COMPUTE_ZONE=" $GCP_ZONE "
13
16
fi
14
17
15
18
sync_file_to_vm () {
@@ -18,41 +21,42 @@ sync_file_to_vm() {
18
21
19
22
compile_csi_proxy () {
20
23
echo " Compiling CSI Proxy"
21
- make build
24
+ make -C $pkgdir build
22
25
}
23
26
24
27
compile_csi_proxy_integration_tests () {
25
28
echo " Compiling CSI Proxy integration tests"
26
- GOOS=windows GOARCH=amd64 go test -c . /integrationtests -o bin/integrationtests.test.exe
29
+ GOOS=windows GOARCH=amd64 go test -c $pkgdir /integrationtests -o $pkgdir / bin/integrationtests.test.exe
27
30
}
28
31
29
32
sync_csi_proxy () {
30
33
echo " Sync the csi-proxy.exe binary"
31
- local csi_proxy_bin_path=" $script_dir /.. /bin/csi-proxy.exe"
34
+ local csi_proxy_bin_path=" $pkgdir /bin/csi-proxy.exe"
32
35
sync_file_to_vm $csi_proxy_bin_path
33
36
}
34
37
35
38
sync_csi_proxy_integration_tests () {
36
39
echo " Sync the integrationtests.exe binary"
37
- local integration_bin_path=" $script_dir /.. /bin/integrationtests.test.exe"
40
+ local integration_bin_path=" $pkgdir /bin/integrationtests.test.exe"
38
41
sync_file_to_vm $integration_bin_path
39
42
}
40
43
41
44
sync_powershell_utils () {
42
- local utils_psm1=" $script_dir /utils.psm1"
45
+ local utils_psm1=" $pkgdir /scripts /utils.psm1"
43
46
sync_file_to_vm $utils_psm1
44
47
}
45
48
46
49
restart_csi_proxy () {
47
50
echo " Restart csi-proxy service"
48
- gcloud compute ssh $windows_node --command=' powershell -c "& { Import-Module .\ utils.psm1; Restart-CSIProxy }"'
51
+ gcloud compute ssh $windows_node --command=' powershell -c "& { $ErrorActionPreference = \"Stop\"; Import-Module (Resolve-Path(\" utils.psm1\")) ; Restart-CSIProxy; }"'
49
52
}
50
53
51
54
run_csi_proxy_integration_tests () {
52
55
echo " Run integration tests"
53
56
local ps1=$( cat << 'EOF '
54
57
"& {
55
- Import-Module .\\utils.psm1;
58
+ $ErrorActionPreference = \"Stop\";
59
+ Import-Module (Resolve-Path(\"utils.psm1\"));
56
60
Run-CSIProxyIntegrationTests -test_args \"--test.v --test.run TestAPIGroups\";
57
61
Run-CSIProxyIntegrationTests -test_args \"--test.v --test.run TestFilesystemAPIGroup\";
58
62
Run-CSIProxyIntegrationTests -test_args \"--test.v --test.run TestDiskAPIGroup\";
0 commit comments