-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathmise.toml
More file actions
129 lines (107 loc) · 3.46 KB
/
mise.toml
File metadata and controls
129 lines (107 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
[tools]
go = "1.26.2"
ctlptl = "latest"
kubie = "latest"
tilt = "latest"
kubebuilder = "latest"
[tasks.build]
description = "Build Naiserator"
run = """
go build -o cmd/naiserator/naiserator ./cmd/naiserator
go build -o cmd/naiserator_webhook/naiserator_webhook ./cmd/naiserator_webhook
"""
[tasks.docker]
description = "Build Docker image"
run = """
version=$(./version.sh)
docker image build \
-t navikt/naiserator:${version} \
-t navikt/naiserator \
-t naiserator \
-t navikt/naiserator:latest \
-f Dockerfile .
"""
[tasks."docker:push"]
description = "Push Docker image"
run = """
docker image push navikt/naiserator:$(cat ./version)
docker image push navikt/naiserator:latest
"""
[tasks."docker:test-image"]
description = "Build and push test image"
env = { VER = "test-image" }
run = """
docker image build --platform=linux/amd64 \
-t europe-north1-docker.pkg.dev/nais-io/nais/images/naiserator:${VER} .
docker image push europe-north1-docker.pkg.dev/nais-io/nais/images/naiserator:${VER}
"""
[tasks.local]
description = "Run Naiserator locally"
run = "go run cmd/naiserator/main.go --kubeconfig=${KUBECONFIG} --bind=127.0.0.1:8080"
[tasks.install]
description = "Install Naiserator"
run = "cd cmd/naiserator && go install"
[tasks."check"]
description = "Run all static analysis tools"
depends = [
'fmt',
'check:staticcheck',
'check:vulncheck',
'check:deadcode',
'check:vet',
]
[tasks."check:deadcode"]
description = "Run deadcode"
run = "go tool golang.org/x/tools/cmd/deadcode -test ./..."
[tasks."check:gosec"]
description = "Run gosec"
run = "go tool github.com/securego/gosec/v2/cmd/gosec --exclude-generated -terse ./..."
[tasks."check:staticcheck"]
description = "Run staticcheck"
run = "go tool honnef.co/go/tools/cmd/staticcheck ./..."
[tasks."check:vulncheck"]
description = "Run vulncheck"
run = "go tool golang.org/x/vuln/cmd/govulncheck ./..."
[tasks."check:vet"]
description = "Run go vet"
wait_for = ['fmt']
run = "go vet ./..."
[tasks."fmt"]
description = "Format all code"
depends = ['fmt:go', 'fmt:gofix']
[tasks."fmt:go"]
description = "Format go code using gofumpt"
run = "go tool mvdan.cc/gofumpt -w ./"
[tasks."fmt:gofix"]
description = "Fix runs the Go fix tool (cmd/fix) on the named packages and applies suggested fixes."
run = "go fix ./..."
[tasks.setup-envtest]
description = "Download envtest binaries for integration tests"
run = """
LOCALBIN=$(pwd)/bin
ENVTEST_VERSION=release-0.23
ENVTEST_K8S_VERSION=1.33.0
ENVTEST=${LOCALBIN}/setup-envtest
mkdir -p "${LOCALBIN}"
if [ ! -f "${ENVTEST}-${ENVTEST_VERSION}" ]; then
echo "Downloading sigs.k8s.io/controller-runtime/tools/setup-envtest@${ENVTEST_VERSION}"
rm -f "${ENVTEST}" || true
GOBIN="${LOCALBIN}" go install "sigs.k8s.io/controller-runtime/tools/setup-envtest@${ENVTEST_VERSION}"
mv "${ENVTEST}" "${ENVTEST}-${ENVTEST_VERSION}"
fi
ln -sf "${ENVTEST}-${ENVTEST_VERSION}" "${ENVTEST}"
echo "Setting up envtest binaries for Kubernetes version ${ENVTEST_K8S_VERSION}..."
${ENVTEST} use ${ENVTEST_K8S_VERSION} --bin-dir "${LOCALBIN}" || {
echo "Error: Failed to set up envtest binaries for version ${ENVTEST_K8S_VERSION}."
exit 1
}
"""
[tasks.test]
description = "Run all tests"
depends = ['setup-envtest', 'test:go', 'test:goldenfiles']
[tasks."test:go"]
description = "Run Go tests"
run = "go test --race --cover --coverprofile=cover.out ./..."
[tasks."test:goldenfiles"]
description = "Run just Golden files tests"
run = "go test ./pkg/resourcecreator/resourcecreator_golden_files_test.go -count=1"