Skip to content
This repository was archived by the owner on Jun 26, 2024. It is now read-only.

Commit 11a8837

Browse files
committed
ci: get CI working again
In commit ea79796 ("update to operator-sdk 1.3.0 (#848)"), we upgraded controller-gen to 0.8.0. However, v0.8.0 requires go 1.17 or greater, which is currently unavailable in Red Hat's container registries (i.e. there's no container on catalog.redhat.com); consequently, SBO is built with go 1.16. Until that is rectified, downgrade controller-gen to 0.7.0, which builds with go 1.16. At the same time, use `go install` instead of the deprecated `go get` when we install local build tools, such as controller-gen, yq, and kustomize. This requires a version bump of kustomize to work correctly as well as adding an extra step to install a recent version of go in the non-OLM github actions acceptance test runner. Finally, with the release of go 1.18, our go linting needs to become aware of this new release, since our linting runs with the latest release of go. This can be fixed by updating the golangci/golangci-lint runner to v1.45.2; since v1.45.1, it will autodetect the language version of a project. Signed-off-by: Andy Sadler <[email protected]>
1 parent 5060f43 commit 11a8837

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

.github/workflows/pr-checks.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ jobs:
228228
with:
229229
start-minikube: true
230230

231+
- name: Set up Go
232+
uses: actions/setup-go@v2
233+
with:
234+
go-version: "^1.16"
235+
231236
- name: Setup umoci cli
232237
run: |
233238
curl -Lo umoci https://github.com/opencontainers/umoci/releases/download/v${UMOCI_VERSION}/umoci.amd64

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ lint-go-code: $(GOLANGCI_LINT_BIN) fmt vet
7878
$(Q)GOFLAGS="$(GOFLAGS)" GOCACHE="$(GOCACHE)" $(OUTPUT_DIR)/golangci-lint ${V_FLAG} run --deadline=30m
7979

8080
$(GOLANGCI_LINT_BIN):
81-
$(Q)curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./out v1.44.0
81+
$(Q)curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./out v1.45.2
8282

8383
.PHONY: lint-python-code
8484
## Check the python code

hack/common.mk

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,37 +88,37 @@ gen-mocks: mockgen
8888
# Download controller-gen locally if necessary
8989
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
9090
controller-gen:
91-
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0)
91+
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0)
9292

9393
# Download kustomize locally if necessary
9494
KUSTOMIZE = $(shell pwd)/bin/kustomize
9595
kustomize:
96-
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
96+
$(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
9797

98-
# go-get-tool will 'go get' any package $2 and install it to $1.
99-
define go-get-tool
98+
# go-install-tool will 'go install' any package $2 and install it to $1.
99+
define go-install-tool
100100
@[ -f $(1) ] || { \
101101
set -e ;\
102102
TMP_DIR=$$(mktemp -d) ;\
103103
cd $$TMP_DIR ;\
104104
go mod init tmp ;\
105105
echo "Downloading $(2)" ;\
106-
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
106+
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
107107
rm -rf $$TMP_DIR ;\
108108
}
109109
endef
110110

111111
YQ = $(shell pwd)/bin/yq
112112
yq:
113-
$(call go-get-tool,$(YQ),github.com/mikefarah/yq/[email protected])
113+
$(call go-install-tool,$(YQ),github.com/mikefarah/yq/[email protected])
114114

115115
KUBECTL_SLICE = $(shell pwd)/bin/kubectl-slice
116116
kubectl-slice:
117-
$(call go-get-tool,$(KUBECTL_SLICE),github.com/patrickdappollonio/[email protected])
117+
$(call go-install-tool,$(KUBECTL_SLICE),github.com/patrickdappollonio/[email protected])
118118

119119
MOCKGEN = $(shell pwd)/bin/mockgen
120120
mockgen:
121-
$(call go-get-tool,$(MOCKGEN),github.com/golang/mock/[email protected])
121+
$(call go-install-tool,$(MOCKGEN),github.com/golang/mock/[email protected])
122122

123123
.PHONY: opm
124124
OPM = $(shell pwd)/bin/opm
@@ -136,4 +136,4 @@ OPM = $(shell which opm)
136136
endif
137137
endif
138138

139-
all: build
139+
all: build

pkg/naming/naming.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var TemplateError = errors.New("please check the namingStrategy template provide
1111

1212
var templateFunctions = map[string]interface{}{
1313
"upper": strings.ToUpper,
14-
"title": strings.Title,
14+
"title": strings.Title, //nolint
1515
"lower": strings.ToLower,
1616
}
1717

pkg/reconcile/pipeline/context/service/service_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ var _ = Describe("Service", func() {
139139
}
140140
ul := &unstructured.UnstructuredList{}
141141
// compute kind
142-
kind := strings.Title(gvr.Resource)[:len(gvr.Resource)-1]
142+
kind := strings.Title(gvr.Resource)[:len(gvr.Resource)-1] //nolint
143143

144144
gvk := gvr.GroupVersion().WithKind(kind)
145145
ou := resource(gvk, "child1", ns, id)
@@ -178,7 +178,7 @@ var _ = Describe("Service", func() {
178178
for _, gvr := range bindableResourceGVRs {
179179
ul := &unstructured.UnstructuredList{}
180180
// compute kind
181-
kind := strings.Title(gvr.Resource)[:len(gvr.Resource)-1]
181+
kind := strings.Title(gvr.Resource)[:len(gvr.Resource)-1] //nolint
182182
// fix for ConfigMap
183183
if kind == "Configmap" {
184184
kind = "ConfigMap"

0 commit comments

Comments
 (0)