Skip to content

Commit ed7199f

Browse files
charlesgongclaude
andcommitted
chore(SREP-4485): fix lint CI by switching to --new-from-rev in Makefile
Replace unreliable `new: true` golangci.yml setting with `--new-from-rev` passed via Makefile. In Prow CI uses PULL_BASE_SHA; locally falls back to origin/HEAD. Also updates boilerplate (UBI image, OWNERS_ALIASES, commit hash), removes stale .claude/commands/pre-commit.md, and cleans up fips.go. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 2a59cd4 commit ed7199f

9 files changed

Lines changed: 19 additions & 104 deletions

File tree

.claude/commands/pre-commit.md

Lines changed: 0 additions & 94 deletions
This file was deleted.

OWNERS_ALIASES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
aliases:
66
srep-functional-team-aurora:
77
- AlexSmithGH
8+
- BATMAN-JD
89
- dakotalongRH
910
- eth1030
1011
- joshbranham
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b6e7575196e8c17274c85d2c22178ad51290c237
1+
c2342f1bcec55d87fd028e5c1d7f105c745eb32e

boilerplate/openshift/golang-osd-operator/OWNERS_ALIASES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
aliases:
66
srep-functional-team-aurora:
77
- AlexSmithGH
8+
- BATMAN-JD
89
- dakotalongRH
910
- eth1030
1011
- joshbranham

boilerplate/openshift/golang-osd-operator/golangci.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,9 @@ linters:
6262

6363
run:
6464
timeout: 5m
65-
# Only check new code, not existing issues
66-
# This uses git to compare against the base branch (typically master/main)
67-
new: true
68-
# Alternatively, you can specify a specific revision:
69-
# new-from-rev: origin/master
65+
# Incremental linting (new-from-rev) is passed via the Makefile's
66+
# go-check target. In CI it uses PULL_BASE_SHA (guaranteed to exist
67+
# even in shallow clones); locally it falls back to origin/HEAD.
7068

7169
formatters:
7270
enable:

boilerplate/openshift/golang-osd-operator/standard.mk

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,19 @@ docker-login:
172172
mkdir -p ${CONTAINER_ENGINE_CONFIG_DIR}
173173
@${CONTAINER_ENGINE} login -u="${REGISTRY_USER}" -p="${REGISTRY_TOKEN}" quay.io
174174

175+
# Only lint new/changed code. In Prow CI, PULL_BASE_SHA points to the
176+
# base commit and is guaranteed to exist in the checkout (even shallow
177+
# clones). Locally, fall back to the default branch ref.
178+
ifdef PULL_BASE_SHA
179+
LINT_NEW_FROM_REV := $(PULL_BASE_SHA)
180+
else
181+
LINT_NEW_FROM_REV := $(shell git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/||')
182+
endif
183+
175184
.PHONY: go-check
176185
go-check: ## Golang linting and other static analysis
177186
${CONVENTION_DIR}/ensure.sh golangci-lint
178-
${GOENV} GOLANGCI_LINT_CACHE=${GOLANGCI_LINT_CACHE} golangci-lint run -c ${CONVENTION_DIR}/golangci.yml ./...
187+
${GOENV} GOLANGCI_LINT_CACHE=${GOLANGCI_LINT_CACHE} golangci-lint run -c ${CONVENTION_DIR}/golangci.yml $(if $(LINT_NEW_FROM_REV),--new-from-rev=$(LINT_NEW_FROM_REV)) ./...
179188

180189
.PHONY: go-generate
181190
go-generate:

build/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ WORKDIR ${OPERATOR_PATH}
66
# Build
77
RUN make go-build
88

9-
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.7-1778072020
9+
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.7-1778562320
1010
ENV OPERATOR_PATH=/gcp-project-operator \
1111
OPERATOR_BIN=gcp-project-operator
1212

build/Dockerfile.olm-registry

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ COPY ${SAAS_OPERATOR_DIR} manifests
44
RUN initializer --permissive
55

66
# ubi-micro does not work for clusters with fips enabled unless we make OpenSSL available
7-
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.7-1778072020
7+
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.7-1778562320
88

99
COPY --from=builder /bin/registry-server /bin/registry-server
1010
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe

fips.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ import (
1212
)
1313

1414
func init() {
15-
_, _ = fmt.Println("***** Starting with FIPS crypto enabled *****")
15+
fmt.Println("***** Starting with FIPS crypto enabled *****")
1616
}

0 commit comments

Comments
 (0)