Skip to content

TCL-4373: Fix linting issues in workflows and docs#13

Open
jplimack-ai wants to merge 14 commits intomasterfrom
jplimack/tcl-4373-update-sriov-network-operator-fork-deps-to-k8s-v0342
Open

TCL-4373: Fix linting issues in workflows and docs#13
jplimack-ai wants to merge 14 commits intomasterfrom
jplimack/tcl-4373-update-sriov-network-operator-fork-deps-to-k8s-v0342

Conversation

@jplimack-ai
Copy link
Copy Markdown
Collaborator

@jplimack-ai jplimack-ai commented Mar 5, 2026

Cleans up GitHub Actions workflows, markdown docs, and Go source to pass all linting with golangci-lint v2 and trunk. This is a prep step for the larger dependency upgrade.

Workflow changes:

  • Unnecessary quotes removedname: values, branches: arrays, github-token: expressions, prow-commands converted to >- block scalar
  • Action versions bumpedactions/checkout v3→v4, actions/setup-go v2→v5, github/codeql-action v2→v3, golangci-lint-action v3→v6, upload-artifact v3→v4
  • Runner images updatedubuntu-20.04/ubuntu-22.04ubuntu-24.04-4core for image build jobs
  • Actionlint CI added — new workflow to lint all workflow files on PRs touching .github/workflows/

Linting & tooling:

  • golangci-lint v1→v2 — migrated .golangci.yml to v2 format, bumped version in Makefile and CI from v1.55.2 to v2.10.1, all linters grouped by domain with inline comments
  • ENVTEST_K8S_VERSION defined — fixes setup-envtest failing to download etcd/kube-apiserver binaries
  • make lint-fix target added — runs golangci-lint with --fix
  • GOOS=linux — set in Makefile lint targets, .vscode/settings.json, and trunk config for correct cross-compilation analysis on macOS
  • Trunk config — added .trunk/trunk.yaml with markdownlint, yamllint, actionlint, shellcheck, hadolint, and golangci-lint2 configured

Staticcheck fixes (32 issues):

  • QF1001 — applied De Morgan's law to simplify negated boolean expressions
  • QF1003 — converted if-else chains on single variables to tagged switch statements
  • QF1008 — removed redundant embedded field selectors (instance.ObjectMeta.Finalizersinstance.Finalizers)
  • QF1012 — replaced WriteString(fmt.Sprintf(...)) with fmt.Fprintf
  • S1009 — removed nil checks before len() (nil slices return 0)
  • SA1006 — fixed printf-style functions called with dynamic format strings
  • SA1019 — replaced deprecated APIs: wait.PollImmediatewait.PollUntilContextCancel, wait.ErrWaitTimeoutwait.Interrupted(), k8s.io/utils/pointerk8s.io/utils/ptr
  • SA6005 — replaced strings.ToLower comparison with strings.EqualFold

Doc changes:

  • MD025 fixed — removed redundant title: from YAML front matter in 4 design docs
  • Trailing whitespace fixedparallel-node-config.md, software-bridge-management.md
  • Markdown formatting fixes from prettier/markdownlint autofix across all docs

Ticket: TCL-4373

Remove unnecessary quoted strings in GitHub Actions workflow YAML files,
bump action versions (checkout@v4, codeql@v3), upgrade runner images to
ubuntu-24.04, fix trailing whitespace in markdown, resolve duplicate
top-level headings (MD025), and add trunk + actionlint configuration.

TCL-4373
@jplimack-ai jplimack-ai self-assigned this Mar 5, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 5, 2026

Thanks for your PR,
To run vendors CIs, Maintainers can use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs, Maintainers can use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

Jake Plimack added 5 commits March 4, 2026 19:09
setup-envtest needs a version to download etcd/kube-apiserver binaries.
Without it, KUBEBUILDER_ASSETS resolves to empty and tests fail with
"etcd: executable file not found in $PATH".
- Migrate .golangci.yml to v2 format with linters grouped by domain
- Upgrade golangci-lint from v1.55.2 to v2.10.1 in Makefile and CI
- Add ENVTEST_K8S_VERSION to fix envtest etcd resolution
- Add lint-fix make target, set GOOS=linux for lint
- Fix all staticcheck issues: QF1001 (De Morgan's law), QF1003 (tagged
  switch), QF1008 (embedded field selectors), QF1012 (Fprintf),
  S1009 (nil check before len), SA1006 (printf format string),
  SA1019 (deprecated APIs: wait.PollImmediate, pointer.Int64Ptr),
  SA6005 (strings.EqualFold)
- Replace deprecated k8s.io/utils/pointer with k8s.io/utils/ptr
- Replace deprecated wait.PollImmediate with wait.PollUntilContextCancel
- Add .vscode/settings.json and trunk config for GOOS=linux
Remove .vscode/* from .gitignore so IDE settings (GOOS=linux) are
shared. Update go.mod version from 1.22.4 to 1.22.12.
@jplimack-ai jplimack-ai marked this pull request as ready for review March 5, 2026 02:49
@coveralls
Copy link
Copy Markdown

coveralls commented Mar 5, 2026

Pull Request Test Coverage Report for Build 22705733528

Details

  • 47 of 82 (57.32%) changed or added relevant lines in 14 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.03%) to 47.386%

Changes Missing Coverage Covered Lines Changed/Added Lines %
controllers/sriovnetworkpoolconfig_controller.go 4 5 80.0%
pkg/plugins/generic/generic_plugin.go 4 5 80.0%
pkg/webhook/validate.go 1 2 50.0%
pkg/daemon/daemon.go 7 9 77.78%
pkg/utils/shutdown.go 0 2 0.0%
pkg/host/internal/kernel/kernel.go 0 3 0.0%
pkg/utils/cluster.go 0 3 0.0%
pkg/daemon/writer.go 0 5 0.0%
pkg/host/internal/sriov/sriov.go 8 13 61.54%
test/util/util.go 15 27 55.56%
Files with Coverage Reduction New Missed Lines %
controllers/helper.go 2 69.29%
Totals Coverage Status
Change from base Build 13065540483: 0.03%
Covered Lines: 7277
Relevant Lines: 15357

💛 - Coveralls

Jake Plimack added 7 commits March 4, 2026 19:51
Add t.Parallel() to safe standard Go tests across 4 packages and
add -count=1 -parallel=4 to Makefile test targets. Switch all CI
jobs from ubuntu-24.04-4core (unavailable) to ubuntu-latest.
Ginkgo suites reject go test's -parallel flag and fail immediately.
The t.Parallel() calls still provide parallelism for standard tests
using the default GOMAXPROCS concurrency.
The test assumed node1 always drains before node2, but with
MaxConcurrentReconciles=50 whichever goroutine grabs the mutex
first wins. Use expectNumberOfDrainingNodes to detect which node
drained, then drive the rest of the test from that result.
Actionlint rejects constant false conditions. Use vars.ENABLE_E2E
so the jobs are skipped by default but can be enabled by setting
the repo variable.
Pure Go E2E test that validates operator deployment and reconciliation
in a real Kind cluster without SR-IOV hardware. Uses Kind SDK, Docker
SDK, and Helm SDK as Go libraries. Adds CI job on ubuntu-24.04-4core.

TCL-4378
Comment thread go.mod Outdated

// examine DeletionTimestamp to determine if object is under deletion
if instance.ObjectMeta.DeletionTimestamp.IsZero() {
if instance.DeletionTimestamp.IsZero() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is this a linter issue fix or a logic change?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

lint, ObjectMeta is embedded and doesnt need to be used to reach its fields

Comment thread pkg/daemon/daemon.go
UpdateFunc: dn.operatorConfigChangeHandler,
})

rand.Seed(time.Now().UnixNano())
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

lol, love to see it

Comment on lines +178 to +180
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
err = wait.PollUntilContextCancel(ctx, time.Second, true, func(ctx context.Context) (bool, error) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this one also doesn't seem like a linting issue in a workflow or doc

not that I'm opposed to it but it's really hard to review PRs like this when meaningful changes are sprinkled into a sea of linter changes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

my small human brain is feeble

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

image

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I get it, but it's hard to have confidence that I'm giving you a good review when different logical changes are mixed together, and the difficulty scales superlinarly with PR size.

}
err := cs.Pods(namespace).DeleteCollection(context.Background(), metav1.DeleteOptions{
GracePeriodSeconds: pointer.Int64Ptr(0),
GracePeriodSeconds: ptr.To[int64](0),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should we update the linter/ai rules/etc to prefer new over ptr.To?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this isnt go 1.26, but i should probably do a larger review and see if we can pull in upstream before making changes

@lbogdan-together
Copy link
Copy Markdown

This is a fork, are we sure we want to do all this?

@jplimack-ai
Copy link
Copy Markdown
Collaborator Author

This is a fork, are we sure we want to do all this?

good question, ill do another review and see if we can pull in latest upstream first and where that lands us, as well as turning our changes into a git-patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants