Skip to content

Commit

Permalink
ci: add govulncheck pr gate and nightly tests
Browse files Browse the repository at this point in the history
Signed-off-by: Anish Ramasekar <[email protected]>
  • Loading branch information
aramase committed Apr 10, 2024
1 parent d9fceaa commit d978a9d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .pipelines/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ jobs:
clean: all
steps:
- template: templates/scan-images.yaml
- job: govulncheck
timeoutInMinutes: 5
workspace:
clean: all
steps:
- script: make go-vuln-check
displayName: govulncheck
- job: verify_deployment_yaml
timeoutInMinutes: 30
workspace:
Expand Down
8 changes: 8 additions & 0 deletions .pipelines/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,20 @@ jobs:
steps:
- script: make shellcheck
displayName: shellcheck
- job: govulncheck
timeoutInMinutes: 5
workspace:
clean: all
steps:
- script: make go-vuln-check
displayName: govulncheck
- job:
timeoutInMinutes: 60
dependsOn:
- lint
- scan_images
- shellcheck
- govulncheck
workspace:
clean: all
variables:
Expand Down
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ MOCKGEN_VER := v1.6.0
MOCKGEN_BIN := mockgen
MOCKGEN := $(TOOLS_BIN_DIR)/$(MOCKGEN_BIN)-$(MOCKGEN_VER)

GOVULNCHECK_VER := v1.0.1
GOVULNCHECK_BIN := govulncheck
GOVULNCHECK := $(TOOLS_BIN_DIR)/$(GOVULNCHECK_BIN)-$(GOVULNCHECK_VER)

# Scripts
GO_INSTALL := ./hack/go-install.sh

Expand Down Expand Up @@ -156,12 +160,12 @@ all: manager

# Build manager binary
.PHONY: manager
manager: generate fmt vet
manager: generate fmt vet go-vuln-check
go build -a -ldflags $(LDFLAGS) -o bin/manager cmd/webhook/main.go

# Build proxy binary
.PHONY: proxy
proxy: fmt vet
proxy: fmt vet go-vuln-check
go build -a -ldflags $(LDFLAGS) -o bin/proxy cmd/proxy/main.go

# Run against the configured Kubernetes cluster in ~/.kube/config
Expand Down Expand Up @@ -273,6 +277,9 @@ $(HELM):
$(MOCKGEN): ## Build mockgen from tools folder.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) github.com/golang/mock/mockgen $(MOCKGEN_BIN) $(MOCKGEN_VER)

$(GOVULNCHECK):
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) golang.org/x/vuln/cmd/govulncheck $(GOVULNCHECK_BIN) $(GOVULNCHECK_VER)

## --------------------------------------
## E2E images
## --------------------------------------
Expand Down Expand Up @@ -303,6 +310,11 @@ vet:
test: generate manifests
go test -v ./... -coverprofile cover.out

# Run go vuln check
.PHONY: go-vuln-check
go-vuln-check: $(GOVULNCHECK)
$(GOVULNCHECK) ./...

$(E2E_TEST):
(cd test/e2e && go test -tags=e2e -c . -o $(E2E_TEST))

Expand Down

0 comments on commit d978a9d

Please sign in to comment.