Skip to content
Draft
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
56 changes: 56 additions & 0 deletions config/jobs/kubernetes/sig-security/srctl-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
presubmits:
kubernetes/sig-security:
- name: pull-sig-security-srctl-tests
cluster: eks-prow-build-cluster
annotations:
testgrid-dashboards: sig-security-srctl
testgrid-create-test-group: "true"
description: Run unit tests for srctl
run_if_changed: "^sig-security-tooling/srctl/"
branches:
- main
decorate: true
spec:
containers:
- image: public.ecr.aws/docker/library/golang:1.25@sha256:ed520ab5bed37ce887012c050ced60f7d52dfcd212e3dc6fdd8951e9c4e25c1a
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've seen your comment

Special Note: The ecr golang image was used instead of the e2e kubekins image because that image is way oversized for the tasks here of running a few small golang unit tests and running a linting tool and the ecr doesn't impose the rate limiting problems that docker hub does on the kubernetes project. Oversized images mean more code surface for vulnerabilities as well as more resources to both fetch and use the image. The long term concern with this requiring manual image updating currently as the generic image auto-bumper won't work with this though a tool can be developed for this purpose and the manual work is very minimal.

Tbh I'll use whatever is maintained by sig test-infra and they think is a good image. Maybe it would be interesting to ask them what they think is a good image for our use case?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

They told me the image I chose was fine.
https://kubernetes.slack.com/archives/C09QZ4DQB/p1776265122708969

On the flip side I do need to do some work on the golangci-lint side because the version for that that gets used should be decided in the source directory of srctl, not here in test-infra so I need to update that which means a PR over there combined with this PR being updated to take advantage of that.

command: ['go']
workingDir: sig-security-tooling/srctl
args: ['test', '-v', '-cover', './...']
resources:
limits:
cpu: 1
memory: "256Mi"
requests:
cpu: 1
memory: "256Mi"

- name: pull-sig-security-srctl-lint
cluster: eks-prow-build-cluster
annotations:
testgrid-dashboards: sig-security-srctl
testgrid-create-test-group: "true"
description: Run linters for srctl
run_if_changed: "^sig-security-tooling/srctl/"
branches:
- main
decorate: true
spec:
containers:
- image: public.ecr.aws/docker/library/golang:1.25@sha256:ed520ab5bed37ce887012c050ced60f7d52dfcd212e3dc6fdd8951e9c4e25c1a
command:
- /bin/bash
- -c
- |
set -euo pipefail
cd sig-security-tooling/srctl
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.11.4
Comment on lines +44 to +47
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

maybe would be cool to have an image that already includes golangci-lint?

Copy link
Copy Markdown
Author

@Daniel-Giszpenc Daniel-Giszpenc Apr 15, 2026

Choose a reason for hiding this comment

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

I could try figuring out where Kubernetes keeps their images and try that, it would fit well. I'll ask what the test-infra slack thinks.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would strongly encourage moving this into the sig security repo and generally putting test target definitions and verisons there, as breifly discussed in the slack thread

This makes it easier for contributors to reproduce, and makes it safe to iterate on the options and versions (because the PR that changes them will run the tests before merge)

export PATH=$PATH:$(go env GOPATH)/bin
golangci-lint run ./...
resources:
limits:
cpu: 1
memory: "512Mi"
requests:
cpu: 1
memory: "512Mi"