Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 127 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Build
name: CI
on:
push:

Expand All @@ -17,13 +17,135 @@ jobs:
uses: withgraphite/graphite-ci-action@v0.0.9
with:
graphite_token: ${{ secrets.GRAPHITE_TOKEN }}
build:

lint:
name: Lint
runs-on: ubuntu-latest
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
env:
GOPRIVATE: github.com/weka
steps:
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.SCALAR_WORKERS_APP_ID }}
private-key: ${{ secrets.SCALAR_WORKERS_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}

- name: Setup access for private go modules
run: |
git config --global url."https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/".insteadOf https://github.com/
git config --global url."https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/".insteadOf git@github.com:
echo "machine github.com login x-access-token password ${{ steps.app-token.outputs.token }}" > ~/.netrc
chmod 600 ~/.netrc

- uses: actions/checkout@v6
with:
submodules: recursive
token: ${{ steps.app-token.outputs.token }}

- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: false

- uses: golangci/golangci-lint-action@v9
with:
version: v2.9.0
only-new-issues: true

static-checks:
name: Static Checks (deadcode)
runs-on: ubuntu-latest
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
env:
GOPRIVATE: github.com/weka
steps:
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.SCALAR_WORKERS_APP_ID }}
private-key: ${{ secrets.SCALAR_WORKERS_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}

- name: Setup access for private go modules
run: |
git config --global url."https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/".insteadOf https://github.com/
git config --global url."https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/".insteadOf git@github.com:
echo "machine github.com login x-access-token password ${{ steps.app-token.outputs.token }}" > ~/.netrc
chmod 600 ~/.netrc

- uses: actions/checkout@v6
with:
submodules: recursive
token: ${{ steps.app-token.outputs.token }}

- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
cache-dependency-path: |
go.sum
pkg/weka-k8s-api/go.sum
pkg/go-steps-engine/go.sum

- name: Install deadcode
run: go install golang.org/x/tools/cmd/deadcode@latest

- name: Run deadcode
run: deadcode -test ./...

security:
name: Security (govulncheck)
runs-on: ubuntu-latest
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
env:
GOPRIVATE: github.com/weka
steps:
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.SCALAR_WORKERS_APP_ID }}
private-key: ${{ secrets.SCALAR_WORKERS_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}

- name: Setup access for private go modules
run: |
git config --global url."https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/".insteadOf https://github.com/
git config --global url."https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/".insteadOf git@github.com:
echo "machine github.com login x-access-token password ${{ steps.app-token.outputs.token }}" > ~/.netrc
chmod 600 ~/.netrc

- uses: actions/checkout@v6
with:
submodules: recursive
token: ${{ steps.app-token.outputs.token }}

- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
cache-dependency-path: |
go.sum
pkg/weka-k8s-api/go.sum
pkg/go-steps-engine/go.sum

- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest

- name: Run govulncheck
run: govulncheck ./...

test:
name: Test
runs-on: ubuntu-latest
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
env:
GOPRIVATE: github.com/weka
steps:
- uses: actions/create-github-app-token@v2
id: app-token
Expand All @@ -39,16 +161,14 @@ jobs:
echo "machine github.com login x-access-token password ${{ steps.app-token.outputs.token }}" > ~/.netrc
chmod 600 ~/.netrc

- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: recursive
token: ${{ steps.app-token.outputs.token }}

- name: Setup Go
uses: actions/setup-go@v5
- uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
go-version-file: go.mod
cache: true
cache-dependency-path: |
go.sum
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/conventional-commits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Linting commits
uses: wagoid/commitlint-github-action@v6
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/dagger_ci_on_merge_queue_plan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
echo "Labels: ${{ toJson(github.event.pull_request.labels) }}"

- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Check if all commits are chore/docs
id: check_commits
Expand Down Expand Up @@ -123,22 +123,22 @@ jobs:
owner: ${{ github.repository_owner }}

- name: Checkout operator repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
path: operator
submodules: true
token: ${{ steps.app-token.outputs.token }}

- name: Checkout wekai repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
repository: weka/wekai
token: ${{ steps.app-token.outputs.token }}
path: wekai
ref: fef89c34562a7c289d4bd1bf1f6f4c634cefcd9a

- name: Checkout testing repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
repository: weka/weka-k8s-testing
token: ${{ steps.app-token.outputs.token }}
Expand Down Expand Up @@ -294,13 +294,13 @@ jobs:
owner: ${{ github.repository_owner }}

- name: Checkout operator repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
path: operator
token: ${{ steps.app-token.outputs.token }}

- name: Checkout testing repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
repository: weka/weka-k8s-testing
token: ${{ steps.app-token.outputs.token }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/helm_lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
if: needs.optimize_ci.outputs.skip == 'false'
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Configure git
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
chmod 600 ~/.netrc

- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
token: ${{ steps.app-token.outputs.token }}
Expand All @@ -73,7 +73,7 @@ jobs:
mkdir -p dockerfile_files
cp -r ~/.gitconfig ~/.netrc dockerfile_files/
- name: Setup Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version: "1.24.3"
cache: true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run_upgrade_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ jobs:
chmod 600 ~/.netrc

- name: Check out weka-k8s-testing private repo
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
repository: weka/weka-k8s-testing
token: ${{ steps.app-token.outputs.token }}
submodules: recursive

- uses: actions/setup-go@v5
- uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
cache: true
Expand All @@ -137,7 +137,7 @@ jobs:
OPERATOR_VERSION: ${{ needs.get_operator_version.outputs.operator_version }}
steps:
- name: Check out current repo
uses: actions/checkout@v4
uses: actions/checkout@v6

- uses: azure/k8s-set-context@v4
name: Set K8s context
Expand Down
39 changes: 39 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: "2"

run:
timeout: 5m
tests: true
modules-download-mode: readonly

linters:
enable:
- errcheck # Checks for unchecked errors
- govet # Official Go static analyzer
- ineffassign # Detects ineffectual assignments
- staticcheck # Advanced static analysis
- unused # Finds unused code (within packages)
- misspell # Catches spelling mistakes
- gocritic # Extensible linter with performance/diagnostic/style checks
settings:
errcheck:
check-type-assertions: true
check-blank: true
govet:
enable:
- shadow
gocritic:
enabled-tags:
- diagnostic
- performance
- style
exclusions:
# Kubernetes controllers often have long functions due to reconciliation logic
rules:
- path: internal/controllers/
text: "cognitive complexity|cyclomatic complexity"
linters:
- gocritic

issues:
max-issues-per-linter: 0
max-same-issues: 0
Comment on lines +30 to +39
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In golangci-lint v2 configuration format (as indicated by version: "2" on line 1), issues is no longer a valid top-level section. The max-issues-per-linter and max-same-issues settings should be placed under linters.exclusions instead. This will likely produce a configuration error or be silently ignored.

The correct location would be:

linters:
  exclusions:
    max-issues-per-linter: 0
    max-same-issues: 0
Suggested change
# Kubernetes controllers often have long functions due to reconciliation logic
rules:
- path: internal/controllers/
text: "cognitive complexity|cyclomatic complexity"
linters:
- gocritic
issues:
max-issues-per-linter: 0
max-same-issues: 0
max-issues-per-linter: 0
max-same-issues: 0
# Kubernetes controllers often have long functions due to reconciliation logic
rules:
- path: internal/controllers/
text: "cognitive complexity|cyclomatic complexity"
linters:
- gocritic

Copilot uses AI. Check for mistakes.
8 changes: 5 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
repos:
- repo: local
hooks:
- id: make-fmt-vet
name: Format code and vet
entry: make fmt vet
- id: golangci-lint
name: golangci-lint
entry: golangci-lint run --new-from-rev=HEAD --fix
language: system
types: [go]
pass_filenames: false
stages: [pre-commit]
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,25 @@ fmt: ## Run go fmt against code.
vet: ## Run go vet against code.
go vet ./...

.PHONY: lint
lint: lint-go lint-deadcode ## Run all linters (golangci-lint and deadcode).
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The help text says "Run all linters (golangci-lint and deadcode)" but lint-govulncheck is also defined below and not included. The comment is misleading — it should either include lint-govulncheck as a dependency or clarify the comment to say the lint target doesn't include govulncheck (e.g., "Run fast linters" or just "Run golangci-lint and deadcode").

Suggested change
lint: lint-go lint-deadcode ## Run all linters (golangci-lint and deadcode).
lint: lint-go lint-deadcode ## Run golangci-lint and deadcode linters.

Copilot uses AI. Check for mistakes.

.PHONY: lint-go
lint-go: ## Run golangci-lint against code.
golangci-lint run ./...

.PHONY: lint-deadcode
lint-deadcode: ## Run deadcode analysis (includes test coverage).
deadcode -test ./...

.PHONY: lint-govulncheck
lint-govulncheck: ## Run govulncheck against known vulnerability database.
govulncheck ./...

.PHONY: lint-fix
lint-fix: ## Run golangci-lint and auto-fix issues where possible.
golangci-lint run --fix ./...

.PHONY: test
test: ## Run tests.
go test -v ./internal/... -coverprofile cover.out
Expand Down
Loading