Skip to content

Commit

Permalink
test: add trivy scanning test
Browse files Browse the repository at this point in the history
test: add nolint

chore: fix comments

fix comments
  • Loading branch information
andyzhangx committed Apr 29, 2023
1 parent 6679d49 commit dbdc232
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
- name: Build test
run: |
go build -a -mod vendor -o example/example ./example
go build -a -mod vendor -o example/iscsi-lib-example ./example
32 changes: 32 additions & 0 deletions .github/workflows/trivy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Trivy vulnerability scanner
on:
pull_request: {}
push: {}
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.19
id: go

- name: Checkout code
uses: actions/checkout@v2

- name: Build a binary
run: |
go build -a -mod vendor -o example/iscsi-lib-example ./example
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: fs
scan-ref: 'example/iscsi-lib-example'
ignore-unfixed: true
vuln-type: 'os,library'
format: 'table'
exit-code: '1'
severity: 'CRITICAL,HIGH,MEDIUM,LOW'
2 changes: 1 addition & 1 deletion .github/workflows/windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
uses: actions/checkout@v2
- name: Build Test
run: |
go build -a -o example/example.exe ./example
go build -a -o example/iscsi-lib-example.exe ./example
2 changes: 1 addition & 1 deletion iscsi/iscsiadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type Secrets struct {
func iscsiCmd(args ...string) (string, error) {
stdout, err := execWithTimeout("iscsiadm", args, time.Second*3)

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

return string(stdout), err
Expand Down

0 comments on commit dbdc232

Please sign in to comment.