Skip to content

Commit 353eef2

Browse files
committed
Import PS Security module 3.0 before running a PS function
1 parent 07be14d commit 353eef2

File tree

1 file changed

+44
-11
lines changed

1 file changed

+44
-11
lines changed

.github/workflows/windows.yml

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
name: Windows Tests
22
on: [push, pull_request]
33
jobs:
4+
setup_powershell:
5+
strategy:
6+
matrix:
7+
go: ['1.22']
8+
platform: [windows-latest]
9+
runs-on: ${{ matrix.platform }}
10+
steps:
11+
- name: Run Windows Integration Tests
12+
shell: powershell
13+
run: |
14+
# required for running Volume and Disk tests
15+
Install-WindowsFeature -name Hyper-V-PowerShell
16+
$PSVersionTable
17+
# required for SMB test
18+
# Get-PSRepository
19+
# Set-PSRepository PSGallery -InstallationPolicy Trusted
20+
Install-Module -Name SecMgmt -AllowClobber
21+
$secured='random text'|ConvertTo-SecureString -AsPlainText -Force;$secured;
22+
423
integration_tests:
524
strategy:
625
matrix:
7-
go: ['1.20']
26+
go: ['1.22']
827
platform: [windows-latest]
928
runs-on: ${{ matrix.platform }}
1029
steps:
@@ -15,27 +34,41 @@ jobs:
1534
- name: Checkout code
1635
uses: actions/checkout@v4
1736
- name: Build
37+
shell: powershell
1838
run: |
1939
go build -v -a -o ./bin/csi-proxy.exe ./cmd/csi-proxy
2040
go build -v -a -o ./bin/csi-proxy-api-gen.exe ./cmd/csi-proxy-api-gen
2141
- name: Run Windows Integration Tests
42+
shell: powershell
2243
run: |
2344
# required for running Volume and Disk tests
2445
Install-WindowsFeature -name Hyper-V-PowerShell
25-
26-
# start the CSI Proxy before running tests on windows
27-
Start-Job -Name CSIProxy -ScriptBlock {
28-
.\bin\csi-proxy.exe
29-
};
30-
Start-Sleep -Seconds 30;
31-
Write-Output "getting named pipes"
46+
47+
# copy the binary from the user directory
48+
New-Item -ItemType Directory -Path C:\etc\kubernetes\node\bin -Force
49+
New-Item -ItemType Directory -Path C:\etc\kubernetes\logs -Force
50+
Copy-Item -Path .\bin\csi-proxy.exe -Destination "C:\etc\kubernetes\node\bin\csi-proxy.exe"
51+
52+
# restart the csiproxy service
53+
$flags = "-v=5 -windows-service -log_file=C:\etc\kubernetes\logs\csi-proxy.log -logtostderr=false"
54+
sc.exe create csiproxy start= "auto" binPath= "C:\etc\kubernetes\node\bin\csi-proxy.exe $flags"
55+
sc.exe failure csiproxy reset= 0 actions= restart/10000
56+
sc.exe start csiproxy
57+
58+
Start-Sleep -Seconds 5;
59+
60+
Write-Output "Checking the status of csi-proxy"
61+
sc.exe query csiproxy
3262
[System.IO.Directory]::GetFiles("\\.\\pipe\\")
63+
Write-Output "Get CSI Proxy logs"
64+
Get-Content C:\etc\kubernetes\logs\csi-proxy.log -Tail 20
65+
3366
$env:CSI_PROXY_GH_ACTIONS="TRUE"
34-
go test -timeout 20m -v -race ./integrationtests/...
67+
go test -timeout 20m -v -race ./integrationtests/... -run "Smb"
3568
unit_tests:
3669
strategy:
3770
matrix:
38-
go: ['1.20']
71+
go: ['1.22']
3972
platform: [windows-latest]
4073
runs-on: ${{ matrix.platform }}
4174
steps:
@@ -53,7 +86,7 @@ jobs:
5386
bump_version_test:
5487
strategy:
5588
matrix:
56-
go: ['1.20']
89+
go: ['1.22']
5790
platform: [ubuntu-latest]
5891
runs-on: ${{ matrix.platform }}
5992
steps:

0 commit comments

Comments
 (0)