Skip to content

Commit e2a56bc

Browse files
authored
Merge pull request #29 from fluxcd/ci-scan
ci: Setup dependabot and govulncheck
2 parents d9baa70 + bc30a9f commit e2a56bc

5 files changed

Lines changed: 52 additions & 9 deletions

File tree

.github/dependabot.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
labels: ["dependencies"]
7+
groups:
8+
actions:
9+
patterns:
10+
- "*"
11+
schedule:
12+
interval: "monthly"

.github/workflows/scan.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: scan
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 6 * * 1'
7+
8+
jobs:
9+
govulncheck:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
16+
- name: Setup Go
17+
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
18+
with:
19+
go-version: 1.26.x
20+
cache-dependency-path: |
21+
**/go.sum
22+
**/go.mod
23+
- name: Scan
24+
run: make scan

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
push:
66
branches:
7-
- '*'
7+
- main
88
pull_request:
99

1010
jobs:

Makefile

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,34 @@ SHELL = /usr/bin/env bash -o pipefail
1515
.SHELLFLAGS = -ec
1616

1717
.PHONY: all
18-
all: tidy vet fmt lint test
18+
all: tidy vet fmt lint test ## Run the full verification pipeline (tidy, vet, fmt, lint, test).
19+
20+
##@ Development
1921

2022
.PHONY: fmt
21-
fmt:
23+
fmt: ## Format Go source files in-place with gofmt.
2224
go fmt ./...
2325

2426
.PHONY: lint
25-
lint: golangci-lint ## Run golangci linters and ESLint.
27+
lint: golangci-lint ## Run golangci-lint against the whole module.
2628
$(GOLANGCI_LINT) run
2729

2830
.PHONY: tidy
29-
tidy:
31+
tidy: ## Sync go.mod and go.sum with the module's imports.
3032
go mod tidy
3133

3234
.PHONY: test
33-
test:
35+
test: ## Run unit tests under ./pkg/... with the race detector and coverage enabled.
3436
go test -race -cover ./pkg/...
3537

3638
.PHONY: vet
37-
vet:
39+
vet: ## Run go vet to catch suspicious constructs.
3840
go vet ./...
3941

42+
.PHONY: scan
43+
scan: govulncheck ## Scan the module for known vulnerabilities.
44+
@$(GOVULNCHECK) ./...
45+
4046
##@ Dependencies
4147

4248
## Location to install dependencies to
@@ -48,17 +54,17 @@ $(LOCALBIN):
4854
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
4955
GOVULNCHECK ?= $(LOCALBIN)/govulncheck
5056

57+
# Pinned version of golangci-lint; bump here to upgrade the linter across CI and local runs.
5158
GOLANGCI_LINT_VERSION ?= v2.11.4
5259
.PHONY: golangci-lint
5360
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
5461
$(GOLANGCI_LINT): $(LOCALBIN)
5562
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
5663

5764
.PHONY: govulncheck
58-
govulncheck: $(GOVULNCHECK) ## Run govulncheck.
65+
govulncheck: $(GOVULNCHECK) ## Install govulncheck locally if necessary.
5966
$(GOVULNCHECK): $(LOCALBIN)
6067
$(call go-install-tool,$(GOVULNCHECK),golang.org/x/vuln/cmd/govulncheck,latest)
61-
@$(GOVULNCHECK) ./...
6268

6369
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
6470
# $1 - target path with name of binary (ideally with version)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![release](https://img.shields.io/github/v/tag/fluxcd/cli-utils?label=release)](https://github.com/fluxcd/cli-utils/tags)
44
[![license](https://img.shields.io/github/license/fluxcd/cli-utils.svg)](https://github.com/fluxcd/cli-utils/blob/main/LICENSE)
55
[![test](https://github.com/fluxcd/cli-utils/workflows/test/badge.svg)](https://github.com/fluxcd/cli-utils/actions)
6+
[![scan](https://github.com/fluxcd/cli-utils/workflows/scan/badge.svg)](https://github.com/fluxcd/cli-utils/actions)
67

78
This repository is a hard fork of [kubernetes-sigs/cli-utils](https://github.com/kubernetes-sigs/cli-utils) reducing it to the `kstatus` package
89
and adding extensions for Flux's use cases.

0 commit comments

Comments
 (0)