Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create boilerplate v5.0.1 to support Go 1.22 #363

Merged
merged 3 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion .ci-operator.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build_root_image:
namespace: openshift
name: release
tag: rhel-8-release-golang-1.21-openshift-4.16
tag: rhel-8-release-golang-1.22-openshift-4.17
2 changes: 1 addition & 1 deletion config/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is used to confirm that the imagestream is valid and working
# the below statement will always be replaced by the source in .ci-operator.yaml
FROM registry.ci.openshift.org/openshift/release:rhel-8-release-golang-1.21-openshift-4.16
FROM registry.ci.openshift.org/openshift/release:rhel-8-release-golang-1.22-openshift-4.17

# TODO: remove this COPY/RUN
COPY build_image-v5.0.0.sh /build.sh
Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfile.appsre
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# To check for existence of an image: https://docs.ci.openshift.org/docs/how-tos/use-registries-in-build-farm/
# Log into build farm's registry and validate the image exists
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.21-openshift-4.16
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.22-openshift-4.17

COPY build_image-v5.0.0.sh /build.sh
RUN /build.sh && rm -f /build.sh
18 changes: 9 additions & 9 deletions config/build_image-v5.0.0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ export GOFLAGS=-mod=mod
###########
# kustomize
###########
KUSTOMIZE_VERSION="v5.3.0"
KUSTOMIZE_VERSION="v5.4.1"
go install sigs.k8s.io/kustomize/kustomize/${KUSTOMIZE_VERSION%%.*}@${KUSTOMIZE_VERSION}

################
# controller-gen
################
CONTROLLER_GEN_VERSION="v0.14.0"
CONTROLLER_GEN_VERSION="v0.15.0"
go install sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_GEN_VERSION}

#############
Expand All @@ -41,13 +41,13 @@ go install k8s.io/code-generator/cmd/openapi-gen@${OPENAPI_GEN_VERSION}
#########
# Latest is only compatible with Go 1.22
# https://github.com/kubernetes-sigs/controller-runtime/issues/2744
ENVTEST_VERSION="bf15e44028f908c790721fc8fe67c7bf2d06a611"
ENVTEST_VERSION="release-0.18"
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@${ENVTEST_VERSION}

##############
# govulncheck
##############
GOVULNCHECK_VERSION="v1.0.3"
GOVULNCHECK_VERSION="v1.1.2"
go install golang.org/x/vuln/cmd/govulncheck@${GOVULNCHECK_VERSION}

#########
Expand All @@ -59,7 +59,7 @@ go install go.uber.org/mock/mockgen@${MOCKGEN_VERSION}
####
# yq
####
YQ_VERSION="v4.40.5"
YQ_VERSION="v4.44.2"
go install github.com/mikefarah/yq/v4@${YQ_VERSION}

# HACK: `go get` creates lots of things under GOPATH that are not group
Expand All @@ -76,8 +76,8 @@ done
###############
# golangci-lint
###############
GOCILINT_VERSION="1.55.2"
GOCILINT_SHA256SUM="ca21c961a33be3bc15e4292dc40c98c8dcc5463a7b6768a3afc123761630c09c"
GOCILINT_VERSION="1.59.1"
GOCILINT_SHA256SUM="c30696f1292cff8778a495400745f0f9c0406a3f38d8bb12cef48d599f6c7791"
GOCILINT_LOCATION=https://github.com/golangci/golangci-lint/releases/download/v${GOCILINT_VERSION}/golangci-lint-${GOCILINT_VERSION}-linux-amd64.tar.gz

curl -L -o golangci-lint.tar.gz $GOCILINT_LOCATION
Expand All @@ -89,8 +89,8 @@ rm -f golangci-lint.tar.gz
####
# gh
####
GH_VERSION="2.43.0"
GH_SHA256SUM="fb017c1d7072d84fba72a4098382b93a7617d8efd8a7c0609b0f51d650ea393a"
GH_VERSION="2.51.0"
GH_SHA256SUM="d7725fb2a643ca024edf5b4e2f2cca0431a404bbc2e251086ffca2b25e37be11"
GH_LOCATION=https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_amd64.tar.gz

curl -L -o gh.tar.gz $GH_LOCATION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ make boilerplate-update
make op-generate

diff deploy/crds/mygroup.operators.coreos.com_testkinds.yaml expected/mygroup.operators.coreos.com_testkinds.yaml || err "CRD generation didn't work properly."
diff api/v1beta1/zz_generated.deepcopy.go expected/zz_generated.deepcopy.go || err "controller-gen code generation didn't work properly."

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
controller-gen.kubebuilder.io/version: v0.15.0
name: testkinds.mygroup.operators.coreos.com
spec:
group: mygroup.operators.coreos.com
Expand All @@ -20,14 +20,19 @@ spec:
description: TestKind is the Schema for the testkinds API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.15.0
name: testkinds.mygroup.operators.coreos.com
spec:
group: mygroup.operators.coreos.com
Expand Down
98 changes: 98 additions & 0 deletions test/projects/file-generate/expected/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.