Skip to content

Commit dbdc232

Browse files
committed
test: add trivy scanning test
test: add nolint chore: fix comments fix comments
1 parent 6679d49 commit dbdc232

4 files changed

Lines changed: 35 additions & 3 deletions

File tree

.github/workflows/linux.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ jobs:
2424
2525
- name: Build test
2626
run: |
27-
go build -a -mod vendor -o example/example ./example
27+
go build -a -mod vendor -o example/iscsi-lib-example ./example

.github/workflows/trivy.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Trivy vulnerability scanner
2+
on:
3+
pull_request: {}
4+
push: {}
5+
jobs:
6+
build:
7+
name: Build
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Set up Go 1.x
11+
uses: actions/setup-go@v2
12+
with:
13+
go-version: ^1.19
14+
id: go
15+
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
19+
- name: Build a binary
20+
run: |
21+
go build -a -mod vendor -o example/iscsi-lib-example ./example
22+
23+
- name: Run Trivy vulnerability scanner
24+
uses: aquasecurity/trivy-action@master
25+
with:
26+
scan-type: fs
27+
scan-ref: 'example/iscsi-lib-example'
28+
ignore-unfixed: true
29+
vuln-type: 'os,library'
30+
format: 'table'
31+
exit-code: '1'
32+
severity: 'CRITICAL,HIGH,MEDIUM,LOW'

.github/workflows/windows.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
uses: actions/checkout@v2
2020
- name: Build Test
2121
run: |
22-
go build -a -o example/example.exe ./example
22+
go build -a -o example/iscsi-lib-example.exe ./example

iscsi/iscsiadm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type Secrets struct {
2525
func iscsiCmd(args ...string) (string, error) {
2626
stdout, err := execWithTimeout("iscsiadm", args, time.Second*3)
2727

28-
klog.V(2).Infof("Run iscsiadm command: %s", strings.Join(append([]string{"iscsiadm"}, args...), " "))
28+
klog.V(2).Infof("Run iscsiadm command: %s", strings.Join(append([]string{"iscsiadm"}, args...), " ")) // nolint
2929
iscsiadmDebug(string(stdout), err)
3030

3131
return string(stdout), err

0 commit comments

Comments
 (0)