-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: merged from main & fixed run sparrow test
Signed-off-by: Bruno Bressi <[email protected]>
- Loading branch information
Showing
51 changed files
with
1,134 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# This workflow installs 1 instance of sparrow and | ||
# verify the API output | ||
|
||
name: End2End Testing | ||
on: | ||
push: | ||
paths: | ||
- 'chart/**' | ||
|
||
jobs: | ||
end2end: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
- name: Set up K3S | ||
uses: debianmaster/actions-k3s@master | ||
id: k3s | ||
with: | ||
version: 'v1.26.9-k3s1' | ||
- name: Check Cluster | ||
run: | | ||
kubectl get nodes | ||
- name: Check Coredns Deployment | ||
run: | | ||
kubectl -n kube-system rollout status deployment/coredns --timeout=60s | ||
STATUS=$(kubectl -n kube-system get deployment coredns -o jsonpath={.status.readyReplicas}) | ||
if [[ $STATUS -ne 1 ]] | ||
then | ||
echo "Deployment coredns not ready" | ||
kubectl -n kube-system get events | ||
exit 1 | ||
else | ||
echo "Deployment coredns OK" | ||
fi | ||
- name: Check Metricsserver Deployment | ||
run: | | ||
kubectl -n kube-system rollout status deployment/metrics-server --timeout=60s | ||
STATUS=$(kubectl -n kube-system get deployment metrics-server -o jsonpath={.status.readyReplicas}) | ||
if [[ $STATUS -ne 1 ]] | ||
then | ||
echo "Deployment metrics-server not ready" | ||
kubectl -n kube-system get events | ||
exit 1 | ||
else | ||
echo "Deployment metrics-server OK" | ||
fi | ||
- name: Setup Helm | ||
run: | | ||
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash | ||
helm version | ||
- name: Get Image Tag | ||
id: version | ||
run: echo "value=commit-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
- name: Install Sparrow | ||
run: | | ||
helm upgrade -i sparrow \ | ||
--atomic \ | ||
--timeout 300s \ | ||
--set extraArgs.loaderType=file \ | ||
--set extraArgs.loaderFilePath=/runconfig/checks.yaml \ | ||
--set image.tag=${{ steps.version.outputs.value }} \ | ||
chart | ||
- name: Check Pods | ||
run: | | ||
kubectl get pods | ||
- name: Wait for Sparrow | ||
run: | | ||
sleep 60 | ||
- name: Healthcheck | ||
run: | | ||
kubectl create job curl --image=quay.io/curl/curl:latest -- curl -f -v -H 'Content-Type: application/json' http://sparrow:8080/v1/metrics/health | ||
kubectl wait --for=condition=complete job/curl | ||
STATUS=$(kubectl get job curl -o jsonpath={.status.succeeded}) | ||
if [[ $STATUS -ne 1 ]] | ||
then | ||
echo "Job failed" | ||
kubectl logs -ljob-name=curl | ||
kubectl delete job curl | ||
exit 1 | ||
else | ||
echo "Job OK" | ||
kubectl delete job curl | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
linters-settings: | ||
depguard: | ||
# new configuration | ||
rules: | ||
logger: | ||
deny: | ||
# logging is allowed only by logutils.Log, | ||
# logrus is allowed to use only in logutils package. | ||
- pkg: "github.com/sirupsen/logrus" | ||
desc: logging is allowed only by logutils.Log | ||
dupl: | ||
threshold: 100 | ||
funlen: | ||
lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. | ||
statements: 50 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 3 | ||
gocritic: | ||
enabled-tags: | ||
- diagnostic | ||
- experimental | ||
- opinionated | ||
- performance | ||
- style | ||
disabled-checks: | ||
- dupImport # https://github.com/go-critic/go-critic/issues/845 | ||
- ifElseChain | ||
- octalLiteral | ||
- whyNoLint | ||
gocyclo: | ||
min-complexity: 15 | ||
gofmt: | ||
rewrite-rules: | ||
- pattern: 'interface{}' | ||
replacement: 'any' | ||
goimports: | ||
local-prefixes: github.com/golangci/golangci-lint | ||
gomnd: | ||
# don't include the "operation" and "assign" | ||
checks: | ||
- argument | ||
- case | ||
- condition | ||
- return | ||
ignored-numbers: | ||
- '0' | ||
- '1' | ||
- '2' | ||
- '3' | ||
ignored-functions: | ||
- strings.SplitN | ||
|
||
govet: | ||
check-shadowing: true | ||
settings: | ||
printf: | ||
funcs: | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf | ||
lll: | ||
line-length: 140 | ||
misspell: | ||
locale: US | ||
nolintlint: | ||
allow-unused: false # report any unused nolint directives | ||
require-explanation: false # don't require an explanation for nolint directives | ||
require-specific: false # don't require nolint directives to be specific about which linter is being skipped | ||
revive: | ||
rules: | ||
- name: unexported-return | ||
disabled: true | ||
- name: unused-parameter | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- bodyclose | ||
- depguard | ||
- dogsled | ||
- dupl | ||
- errcheck | ||
- exportloopref | ||
- funlen | ||
- gocheckcompilerdirectives | ||
- gochecknoinits | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- gomnd | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- nakedret | ||
- noctx | ||
- nolintlint | ||
- revive | ||
- staticcheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- whitespace | ||
|
||
# don't enable: | ||
# - asciicheck | ||
# - scopelint | ||
# - gochecknoglobals | ||
# - gocognit | ||
# - godot | ||
# - godox | ||
# - goerr113 | ||
# - interfacer | ||
# - lll | ||
# - maligned | ||
# - nestif | ||
# - prealloc | ||
# - stylecheck | ||
# - testpackage | ||
# - wsl | ||
|
||
issues: | ||
# Excluding configuration per-path, per-linter, per-text and per-source | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- gomnd | ||
|
||
- path: pkg/golinters/errcheck.go | ||
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" | ||
- path: pkg/commands/run.go | ||
text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" | ||
- path: pkg/commands/run.go | ||
text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." | ||
|
||
- path: pkg/golinters/gofumpt.go | ||
text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." | ||
- path: pkg/golinters/staticcheck_common.go | ||
text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." | ||
- path: pkg/lint/lintersdb/manager.go | ||
text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." | ||
- path: pkg/golinters/unused.go | ||
text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" | ||
- path: test/(fix|linters)_test.go | ||
text: "string `gocritic.go` has 3 occurrences, make it a constant" | ||
|
||
run: | ||
timeout: 5m | ||
skip-dirs: | ||
- test/testdata_etc # test files | ||
- internal/cache # extracted from Go code | ||
- internal/renameio # extracted from Go code | ||
- internal/robustio # extracted from Go code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
repos: | ||
- repo: local | ||
hooks: | ||
- id: go-generate-repo | ||
name: go generate | ||
entry: go | ||
args: [ generate, ./... ] | ||
language: system | ||
types: [ go ] | ||
pass_filenames: false | ||
always_run: true | ||
- repo: https://github.com/tekwizely/pre-commit-golang | ||
rev: v1.0.0-rc.1 | ||
hooks: | ||
- id: go-mod-tidy-repo | ||
- id: go-test-repo-mod | ||
args: [ -race ] | ||
- id: go-vet-repo-mod | ||
- id: go-fumpt-repo | ||
args: [ -l, -w ] | ||
- id: golangci-lint-repo-mod | ||
args: [ --config, .golangci.yaml, --, --fix ] | ||
- repo: https://github.com/norwoodj/helm-docs | ||
rev: "v1.11.3" | ||
hooks: | ||
- id: helm-docs | ||
args: | ||
- --chart-search-root=chart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
* @y-eight @NiklasTreml @puffitos @nico151999 @lvlcn-t | ||
* @y-eight @NiklasTreml @puffitos @nico151999 @lvlcn-t @eumel8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.